Exp::Exp() { STANDARD_CONSTRUCTOR() setMean(10.0); std::cout << "Exp::Exp() called\n"; }
void descriptorExtractor::loadNet(const String& model_file, const String& trained_file, const String& mean_file) { if (net_set) { /* Load the network. */ convnet = new Net<float>(model_file, TEST); convnet->CopyTrainedLayersFrom(trained_file); if (convnet->num_inputs() != 1) std::cout << "Network should have exactly one input." << std::endl; if (convnet->num_outputs() != 1) std::cout << "Network should have exactly one output." << std::endl; Blob<float>* input_layer = convnet->input_blobs()[0]; num_channels = input_layer->channels(); if (num_channels != 3 && num_channels != 1) std::cout << "Input layer should have 1 or 3 channels." << std::endl; input_geometry = cv::Size(input_layer->width(), input_layer->height()); /* Load the binaryproto mean file. */ if (!mean_file.empty()) { setMean(mean_file); net_ready = 2; } else { net_ready = 1; } } else { std::cout << "Error: Net is not set properly in advance using construtor." << std::endl; } };
NormalDistribution::NormalDistribution(double mean, double standardDeviation) : UncertaintyDescription(boost::shared_ptr<detail::UncertaintyDescription_Impl>( new detail::UncertaintyDescription_Impl(NormalDistribution::type()))) { setMean(mean); setStandardDeviation(standardDeviation); }
void CybGaussianNaiveBayes::initData() { for(int i=0; i < this->getVariablesNumber();i++) //X, Y, Z { float mean = 0; //mean variable for(int j=0; j < this->getData()->size(); j++) //from 0 to size do mean += this->getData()->pos(j)->operator[](i); //add value to mean setMean(mean/this->getData()->size(), i); //divide mean by its size } for(int i=0; i < this->getVariablesNumber();i++) //X, Y, Z { float variance = 0; //variance variable for(int j=0; j<this->getData()->size(); j++) //from 0 to size do { //variancia = variancia + pow((float_aux[j] - media), 2); variance += pow((this->getData()->pos(j)->operator[](i) - this->getMean(i)), 2); //add to variance } setVariance(variance/this->getData()->size(), i); //divide variance by its size } }
Moment& Moment::operator=(const Moment& source) { if (this != &source) // protect against invalid self-assignment { m_numStates = source.m_numStates; setMean(source.mean()); setCovariance(source.covariance()); } // by convention, always return *this return *this; }
void Gaussian::configure(const std::string& parameters) { if (parameters.empty()) return; std::vector<std::string> values = Op::split(parameters, " "); std::size_t required = 2; if (values.size() < required) { std::ostringstream ex; ex << "[configuration error] term <" << className() << ">" << " requires <" << required << "> parameters"; throw fl::Exception(ex.str(), FL_AT); } setMean(Op::toScalar(values.at(0))); setStandardDeviation(Op::toScalar(values.at(1))); if (values.size() > required) setHeight(Op::toScalar(values.at(required))); }
bool Exp::setSlotMean(const oe::base::Number* const mean) { if (mean != nullptr) setMean(mean->getDouble()); return true; }