original_ifgt_main.cc
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00039 #include <fastlib/fastlib.h>
00040 #include "dataset_scaler.h"
00041 #include "original_ifgt.h"
00042 #include "naive_kde.h"
00043
00095 int main(int argc, char *argv[]) {
00096
00097
00098 fx_init(argc, argv, NULL);
00099
00101
00102
00103
00104
00105
00106 struct datanode *ifgt_kde_module =
00107 fx_submodule(fx_root, "kde");
00108
00109
00110 const char* references_file_name = fx_param_str_req(NULL, "data");
00111
00112
00113 const char* queries_file_name =
00114 fx_param_str(NULL, "query", references_file_name);
00115
00116
00117 Matrix references;
00118 Matrix queries;
00119
00120
00121 bool queries_equal_references =
00122 !strcmp(queries_file_name, references_file_name);
00123
00124
00125 data::Load(references_file_name, &references);
00126 if(queries_equal_references) {
00127 queries.Alias(references);
00128 }
00129 else {
00130 data::Load(queries_file_name, &queries);
00131 }
00132
00133
00134 if(!strcmp(fx_param_str(ifgt_kde_module, "scaling", "none"), "range")) {
00135 DatasetScaler::ScaleDataByMinMax(queries, references,
00136 queries_equal_references);
00137 }
00138
00139
00140
00141 OriginalIFGT ifgt_kde;
00142 Vector ifgt_kde_results;
00143 ifgt_kde.Init(queries, references, ifgt_kde_module);
00144 ifgt_kde.Compute();
00145 ifgt_kde.get_density_estimates(&ifgt_kde_results);
00146
00147
00148 if(fx_param_exists(ifgt_kde_module, "ifgt_kde_output")) {
00149 ifgt_kde.PrintDebug();
00150 }
00151
00152
00153
00154 if(fx_param_exists(ifgt_kde_module, "do_naive")) {
00155 NaiveKde<GaussianKernel> naive_kde;
00156 naive_kde.Init(queries, references, ifgt_kde_module);
00157 naive_kde.Compute();
00158
00159 if(fx_param_exists(ifgt_kde_module, "naive_kde_output")) {
00160 naive_kde.PrintDebug();
00161 }
00162 naive_kde.ComputeMaximumRelativeError(ifgt_kde_results);
00163 }
00164
00165 fx_done(NULL);
00166 return 0;
00167 }