ridge_regression.cpp
Go to the documentation of this file.
1 #include <shark/Data/Csv.h>
4 #include <shark/Core/Timer.h>
5 #include <iostream>
6 using namespace shark;
7 using namespace std;
8 
9 int main(int argc, char **argv) {
10  RegressionDataset data;
11  importCSV(data, "blogData_train.csv", LAST_COLUMN,1,',','#', 2<<16);
12 
13  LinearRegression trainer(100);
14  LinearModel<> model;
15 
16  Timer time;
17  trainer.train(model, data);
18  double time_taken = time.stop();
19 
20  SquaredLoss<> loss;
21  cout << "Residual sum of squares:" << loss(data.labels(),model(data.inputs()))<<std::endl;
22  cout << "Time:\n" << time_taken << endl;
23  cout << time_taken << endl;
24 }