random_forrest.cpp
Go to the documentation of this file.
1 #include <iostream>
7 
8 #include <shark/Core/Timer.h>
9 
10 using namespace shark;
11 using namespace std;
12 
13 int main(int argc, char **argv) {
15  importSparseData(data, "covtype");
16  data.shuffle();
17  ClassificationDataset test = splitAtElement(data,400000);
18 
20  RFTrainer<unsigned int> trainer(true,true);
21 
22  Timer time;
23  trainer.train(model, data);
24  double time_taken = time.stop();
25 
26  ZeroOneLoss<> loss;
27  cout << time_taken <<" "<< 1.0 - loss(data.labels(),model(data.inputs()))<< " "<< 1.0 - loss(test.labels(),model(test.inputs()))<<std::endl;
28 }