00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016 #ifndef __INPUTTARGETDATASET_H__
00017 #define __INPUTTARGETDATASET_H__
00018
00019 #include <string>
00020
00021 #include "../Utilities/Vector.h"
00022 #include "../Utilities/Matrix.h"
00023
00024 namespace Flood
00025 {
00026
00029
00030 class InputTargetDataSet
00031 {
00032
00033 public:
00034
00035
00036
00037 explicit InputTargetDataSet(int, int, int);
00038
00039
00040
00041 explicit InputTargetDataSet(int, int);
00042
00043
00044
00045 explicit InputTargetDataSet(void);
00046
00047
00048
00049 InputTargetDataSet(const InputTargetDataSet&);
00050
00051
00052
00053 explicit InputTargetDataSet(const char*);
00054
00055
00056
00057 virtual ~InputTargetDataSet(void);
00058
00059
00060
00061 InputTargetDataSet& operator = (const InputTargetDataSet&);
00062
00063
00064
00065
00066
00068
00069 inline int get_instances_number(void)
00070 {
00071 return(data.get_rows_number());
00072 }
00073
00075
00076 int get_training_instances_number(void)
00077 {
00078 return(training_instances_indices.get_size());
00079 }
00080
00082
00083 int get_validation_instances_number(void)
00084 {
00085 return(validation_instances_indices.get_size());
00086 }
00087
00089
00090 int get_testing_instances_number(void)
00091 {
00092 return(testing_instances_indices.get_size());
00093 }
00094
00096
00097 inline int get_variables_number(void)
00098 {
00099 return(data.get_columns_number());
00100 }
00101
00103
00104 inline int get_input_variables_number(void)
00105 {
00106 return(input_variables_indices.get_size());
00107 }
00108
00110
00111 inline int get_target_variables_number(void)
00112 {
00113 return(target_variables_indices.get_size());
00114 }
00115
00116
00117
00118 Vector<int>& get_training_instances_indices(void);
00119 Vector<int>& get_validation_instances_indices(void);
00120 Vector<int>& get_testing_instances_indices(void);
00121
00122
00123
00124 Vector<int>& get_input_variables_indices(void);
00125 Vector<int>& get_target_variables_indices(void);
00126
00127
00128
00129 Vector<std::string>& get_variables_name(void);
00130 std::string& get_variable_name(int);
00131
00132 Vector<std::string> get_input_variables_name(void);
00133 Vector<std::string> get_target_variables_name(void);
00134
00135 Vector<std::string>& get_variables_units(void);
00136 std::string& get_variable_units(int);
00137
00138 Vector<std::string> get_input_variables_units(void);
00139 Vector<std::string> get_target_variables_units(void);
00140
00141 Vector<std::string>& get_variables_description(void);
00142 std::string& get_variable_description(int);
00143
00144 Vector<std::string> get_input_variables_description(void);
00145 Vector<std::string> get_target_variables_description(void);
00146
00147 Vector< Vector<std::string> > get_variables_information(void);
00148
00149 bool get_display(void);
00150
00151
00152
00153 Matrix<double>& get_data(void);
00154
00155 Matrix<double> get_training_data(void);
00156 Matrix<double> get_validation_data(void);
00157 Matrix<double> get_testing_data(void);
00158
00159 Matrix<double> get_input_data(void);
00160 Matrix<double> get_target_data(void);
00161
00162 Matrix<double> get_training_input_data(void);
00163 Matrix<double> get_training_target_data(void);
00164 Matrix<double> get_validation_input_data(void);
00165 Matrix<double> get_validation_target_data(void);
00166 Matrix<double> get_testing_input_data(void);
00167 Matrix<double> get_testing_target_data(void);
00168
00169
00170
00171 Vector<double> get_instance(int);
00172
00173 Vector<double> get_training_instance(int);
00174 Vector<double> get_validation_instance(int);
00175 Vector<double> get_testing_instance(int);
00176
00177 Vector<double> get_input_instance(int);
00178 Vector<double> get_target_instance(int);
00179
00180 Vector<double> get_training_input_instance(int);
00181 Vector<double> get_training_target_instance(int);
00182
00183 Vector<double> get_validation_input_instance(int);
00184 Vector<double> get_validation_target_instance(int);
00185
00186 Vector<double> get_testing_input_instance(int);
00187 Vector<double> get_testing_target_instance(int);
00188
00189
00190
00191 void set(void);
00192 void set(int, int);
00193 void set(int, int, int);
00194
00195
00196
00197 void set_training_instances_indices(const Vector<int>&);
00198 void set_validation_instances_indices(const Vector<int>&);
00199 void set_testing_instances_indices(const Vector<int>&);
00200
00201 void set_training(void);
00202 void set_validation(void);
00203 void set_testing(void);
00204
00205
00206
00207 void set_input_variables_indices(const Vector<int>&);
00208 void set_target_variables_indices(const Vector<int>&);
00209
00210 void set_input(void);
00211 void set_target(void);
00212
00213
00214
00215 void set_variables_name(const Vector<std::string>&);
00216 void set_variable_name(int, const std::string&);
00217
00218 void set_variables_units(const Vector<std::string>&);
00219 void set_variable_units(int, const std::string&);
00220
00221 void set_variables_description(const Vector<std::string>&);
00222 void set_variable_description(int, const std::string&);
00223
00224 void set_display(bool);
00225
00226
00227
00228 void set_data(const Matrix<double>&);
00229
00230 void set_instances_number(int);
00231 void set_variables_number(int);
00232
00233
00234
00235 void set_instance(int, const Vector<double>&);
00236
00237 void set_training_instance(int, const Vector<double>&);
00238 void set_validation_instance(int, const Vector<double>&);
00239 void set_testing_instance(int, const Vector<double>&);
00240
00241 void set_input_instance(int, const Vector<double>&);
00242 void set_target_instance(int, const Vector<double>&);
00243
00244 void set_training_input_instance(int, const Vector<double>&);
00245 void set_training_target_instance(int, const Vector<double>&);
00246
00247 void set_validation_input_instance(int, const Vector<double>&);
00248 void set_validation_target_instance(int, const Vector<double>&);
00249
00250 void set_testing_input_instance(int, const Vector<double>&);
00251 void set_testing_target_instance(int, const Vector<double>&);
00252
00253
00254
00255 void add_instance(const Vector<double>&);
00256 void subtract_instance(int);
00257
00258
00259
00260 void split_given_indices(const Vector<int>&, const Vector<int>&, const Vector<int>&);
00261 void split_random_indices(double, double, double);
00262 void split_random_indices(void);
00263
00264
00265
00266 void initialize_data(double);
00267
00268
00269
00270 Vector< Vector<double> > calculate_data_statistics(void);
00271
00272 Vector< Vector<double> > calculate_training_instances_statistics(void);
00273 Vector< Vector<double> > calculate_validation_instances_statistics(void);
00274 Vector< Vector<double> > calculate_testing_instances_statistics(void);
00275
00276 Vector< Vector<double> > calculate_instances_statistics(void);
00277
00278 Vector< Vector<double> > calculate_input_variables_statistics(void);
00279 Vector< Vector<double> > calculate_target_variables_statistics(void);
00280
00281 Vector< Vector<double> > calculate_variables_statistics(void);
00282
00283 Vector<double> calculate_training_target_data_mean(void);
00284 Vector<double> calculate_validation_target_data_mean(void);
00285
00286
00287
00288 void scale_data_mean_standard_deviation(const Vector<double>&, const Vector<double>&);
00289 void scale_data_minimum_maximum(const Vector<double>&, const Vector<double>&);
00290
00291
00292
00293 void scale_input_variables_mean_standard_deviation(const Vector<double>&, const Vector<double>&);
00294 Vector< Vector<double> > scale_input_variables_mean_standard_deviation(void);
00295
00296 void scale_input_variables_minimum_maximum(const Vector<double>&, const Vector<double>&);
00297 Vector< Vector<double> > scale_input_variables_minimum_maximum(void);
00298
00299
00300
00301 void scale_target_variables_mean_standard_deviation(const Vector<double>&, const Vector<double>&);
00302 Vector< Vector<double> > scale_target_variables_mean_standard_deviation(void);
00303
00304 void scale_target_variables_minimum_maximum(const Vector<double>&, const Vector<double>&);
00305 Vector< Vector<double> > scale_target_variables_minimum_maximum(void);
00306
00307
00308
00309 void scale_variables_mean_standard_deviation(const Vector< Vector<double> >);
00310 Vector< Vector<double> > scale_variables_mean_standard_deviation(void);
00311
00312 void scale_variables_minimum_maximum(const Vector< Vector<double> >);
00313 Vector< Vector<double> > scale_variables_minimum_maximum(void);
00314
00315
00316
00317 void unscale_data_mean_standard_deviation(const Vector<double>&, const Vector<double>&);
00318 void unscale_data_minimum_maximum(const Vector<double>&, const Vector<double>&);
00319
00320
00321
00322 void unscale_input_variables_mean_standard_deviation(const Vector<double>&, const Vector<double>&);
00323 void unscale_input_variables_minimum_maximum(const Vector<double>&, const Vector<double>&);
00324
00325
00326
00327 void unscale_target_variables_mean_standard_deviation(const Vector<double>&, const Vector<double>&);
00328 void unscale_target_variables_minimum_maximum(const Vector<double>&, const Vector<double>&);
00329
00330
00331
00332 void unscale_variables_mean_standard_deviation(const Vector< Vector<double> >&);
00333 void unscale_variables_minimum_maximum(const Vector< Vector<double> >&);
00334
00335
00336
00337 std::string to_XML(bool);
00338
00339 void print(void);
00340 void save(const char*);
00341 void load(const char*);
00342
00343 void print_data(void);
00344 void save_data(const char*);
00345 void load_data(const char*);
00346
00347 std::string get_instances_information_XML(bool);
00348 void print_instances_information(void);
00349 void save_instances_information(const char*);
00350
00351 std::string get_variables_information_XML(bool);
00352 void print_variables_information(void);
00353 void save_variables_information(const char*);
00354
00355 std::string get_data_statistics_XML(bool);
00356 void print_data_statistics(void);
00357 void save_data_statistics(const char*);
00358
00359 std::string get_training_instances_statistics_XML(bool);
00360 void print_training_instances_statistics(void);
00361 void save_training_instances_statistics(const char*);
00362
00363 std::string get_validation_instances_statistics_XML(bool);
00364 void print_validation_instances_statistics(void);
00365 void save_validation_instances_statistics(const char*);
00366
00367 std::string get_testing_instances_statistics_XML(bool);
00368 void print_testing_instances_statistics(void);
00369 void save_testing_instances_statistics(const char*);
00370
00371 std::string get_instances_statistics_XML(bool);
00372 void print_instances_statistics(void);
00373 void save_instances_statistics(const char*);
00374
00375 private:
00376
00377
00378
00380
00381 Matrix<double> data;
00382
00384
00385 Vector<int> training_instances_indices;
00386
00388
00389 Vector<int> validation_instances_indices;
00390
00392
00393 Vector<int> testing_instances_indices;
00394
00396
00397 Vector<int> input_variables_indices;
00398
00400
00401 Vector<int> target_variables_indices;
00402
00404
00405 Vector<std::string> variables_name;
00406
00408
00409 Vector<std::string> variables_units;
00410
00412
00413 Vector<std::string> variables_description;
00414
00416
00417 bool display;
00418 };
00419
00420 }
00421
00422 #endif
00423
00424
00425
00426
00427
00428
00429
00430
00431
00432
00433
00434
00435
00436
00437
00438
00439