00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #include <iostream>
00019 #include <fstream>
00020 #include <string>
00021 #include <sstream>
00022 #include <cmath>
00023
00024
00025
00026 #include "testing_analysis.h"
00027
00028 namespace OpenNN
00029 {
00030
00031
00032
00036
00037 TestingAnalysis::TestingAnalysis(void)
00038 : neural_network_pointer(NULL),
00039 data_set_pointer(NULL),
00040 mathematical_model_pointer(NULL),
00041 function_regression_testing_pointer(NULL),
00042 pattern_recognition_testing_pointer(NULL),
00043 time_series_prediction_testing_pointer(NULL),
00044 inverse_problem_testing_pointer(NULL)
00045 {
00046 construct_function_regression_testing();
00047
00048 set_default();
00049
00050 }
00051
00052
00053
00054
00059
00060 TestingAnalysis::TestingAnalysis(NeuralNetwork* new_neural_network_pointer)
00061 : neural_network_pointer(new_neural_network_pointer),
00062 data_set_pointer(NULL),
00063 mathematical_model_pointer(NULL),
00064 function_regression_testing_pointer(NULL),
00065 pattern_recognition_testing_pointer(NULL),
00066 time_series_prediction_testing_pointer(NULL),
00067 inverse_problem_testing_pointer(NULL)
00068 {
00069 construct_function_regression_testing();
00070
00071 set_default();
00072 }
00073
00074
00075
00076
00081
00082 TestingAnalysis::TestingAnalysis(MathematicalModel* new_mathematical_model_pointer)
00083 : neural_network_pointer(NULL),
00084 data_set_pointer(NULL),
00085 mathematical_model_pointer(new_mathematical_model_pointer),
00086 function_regression_testing_pointer(NULL),
00087 pattern_recognition_testing_pointer(NULL),
00088 time_series_prediction_testing_pointer(NULL),
00089 inverse_problem_testing_pointer(NULL)
00090 {
00091 construct_inverse_problem_testing();
00092
00093 set_default();
00094 }
00095
00096
00097
00098
00103
00104 TestingAnalysis::TestingAnalysis(DataSet* new_data_set_pointer)
00105 : neural_network_pointer(NULL),
00106 data_set_pointer(new_data_set_pointer),
00107 mathematical_model_pointer(NULL),
00108 function_regression_testing_pointer(NULL),
00109 pattern_recognition_testing_pointer(NULL),
00110 time_series_prediction_testing_pointer(NULL),
00111 inverse_problem_testing_pointer(NULL)
00112 {
00113 construct_function_regression_testing();
00114
00115 set_default();
00116 }
00117
00118
00119
00120
00126
00127 TestingAnalysis::TestingAnalysis(NeuralNetwork* new_neural_network_pointer, MathematicalModel* new_mathematical_model_pointer)
00128 : neural_network_pointer(new_neural_network_pointer),
00129 data_set_pointer(NULL),
00130 mathematical_model_pointer(new_mathematical_model_pointer),
00131 function_regression_testing_pointer(NULL),
00132 pattern_recognition_testing_pointer(NULL),
00133 time_series_prediction_testing_pointer(NULL),
00134 inverse_problem_testing_pointer(NULL)
00135 {
00136 construct_inverse_problem_testing();
00137
00138 set_default();
00139 }
00140
00141
00142
00143
00149
00150 TestingAnalysis::TestingAnalysis(NeuralNetwork* new_neural_network_pointer, DataSet* new_data_set_pointer)
00151 : neural_network_pointer(new_neural_network_pointer),
00152 data_set_pointer(new_data_set_pointer),
00153 mathematical_model_pointer(NULL),
00154 function_regression_testing_pointer(NULL),
00155 pattern_recognition_testing_pointer(NULL),
00156 time_series_prediction_testing_pointer(NULL),
00157 inverse_problem_testing_pointer(NULL)
00158 {
00159 construct_function_regression_testing();
00160
00161 set_default();
00162 }
00163
00164
00165
00166
00173
00174 TestingAnalysis::TestingAnalysis(NeuralNetwork* new_neural_network_pointer, DataSet* new_data_set_pointer, MathematicalModel* new_mathematical_model_pointer)
00175 : neural_network_pointer(new_neural_network_pointer),
00176 data_set_pointer(new_data_set_pointer),
00177 mathematical_model_pointer(new_mathematical_model_pointer),
00178 function_regression_testing_pointer(NULL),
00179 pattern_recognition_testing_pointer(NULL),
00180 time_series_prediction_testing_pointer(NULL),
00181 inverse_problem_testing_pointer(NULL)
00182 {
00183 construct_inverse_problem_testing();
00184
00185 set_default();
00186 }
00187
00188
00189
00190
00195
00196 TestingAnalysis::TestingAnalysis(TiXmlElement* testing_analysis_element)
00197 : neural_network_pointer(NULL),
00198 data_set_pointer(NULL),
00199 mathematical_model_pointer(NULL),
00200 function_regression_testing_pointer(NULL),
00201 pattern_recognition_testing_pointer(NULL),
00202 time_series_prediction_testing_pointer(NULL),
00203 inverse_problem_testing_pointer(NULL)
00204 {
00205 set_default();
00206
00207 from_XML(testing_analysis_element);
00208 }
00209
00210
00211
00212
00217
00218 TestingAnalysis::TestingAnalysis(const std::string& filename)
00219 : neural_network_pointer(NULL),
00220 data_set_pointer(NULL),
00221 mathematical_model_pointer(NULL),
00222 function_regression_testing_pointer(NULL),
00223 pattern_recognition_testing_pointer(NULL),
00224 time_series_prediction_testing_pointer(NULL),
00225 inverse_problem_testing_pointer(NULL)
00226 {
00227 set_default();
00228
00229 load(filename);
00230 }
00231
00232
00233
00236
00237 TestingAnalysis::~TestingAnalysis()
00238 {
00239 delete function_regression_testing_pointer;
00240 delete pattern_recognition_testing_pointer;
00241 delete time_series_prediction_testing_pointer;
00242 delete inverse_problem_testing_pointer;
00243 }
00244
00245
00246
00247
00248
00249
00251
00252 NeuralNetwork* TestingAnalysis::get_neural_network_pointer(void) const
00253 {
00254 return(neural_network_pointer);
00255 }
00256
00257
00258
00259
00261
00262 DataSet* TestingAnalysis::get_data_set_pointer(void) const
00263 {
00264 return(data_set_pointer);
00265 }
00266
00267
00268
00269
00271
00272 MathematicalModel* TestingAnalysis::get_mathematical_model_pointer(void) const
00273 {
00274 return(mathematical_model_pointer);
00275 }
00276
00277
00278
00279
00281
00282 FunctionRegressionTesting* TestingAnalysis::get_function_regression_testing_pointer(void) const
00283 {
00284 return(function_regression_testing_pointer);
00285 }
00286
00287
00288
00289
00291
00292 PatternRecognitionTesting* TestingAnalysis::get_pattern_recognition_testing_pointer(void) const
00293 {
00294 return(pattern_recognition_testing_pointer);
00295 }
00296
00297
00298
00299
00301
00302 TimeSeriesPredictionTesting* TestingAnalysis::get_time_series_prediction_testing_pointer(void) const
00303 {
00304 return(time_series_prediction_testing_pointer);
00305 }
00306
00307
00308
00309
00311
00312 InverseProblemTesting* TestingAnalysis::get_inverse_problem_testing_pointer(void) const
00313 {
00314 return(inverse_problem_testing_pointer);
00315 }
00316
00317
00318
00319
00322
00323 const bool& TestingAnalysis::get_display(void) const
00324 {
00325 return(display);
00326 }
00327
00328
00329
00330
00335
00336 void TestingAnalysis::set_default(void)
00337 {
00338 display = true;
00339 }
00340
00341
00342
00343
00346
00347 void TestingAnalysis::set_neural_network_pointer(NeuralNetwork* new_neural_network_pointer)
00348 {
00349 neural_network_pointer = new_neural_network_pointer;
00350 }
00351
00352
00353
00354
00357
00358 void TestingAnalysis::set_mathematical_model_pointer(MathematicalModel* new_mathematical_model_pointer)
00359 {
00360 mathematical_model_pointer = new_mathematical_model_pointer;
00361 }
00362
00363
00364
00365
00368
00369 void TestingAnalysis::set_data_set_pointer(DataSet* new_data_set_pointer)
00370 {
00371 data_set_pointer = new_data_set_pointer;
00372 }
00373
00374
00375
00376
00380
00381 void TestingAnalysis::set_function_regression_testing_pointer(FunctionRegressionTesting* new_function_regression_testing_pointer)
00382 {
00383 function_regression_testing_pointer = new_function_regression_testing_pointer;
00384 }
00385
00386
00387
00388
00392
00393 void TestingAnalysis::set_pattern_recognition_testing_pointer(PatternRecognitionTesting* new_pattern_recognition_testing_pointer)
00394 {
00395 pattern_recognition_testing_pointer = new_pattern_recognition_testing_pointer;
00396 }
00397
00398
00399
00400
00404
00405 void TestingAnalysis::set_time_series_prediction_testing_pointer(TimeSeriesPredictionTesting* new_time_series_prediction_testing_pointer)
00406 {
00407 time_series_prediction_testing_pointer = new_time_series_prediction_testing_pointer;
00408 }
00409
00410
00411
00412
00416
00417 void TestingAnalysis::set_inverse_problem_testing_pointer(InverseProblemTesting* new_inverse_problem_testing_pointer)
00418 {
00419 inverse_problem_testing_pointer = new_inverse_problem_testing_pointer;
00420 }
00421
00422
00423
00424
00429
00430 void TestingAnalysis::set_display(const bool& new_display)
00431 {
00432 display = new_display;
00433 }
00434
00435
00436
00437
00440
00441 void TestingAnalysis::construct_function_regression_testing(void)
00442 {
00443 if(!function_regression_testing_pointer)
00444 {
00445 function_regression_testing_pointer = new FunctionRegressionTesting(neural_network_pointer, data_set_pointer);
00446 }
00447 }
00448
00449
00450
00451
00454
00455 void TestingAnalysis::construct_pattern_recognition_testing(void)
00456 {
00457 if(!pattern_recognition_testing_pointer)
00458 {
00459 pattern_recognition_testing_pointer = new PatternRecognitionTesting(neural_network_pointer, data_set_pointer);
00460 }
00461 }
00462
00463
00464
00465
00468
00469 void TestingAnalysis::construct_time_series_prediction_testing(void)
00470 {
00471 if(!time_series_prediction_testing_pointer)
00472 {
00473 time_series_prediction_testing_pointer = new TimeSeriesPredictionTesting(neural_network_pointer, data_set_pointer);
00474 }
00475 }
00476
00477
00478
00479
00482
00483 void TestingAnalysis::construct_inverse_problem_testing(void)
00484 {
00485 if(!inverse_problem_testing_pointer)
00486 {
00487 inverse_problem_testing_pointer = new InverseProblemTesting(neural_network_pointer, data_set_pointer, mathematical_model_pointer);
00488 }
00489 }
00490
00491
00492
00493
00495
00496 void TestingAnalysis::destruct_function_regression_testing(void)
00497 {
00498 delete function_regression_testing_pointer;
00499
00500 function_regression_testing_pointer = NULL;
00501 }
00502
00503
00504
00505
00507
00508 void TestingAnalysis::destruct_pattern_recognition_testing(void)
00509 {
00510 delete pattern_recognition_testing_pointer;
00511
00512 pattern_recognition_testing_pointer = NULL;
00513 }
00514
00515
00516
00517
00519
00520 void TestingAnalysis::destruct_time_series_prediction_testing(void)
00521 {
00522 delete time_series_prediction_testing_pointer;
00523
00524 time_series_prediction_testing_pointer = NULL;
00525 }
00526
00527
00528
00529
00531
00532 void TestingAnalysis::destruct_inverse_problem_testing(void)
00533 {
00534 delete inverse_problem_testing_pointer;
00535
00536 inverse_problem_testing_pointer = NULL;
00537 }
00538
00539
00540
00541
00543
00544 std::string TestingAnalysis::to_string(void) const
00545 {
00546 std::ostringstream buffer;
00547
00548 buffer << "Testing analysis\n"
00549 << "Display: " << display << "\n";
00550
00551 if(function_regression_testing_pointer)
00552 {
00553 buffer << function_regression_testing_pointer->to_string();
00554 }
00555
00556 if(pattern_recognition_testing_pointer)
00557 {
00558 buffer << pattern_recognition_testing_pointer->to_string();
00559 }
00560
00561 if(time_series_prediction_testing_pointer)
00562 {
00563 buffer << time_series_prediction_testing_pointer->to_string();
00564 }
00565
00566 if(inverse_problem_testing_pointer)
00567 {
00568 buffer << inverse_problem_testing_pointer->to_string();
00569 }
00570
00571 return(buffer.str());
00572 }
00573
00574
00575
00576
00578
00579 void TestingAnalysis::print(void) const
00580 {
00581 std::cout << to_string();
00582 }
00583
00584
00585
00586
00590
00591 TiXmlElement* TestingAnalysis::to_XML(void) const
00592 {
00593 return(NULL);
00594 }
00595
00596
00597
00598
00600
00601 void TestingAnalysis::from_XML(TiXmlElement*)
00602 {
00603 }
00604
00605
00606
00608
00609 void TestingAnalysis::save(const std::string&) const
00610 {
00611
00612 }
00613
00614
00615
00617
00618 void TestingAnalysis::load(const std::string&)
00619 {
00620
00621 }
00622
00623 }
00624
00625
00626
00627
00628
00629
00630
00631
00632
00633
00634
00635
00636
00637
00638
00639
00640
00641