16 #include "outputs_integrals.h"
60 from_XML(outputs_integrals_document);
158 size_t outputs_number = 0;
187 std::ostringstream buffer;
193 buffer <<
"OpenNN Exception: OutputsIntegrals class.\n"
194 <<
"void check(void) const method.\n"
195 <<
"Pointer to neural network is NULL.\n";
197 throw std::logic_error(buffer.str());
202 if(!multilayer_perceptron_pointer)
204 buffer <<
"OpenNN Exception: OutputsIntegrals class.\n"
205 <<
"void check(void) const method.\n"
206 <<
"Pointer to multilayer perceptron is NULL.\n";
208 throw std::logic_error(buffer.str());
214 if(inputs_number != 1)
216 buffer <<
"OpenNN Exception: OutputsIntegrals class.\n"
217 <<
"void check(void) const method.\n"
218 <<
"Number of inputs in multilayer perceptron is not one.\n";
220 throw std::logic_error(buffer.str());
223 if(outputs_number == 0)
225 buffer <<
"OpenNN Exception: OutputsIntegrals class.\n"
226 <<
"void check(void) const method.\n"
227 <<
"Number of outputs in multilayer perceptron object is zero.\n";
229 throw std::logic_error(buffer.str());
241 std::ostringstream buffer;
243 buffer <<
"OpenNN Exception: OutputsIntegrals class.\n"
244 <<
"double calculate_performance(void) const method.\n"
245 <<
"This method is under development.\n";
247 throw std::logic_error(buffer.str());
286 std::ostringstream buffer;
288 buffer <<
"OpenNN Exception: OutputsIntegrals class.\n"
289 <<
"double calculate_performance(const Vector<double>&) const method.\n"
290 <<
"This method is under development.\n";
292 throw std::logic_error(buffer.str());
384 return(
"OUTPUTS_INTEGRALS");
394 std::ostringstream buffer;
396 tinyxml2::XMLDocument* document =
new tinyxml2::XMLDocument;
400 tinyxml2::XMLElement* outputs_integrals_element = document->NewElement(
"OutputsIntegrals");
402 document->InsertFirstChild(outputs_integrals_element);
409 outputs_integrals_element->LinkEndChild(element);
414 tinyxml2::XMLElement* element = document->NewElement(
"OutputsIntegralsWeights");
415 outputs_integrals_element->LinkEndChild(element);
420 tinyxml2::XMLText* text = document->NewText(buffer.str().c_str());
421 element->LinkEndChild(text);
426 tinyxml2::XMLElement* element = document->NewElement(
"Display");
427 outputs_integrals_element->LinkEndChild(element);
432 tinyxml2::XMLText* text = document->NewText(buffer.str().c_str());
433 element->LinkEndChild(text);
447 const tinyxml2::XMLElement* root_element = document.FirstChildElement(
"OutputsIntegrals");
451 std::ostringstream buffer;
453 buffer <<
"OpenNN Exception: OutputsIntegrals class.\n"
454 <<
"void from_XML(const tinyxml2::XMLDocument&) method.\n"
455 <<
"Outputs integrals element is NULL.\n";
457 throw std::logic_error(buffer.str());
462 const tinyxml2::XMLElement* display_element = root_element->FirstChildElement(
"Display");
466 const std::string new_display_string = display_element->GetText();
472 catch(
const std::logic_error& e)
474 std::cout << e.what() << std::endl;
const Vector< double > & get_outputs_integrals_weights(void) const
Returns the weights for each integral of the neural network outputs.
size_t get_inputs_number(void) const
Returns the number of inputs to the multilayer perceptron.
void set(void)
Sets the size of a vector to zero.
NumericalIntegration numerical_integration
Object for numerical integration of functions.
NumericalIntegration * get_numerical_integration_pointer(void)
Returns a pointer to the numerical integration object inside the outputs integrals object...
Vector< double > outputs_integrals_weights
Weigth for each output integral.
Vector< double > calculate_gradient(void) const
size_t get_outputs_number(void) const
Returns the number of outputs neurons in the multilayer perceptron.
const NumericalIntegration & get_numerical_integration(void) const
Returns a constant reference to the numerical integration object inside the outputs integrals object...
Matrix< double > calculate_Hessian(void) const
MultilayerPerceptron * get_multilayer_perceptron_pointer(void) const
Returns a pointer to the multilayer perceptron composing this neural network.
tinyxml2::XMLDocument * to_XML(void) const
Returns a representation of the sum squared error object, in XML format.
void set_outputs_integrals_weights(const Vector< double > &)
const double & get_output_integral_weight(const size_t &) const
double calculate_performance(void) const
void set_numerical_integration(const NumericalIntegration &)
std::string write_performance_term_type(void) const
Returns a string with the name of the outputs integrals performance type, "OUTPUTS_INTEGRALS".
virtual ~OutputsIntegrals(void)
Destructor.
bool has_multilayer_perceptron(void) const
tinyxml2::XMLDocument * to_XML(void) const
Serializes this numerical differentiation object into a XML document->
void set_output_integral_weight(const size_t &, const double &)
void from_XML(const tinyxml2::XMLDocument &)