-
Notifications
You must be signed in to change notification settings - Fork 2
/
info.cpp
39 lines (31 loc) · 1.03 KB
/
info.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#include "libgrt_util.h"
#include "cmdline.h"
int main(int argc, char *argv[])
{
cmdline::parser c;
c.add<string>("type", 't', "force input type", false, "classification", cmdline::oneof<string>("classification", "regression", "timeseries", "auto"));
c.add<int> ("verbose", 'v', "verbosity level: 0-4", false, 0);
c.add ("help", 'h', "print this message");
c.footer ("[filename]...");
/* parse the classifier-common arguments */
if (!c.parse(argc,argv)) {
cerr << c.usage() << endl << c.error() << endl;
return -1;
}
if (c.exist("help")) {
cout << c.usage();
return 0;
}
/* handling of TERM and INT signal and set verbosity */
set_verbosity(c.get<int>("verbose"));
/* load the dataset and print its stats */
istream &in = grt_fileinput(c);
if (!in) return -1;
string type = c.get<string>("type");
CsvIOSample io(type);
CollectDataset dataset;
while (in >> io)
csvio_dispatch(io, dataset.add, io.labelset);
cout << dataset.getStatsAsString();
return 0;
}