51 static int ols_test_main(
int argc,
char **argv);
55 int main(
int argc,
char **argv)
58 ols_test_main(argc,argv);
64 static int ols_test_main(
int argc,
char **argv)
76 "ols_test <options>\n"+
77 "program to test OLS on data\n"+
78 "-desc <ifile> Field description file\n"+
79 "-data <ifile> Datafile, one vector per line\n"+
80 "-coeffs <ifile> File containing OLS coefficients\n"+
81 "-predict Predict for each vector returning value\n"+
82 "-o <ofile> File to save output in\n",
93 cerr << argv[0] <<
": no description file specified" << endl;
99 cerr << argv[0] <<
": no coefficients file specified" << endl;
107 cerr << argv[0] <<
": no data file specified" << endl;
112 outfile = al.
val(
"-o");
119 load_ols_data(X,Y,dataset);
122 printf(
";; RMSE %f Correlation is %f\n",rmse,cor);
124 printf(
";; varation too small RMSE %f but no correlation\n",rmse);
139 for (n=0,p=d.
head(); p != 0; p=p->
next(),n++)
141 Y(n,0) = d(p)->get_flt_val(0);
143 for (m=1; m < d.
width(); m++)
144 X(n,m) = d(p)->get_flt_val(m);
int ols_test(const EST_FMatrix &real, const EST_FMatrix &predicted, float &correlation, float &rmse)
int main(int argc, char **argv)
EST_write_status save(const EST_String &filename, const EST_String &type=EST_FMatrix::default_file_type)
Save in file (ascii or binary)
int ols_apply(const EST_FMatrix &samples, const EST_FMatrix &coeffs, EST_FMatrix &res)
EST_read_status load(const EST_String &filename)
Load from file (ascii or binary as defined in file)
const V & val(const K &rkey, bool m=0) const
return value according to key (const)
int present(const K &rkey) const
Returns true if key is present.
void wgn_load_dataset(WDataSet &ds, EST_String fname)
int siod_init(int heap_size=DEFAULT_HEAP_SIZE)
void resize(int rows, int cols, int set=1)
resize matrix
int parse_command_line(int argc, char *argv[], const EST_String &usage, EST_StrList &files, EST_Option &al, int make_stdio=1)
void load_description(const EST_String &descfname, LISP ignores)