pruning_inputs.cpp
1// OpenNN: Open Neural Networks Library
2// www.opennn.net
3//
4// P R U N I N G I N P U T S C L A S S
5//
6// Artificial Intelligence Techniques SL
7// artelnics@artelnics.com
8
9#include "pruning_inputs.h"
10
11namespace OpenNN
12{
13
15
18{
20}
21
22
25
26PruningInputs::PruningInputs(TrainingStrategy* new_training_strategy_pointer)
27 : InputsSelection(new_training_strategy_pointer)
28{
30}
31
32
34
36{
37}
38
39
41
43{
45}
46
47
49
51{
53}
54
55
57
59{
61}
62
63
65
67{
68 if(training_strategy_pointer == nullptr || !training_strategy_pointer->has_neural_network())
69 {
71
73 }
74 else
75 {
77
79 }
80
82
83 minimum_correlation = type(0);
84
85 trials_number = 3;
86
88
89 maximum_time = type(3600.0);
90}
91
92
95
96void PruningInputs::set_minimum_inputs_number(const Index& new_minimum_inputs_number)
97{
98#ifdef OPENNN_DEBUG
99
100 if(new_minimum_inputs_number <= 0)
101 {
102 ostringstream buffer;
103
104 buffer << "OpenNN Exception: PruningInputs class.\n"
105 << "void set_minimum_inputs_number(const Index&) method.\n"
106 << "Minimum inputs number must be greater than 0.\n";
107
108 throw logic_error(buffer.str());
109 }
110
111#endif
112
113 minimum_inputs_number = new_minimum_inputs_number;
114}
115
116
119
120void PruningInputs::set_maximum_inputs_number(const Index& new_maximum_inputs_number)
121{
122#ifdef OPENNN_DEBUG
123
124 if(new_maximum_inputs_number <= 0)
125 {
126 ostringstream buffer;
127
128 buffer << "OpenNN Exception: PruningInputs class.\n"
129 << "void set_maximum_inputs_number(const Index&) method.\n"
130 << "Maximum inputs number must be greater than 0.\n";
131
132 throw logic_error(buffer.str());
133 }
134
135#endif
136
137 maximum_inputs_number = new_maximum_inputs_number;
138}
139
140
143
144void PruningInputs::set_maximum_selection_failures(const Index& new_maximum_selection_failures)
145{
146#ifdef OPENNN_DEBUG
147
148 if(new_maximum_selection_failures <= 0)
149 {
150 ostringstream buffer;
151
152 buffer << "OpenNN Exception: PruningInputs class.\n"
153 << "void set_maximum_selection_failures(const Index&) method.\n"
154 << "Maximum selection failures must be greater than 0.\n";
155
156 throw logic_error(buffer.str());
157 }
158
159#endif
160
161 maximum_selection_failures = new_maximum_selection_failures;
162}
163
164
166
168{
169
170#ifdef OPENNN_DEBUG
171
172 check();
173
174#endif
175
176 InputsSelectionResults inputs_selection_results(maximum_epochs_number);
177
178 if(display) cout << "Performing pruning inputs selection..." << endl;
179
180 // Loss index
181
182 const LossIndex* loss_index_pointer = training_strategy_pointer->get_loss_index_pointer();
183
184 type previus_selection_error = numeric_limits<type>::max();
185
186 // Data set
187
188 DataSet* data_set_pointer = loss_index_pointer->get_data_set_pointer();
189
190 const Tensor<Index, 1> target_columns_indices = data_set_pointer->get_target_columns_indices();
191
192 Tensor<string, 1> input_columns_names;
193
194 const Tensor<type, 2> correlations = get_correlation_values(data_set_pointer->calculate_input_target_columns_correlations());
195
196 const Tensor<type, 1> total_correlations = correlations.abs().sum(rows_sum);
197
198 Tensor<Index, 1> correlations_rank_ascending = data_set_pointer->get_input_columns_indices();
199
200 sort(correlations_rank_ascending.data(),
201 correlations_rank_ascending.data() + correlations_rank_ascending.size(),
202 [&](Index i, Index j){return total_correlations[i] < total_correlations[j];});
203
204 // Neural network
205
207
208 // Training strategy
209
211
212 Index selection_failures = 0;
213
214 TrainingResults training_results;
215
216 // Model selection
217
218 time_t beginning_time, current_time;
219 type elapsed_time = type(0);
220
221 time(&beginning_time);
222
223 bool stop = false;
224
225 for(Index epoch = 0; epoch < maximum_epochs_number; epoch++)
226 {
227 if(epoch > 0) data_set_pointer->set_column_use(correlations_rank_ascending[epoch], DataSet::VariableUse::UnusedVariable);
228
229 const Index input_columns_number = data_set_pointer->get_input_columns_number();
230 const Index input_variables_number = data_set_pointer->get_input_variables_number();
231
232 neural_network_pointer->set_inputs_number(input_variables_number);
233
234 if(display)
235 {
236 cout << endl;
237 cout << "Epoch: " << epoch << endl;
238 cout << "Input columns number: " << input_columns_number << endl;
239 cout << "Inputs: " << endl;
240
241 input_columns_names = data_set_pointer->get_input_columns_names();
242
243 for(Index i = 0; i < input_columns_number; i++) cout << " " << input_columns_names(i) << endl;
244 }
245
246 type minimum_training_error = numeric_limits<type>::max();
247 type minimum_selection_error = numeric_limits<type>::max();
248
249 for(Index trial = 0; trial < trials_number; trial++)
250 {
251 neural_network_pointer->set_parameters_random();
252
253 training_results = training_strategy_pointer->perform_training();
254
255 if(training_results.get_selection_error() < minimum_selection_error)
256 {
257 minimum_training_error = training_results.get_training_error();
258 minimum_selection_error = training_results.get_selection_error();
259
260 inputs_selection_results.training_error_history(epoch) = minimum_training_error;
261 inputs_selection_results.selection_error_history(epoch) = minimum_selection_error;
262 }
263
264 if(training_results.get_selection_error() < inputs_selection_results.optimum_selection_error)
265 {
266 // Neural network
267
268 inputs_selection_results.optimal_input_columns_indices = data_set_pointer->get_input_columns_indices();
269 inputs_selection_results.optimal_input_columns_names = data_set_pointer->get_input_columns_names();
270
271 inputs_selection_results.optimal_parameters = neural_network_pointer->get_parameters();
272
273 // Loss index
274
275 inputs_selection_results.optimum_training_error = training_results.get_training_error();
276 inputs_selection_results.optimum_selection_error = training_results.get_selection_error();
277 }
278
279 if(display)
280 {
281 cout << "Trial number: " << trial+1 << endl;
282 cout << " Training error: " << training_results.get_training_error() << endl;
283 cout << " Selection error: " << training_results.get_selection_error() << endl;
284 }
285 }
286
287 if(inputs_selection_results.optimum_selection_error >= previus_selection_error) selection_failures++;
288
289 previus_selection_error = inputs_selection_results.optimum_selection_error;
290
291 inputs_selection_results.training_error_history(epoch) = training_results.get_training_error();
292
293 inputs_selection_results.selection_error_history(epoch) = training_results.get_selection_error();
294
295 time(&current_time);
296
297 elapsed_time = static_cast<type>( difftime(current_time,beginning_time));
298
299 // Stopping criteria
300
301 if(elapsed_time >= maximum_time)
302 {
303 stop = true;
304
305 if(display) cout << "Epoch " << epoch << endl << "Maximum time reached: " << write_time(elapsed_time) << endl;
306
307 inputs_selection_results.stopping_condition = InputsSelection::StoppingCondition::MaximumTime;
308 }
309 else if(inputs_selection_results.optimum_selection_error <= selection_error_goal)
310 {
311 stop = true;
312
313 if(display) cout << "Epoch " << epoch << endl << "Selection loss reached: " << inputs_selection_results.optimum_selection_error << endl;
314
315 inputs_selection_results.stopping_condition = InputsSelection::StoppingCondition::SelectionErrorGoal;
316 }
317 else if(epoch >= maximum_epochs_number)
318 {
319 stop = true;
320
321 if(display) cout << "Epoch " << epoch << endl << "Maximum number of epochs reached: " << epoch << endl;
322
323 inputs_selection_results.stopping_condition = InputsSelection::StoppingCondition::MaximumEpochs;
324 }
325 else if(selection_failures >= maximum_selection_failures)
326 {
327 stop = true;
328
329 if(display) cout << "Epoch " << epoch << endl << "Maximum selection failures reached: " << selection_failures << endl;
330
331 inputs_selection_results.stopping_condition = InputsSelection::StoppingCondition::MaximumSelectionFailures;
332 }
333 else if(input_columns_number <= minimum_inputs_number || input_columns_number == 1)
334 {
335 stop = true;
336
337 if(display) cout << "Epoch " << epoch << endl << "Minimum inputs reached: " << minimum_inputs_number << endl;
338
339 inputs_selection_results.stopping_condition = InputsSelection::StoppingCondition::MinimumInputs;
340 }
341
342 if(stop)
343 {
344 // Save results
345
346 inputs_selection_results.elapsed_time = write_time(elapsed_time);
347
348 inputs_selection_results.resize_history(epoch+1);
349
350 break;
351 }
352 }
353
354 // Set data set stuff
355
356 data_set_pointer->set_input_target_columns(inputs_selection_results.optimal_input_columns_indices, target_columns_indices);
357
358 const Tensor<Scaler, 1> input_variables_scalers = data_set_pointer->get_input_variables_scalers();
359
360 const Tensor<Descriptives, 1> input_variables_descriptives = data_set_pointer->calculate_input_variables_descriptives();
361
362 // Set neural network stuff
363
364 neural_network_pointer->set_inputs_number(data_set_pointer->get_input_variables_number());
365
366 neural_network_pointer->set_inputs_names(data_set_pointer->get_input_variables_names());
367
368 if(neural_network_pointer->has_scaling_layer())
369 neural_network_pointer->get_scaling_layer_pointer()->set(input_variables_descriptives, input_variables_scalers);
370
371 neural_network_pointer->set_parameters(inputs_selection_results.optimal_parameters);
372
373 if(display) inputs_selection_results.print();
374
375 return inputs_selection_results;
376}
377
378
380
381Tensor<string, 2> PruningInputs::to_string_matrix() const
382{
383 ostringstream buffer;
384
385 Tensor<string, 1> labels(8);
386 Tensor<string, 1> values(8);
387
388 // Trials number
389
390 labels(0) = "Trials number";
391
392 buffer.str("");
393 buffer << trials_number;
394
395 values(0) = buffer.str();
396
397 // Selection loss goal
398
399 labels(1) = "Selection loss goal";
400
401 buffer.str("");
402 buffer << selection_error_goal;
403
404 values(1) = buffer.str();
405
406 // Maximum selection failures
407
408 labels(2) = "Maximum selection failures";
409
410 buffer.str("");
412
413 values(2) = buffer.str();
414
415 // Minimum inputs number
416
417 labels(3) = "Minimum inputs number";
418
419 buffer.str("");
420 buffer << minimum_inputs_number;
421
422 values(3) = buffer.str();
423
424 // Minimum correlation
425
426 labels(4) = "Minimum correlation";
427
428 buffer.str("");
429 buffer << minimum_correlation;
430
431 values(4) = buffer.str();
432
433 // Maximum correlation
434
435 labels(5) = "Maximum correlation";
436
437 buffer.str("");
438 buffer << maximum_correlation;
439
440 values(5) = buffer.str();
441
442 // Maximum iterations number
443
444 labels(6) = "Maximum iterations number";
445
446 buffer.str("");
447 buffer << maximum_epochs_number;
448
449 values(6) = buffer.str();
450
451 // Maximum time
452
453 labels(7) = "Maximum time";
454
455 buffer.str("");
456 buffer << maximum_time;
457
458 values(7) = buffer.str();
459
460 const Index rows_number = labels.size();
461 const Index columns_number = 2;
462
463 Tensor<string, 2> string_matrix(rows_number, columns_number);
464
465 string_matrix.chip(0, 1) = labels;
466 string_matrix.chip(1, 1) = values;
467
468 return string_matrix;
469}
470
471
474
476{
477 ostringstream buffer;
478
479 file_stream.OpenElement("PruningInputs");
480
481 // Trials number
482
483 file_stream.OpenElement("TrialsNumber");
484
485 buffer.str("");
486 buffer << trials_number;
487
488 file_stream.PushText(buffer.str().c_str());
489
490 file_stream.CloseElement();
491
492 // selection error goal
493
494 file_stream.OpenElement("SelectionErrorGoal");
495
496 buffer.str("");
497 buffer << selection_error_goal;
498
499 file_stream.PushText(buffer.str().c_str());
500
501 file_stream.CloseElement();
502
503 // Maximum selection failures
504
505 file_stream.OpenElement("MaximumSelectionFailures");
506
507 buffer.str("");
509
510 file_stream.PushText(buffer.str().c_str());
511
512 file_stream.CloseElement();
513
514 // Minimum inputs number
515
516 file_stream.OpenElement("MinimumInputsNumber");
517
518 buffer.str("");
519 buffer << minimum_inputs_number;
520
521 file_stream.PushText(buffer.str().c_str());
522
523 file_stream.CloseElement();
524
525 // Maximum inputs number
526
527 file_stream.OpenElement("MaximumInputsNumber");
528
529 buffer.str("");
530 buffer << maximum_inputs_number;
531
532 file_stream.PushText(buffer.str().c_str());
533
534 file_stream.CloseElement();
535
536 // Minimum correlation
537
538 file_stream.OpenElement("MinimumCorrelation");
539
540 buffer.str("");
541 buffer << minimum_correlation;
542
543 file_stream.PushText(buffer.str().c_str());
544
545 file_stream.CloseElement();
546
547 // Maximum correlation
548
549 file_stream.OpenElement("MaximumCorrelation");
550
551 buffer.str("");
552 buffer << maximum_correlation;
553
554 file_stream.PushText(buffer.str().c_str());
555
556 file_stream.CloseElement();
557
558 // Maximum iterations
559
560 file_stream.OpenElement("MaximumEpochsNumber");
561
562 buffer.str("");
563 buffer << maximum_epochs_number;
564
565 file_stream.PushText(buffer.str().c_str());
566
567 file_stream.CloseElement();
568
569 // Maximum time
570
571 file_stream.OpenElement("MaximumTime");
572
573 buffer.str("");
574 buffer << maximum_time;
575
576 file_stream.PushText(buffer.str().c_str());
577
578 file_stream.CloseElement();
579
580 file_stream.CloseElement();
581}
582
583
586
588{
589 const tinyxml2::XMLElement* root_element = document.FirstChildElement("PruningInputs");
590
591 if(!root_element)
592 {
593 ostringstream buffer;
594
595 buffer << "OpenNN Exception: PruningInputs class.\n"
596 << "void from_XML(const tinyxml2::XMLDocument&) method.\n"
597 << "PruningInputs element is nullptr.\n";
598
599 throw logic_error(buffer.str());
600 }
601
602 // Trials number
603 {
604 const tinyxml2::XMLElement* element = root_element->FirstChildElement("TrialsNumber");
605
606 if(element)
607 {
608 const Index new_trials_number = static_cast<Index>(atoi(element->GetText()));
609
610 try
611 {
612 set_trials_number(new_trials_number);
613 }
614 catch(const logic_error& e)
615 {
616 cerr << e.what() << endl;
617 }
618 }
619 }
620
621 // Display
622 {
623 const tinyxml2::XMLElement* element = root_element->FirstChildElement("Display");
624
625 if(element)
626 {
627 const string new_display = element->GetText();
628
629 try
630 {
631 set_display(new_display != "0");
632 }
633 catch(const logic_error& e)
634 {
635 cerr << e.what() << endl;
636 }
637 }
638 }
639
640 // selection error goal
641 {
642 const tinyxml2::XMLElement* element = root_element->FirstChildElement("SelectionErrorGoal");
643
644 if(element)
645 {
646 const type new_selection_error_goal = static_cast<type>(atof(element->GetText()));
647
648 try
649 {
650 set_selection_error_goal(new_selection_error_goal);
651 }
652 catch(const logic_error& e)
653 {
654 cerr << e.what() << endl;
655 }
656 }
657 }
658
659 // Maximum iterations number
660 {
661 const tinyxml2::XMLElement* element = root_element->FirstChildElement("MaximumEpochsNumber");
662
663 if(element)
664 {
665 const Index new_maximum_epochs_number = static_cast<Index>(atoi(element->GetText()));
666
667 try
668 {
669 set_maximum_epochs_number(new_maximum_epochs_number);
670 }
671 catch(const logic_error& e)
672 {
673 cerr << e.what() << endl;
674 }
675 }
676 }
677
678 // Maximum correlation
679 {
680 const tinyxml2::XMLElement* element = root_element->FirstChildElement("MaximumCorrelation");
681
682 if(element)
683 {
684 const type new_maximum_correlation = static_cast<type>(atof(element->GetText()));
685
686 try
687 {
688 set_maximum_correlation(new_maximum_correlation);
689 }
690 catch(const logic_error& e)
691 {
692 cerr << e.what() << endl;
693 }
694 }
695 }
696
697 // Minimum correlation
698 {
699 const tinyxml2::XMLElement* element = root_element->FirstChildElement("MinimumCorrelation");
700
701 if(element)
702 {
703 const type new_minimum_correlation = static_cast<type>(atof(element->GetText()));
704
705 try
706 {
707 set_minimum_correlation(new_minimum_correlation);
708 }
709 catch(const logic_error& e)
710 {
711 cerr << e.what() << endl;
712 }
713 }
714 }
715
716 // Maximum time
717 {
718 const tinyxml2::XMLElement* element = root_element->FirstChildElement("MaximumTime");
719
720 if(element)
721 {
722 const type new_maximum_time = static_cast<type>( atoi(element->GetText()));
723
724 try
725 {
726 set_maximum_time(new_maximum_time);
727 }
728 catch(const logic_error& e)
729 {
730 cerr << e.what() << endl;
731 }
732 }
733 }
734
735 // Minimum inputs number
736 {
737 const tinyxml2::XMLElement* element = root_element->FirstChildElement("MinimumInputsNumber");
738
739 if(element)
740 {
741 const Index new_minimum_inputs_number = static_cast<Index>(atoi(element->GetText()));
742
743 try
744 {
745 set_minimum_inputs_number(new_minimum_inputs_number);
746 }
747 catch(const logic_error& e)
748 {
749 cerr << e.what() << endl;
750 }
751 }
752 }
753
754 // Maximum inputs number
755 {
756 const tinyxml2::XMLElement* element = root_element->FirstChildElement("MaximumInputsNumber");
757
758 if(element)
759 {
760 const Index new_maximum_inputs_number = static_cast<Index>(atoi(element->GetText()));
761
762 try
763 {
764 set_maximum_inputs_number(new_maximum_inputs_number);
765 }
766 catch(const logic_error& e)
767 {
768 cerr << e.what() << endl;
769 }
770 }
771 }
772
773 // Maximum selection failures
774 {
775 const tinyxml2::XMLElement* element = root_element->FirstChildElement("MaximumSelectionFailures");
776
777 if(element)
778 {
779 const Index new_maximum_selection_failures = static_cast<Index>(atoi(element->GetText()));
780
781 try
782 {
783 set_maximum_selection_failures(new_maximum_selection_failures);
784 }
785 catch(const logic_error& e)
786 {
787 cerr << e.what() << endl;
788 }
789 }
790 }
791}
792
793
796
797void PruningInputs::save(const string& file_name) const
798{
799 FILE * file = fopen(file_name.c_str(), "w");
800
801 tinyxml2::XMLPrinter printer(file);
802
803 write_XML(printer);
804
805 fclose(file);
806}
807
808
811
812void PruningInputs::load(const string& file_name)
813{
814 set_default();
815
816 tinyxml2::XMLDocument document;
817
818 if(document.LoadFile(file_name.c_str()))
819 {
820 ostringstream buffer;
821
822 buffer << "OpenNN Exception: PruningInputs class.\n"
823 << "void load(const string&) method.\n"
824 << "Cannot load XML file " << file_name << ".\n";
825
826 throw logic_error(buffer.str());
827 }
828
829 from_XML(document);
830}
831}
832
833// OpenNN: Open Neural Networks Library.
834// Copyright(C) 2005-2021 Artificial Intelligence Techniques, SL.
835//
836// This library is free software; you can redistribute it and/or
837// modify it under the terms of the GNU Lesser General Public
838// License as published by the Free Software Foundation; either
839// version 2.1 of the License, or any later version.
840//
841// This library is distributed in the hope that it will be useful,
842// but WITHOUT ANY WARRANTY; without even the implied warranty of
843// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
844// Lesser General Public License for more details.
845
846// You should have received a copy of the GNU Lesser General Public
847// License along with this library; if not, write to the Free Software
848// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
This class represents the concept of a data set for data modelling problems, such as approximation,...
Definition: data_set.h:56
Tensor< Descriptives, 1 > calculate_input_variables_descriptives() const
Definition: data_set.cpp:5677
Tensor< Index, 1 > get_target_columns_indices() const
Returns a indices vector with the positions of the targets.
Definition: data_set.cpp:2319
Tensor< Index, 1 > get_input_columns_indices() const
Returns a indices vector with the positions of the inputs.
Definition: data_set.cpp:2275
Index get_input_variables_number() const
Definition: data_set.cpp:2863
Tensor< Correlation, 2 > calculate_input_target_columns_correlations() const
Definition: data_set.cpp:5827
Tensor< string, 1 > get_input_columns_names() const
Returns a string vector that contains the names of the columns whose uses are Input.
Definition: data_set.cpp:2509
Tensor< string, 1 > get_input_variables_names() const
Definition: data_set.cpp:2188
void set_column_use(const Index &, const VariableUse &)
Definition: data_set.cpp:3259
Index get_input_columns_number() const
Returns the number of columns whose uses are Input.
Definition: data_set.cpp:2579
This abstract class represents the concept of inputs selection algorithm for a ModelSelection.
TrainingStrategy * training_strategy_pointer
Pointer to a training strategy object.
void set_selection_error_goal(const type &)
void check() const
Checks that the different pointers needed for performing the inputs selection are not nullptr.
Index trials_number
Number of trials for each neural network.
void set_maximum_correlation(const type &)
bool display
Display messages to screen.
type selection_error_goal
Goal value for the selection error. It is used as a stopping criterion.
void set_maximum_time(const type &)
const string write_time(const type &) const
Writes the time from seconds in format HH:mm:ss.
type maximum_time
Maximum selection algorithm time. It is used as a stopping criterion.
void set_maximum_epochs_number(const Index &)
type minimum_correlation
Minimum value for the correlations.
Index maximum_epochs_number
Maximum number of epochs to perform_inputs_selection. It is used as a stopping criterion.
void set_display(const bool &)
void set_minimum_correlation(const type &)
type maximum_correlation
Maximum value for the correlations.
void set_trials_number(const Index &)
This abstract class represents the concept of loss index composed of an error term and a regularizati...
Definition: loss_index.h:49
DataSet * get_data_set_pointer() const
Returns a pointer to the data set object associated to the error term.
Definition: loss_index.h:93
This class represents the concept of neural network in the OpenNN library.
ScalingLayer * get_scaling_layer_pointer() const
Returns a pointer to the scaling layers object composing this neural network object.
bool has_scaling_layer() const
Index get_inputs_number() const
Returns the number of inputs to the neural network.
void set_inputs_number(const Index &)
void set_parameters(Tensor< type, 1 > &)
void set_inputs_names(const Tensor< string, 1 > &)
Tensor< type, 1 > get_parameters() const
void set_maximum_selection_failures(const Index &)
const Index & get_maximum_inputs_number() const
Returns the maximum number of inputs in the pruning inputs selection algorithm.
const Index & get_minimum_inputs_number() const
Returns the minimum number of inputs in the pruning inputs selection algorithm.
void from_XML(const tinyxml2::XMLDocument &)
void set_default()
Sets the members of the pruning inputs object to their default values.
void load(const string &)
PruningInputs()
Default constructor.
Tensor< string, 2 > to_string_matrix() const
Writes as matrix of strings the most representative atributes.
InputsSelectionResults perform_inputs_selection()
Perform the inputs selection with the pruning inputs method.
Index maximum_inputs_number
Maximum number of inputs in the neural network.
void set_maximum_inputs_number(const Index &)
void save(const string &) const
Index minimum_inputs_number
Minimum number of inputs in the neural network.
virtual ~PruningInputs()
Destructor.
void set_minimum_inputs_number(const Index &)
void write_XML(tinyxml2::XMLPrinter &) const
const Index & get_maximum_selection_failures() const
Returns the maximum number of selection failures in the pruning inputs algorithm.
Index maximum_selection_failures
Maximum number of epochs at which the selection error increases.
void set()
Sets the scaling layer to be empty.
This class represents the concept of training strategy for a neural network in OpenNN.
TrainingResults perform_training()
LossIndex * get_loss_index_pointer()
Returns a pointer to the LossIndex class.
NeuralNetwork * get_neural_network_pointer() const
Returns a pointer to the NeuralNetwork class.
void set_display(const bool &)
void PushText(const char *text, bool cdata=false)
Add a text node.
Definition: tinyxml2.cpp:2878
virtual void CloseElement(bool compactMode=false)
If streaming, close the Element.
Definition: tinyxml2.cpp:2834
This structure contains the results from the inputs selection.
Tensor< string, 1 > optimal_input_columns_names
Inputs of the neural network with minimum selection error.
type optimum_training_error
Value of training for the neural network with minimum selection error.
Tensor< type, 1 > selection_error_history
Final selection errors of the different neural networks.
Tensor< type, 1 > optimal_parameters
Vector of parameters for the neural network with minimum selection error.
InputsSelection::StoppingCondition stopping_condition
Stopping condition of the algorithm.
type optimum_selection_error
Value of minimum selection error.
Tensor< type, 1 > training_error_history
Final training errors of the different neural networks.
string elapsed_time
Elapsed time during the loss of the algortihm.
This structure contains the optimization algorithm results.