45 using namespace shark;
52 TestProblem(
size_t informative,
size_t nnz,
size_t dim)
53 : m_informative(informative)
59 void draw(RealVector& input, RealVector& label)
const 72 for (
size_t n=1; n<m_nnz; n++)
86 int main(
int argc,
char** argv)
91 TestProblem prob(10, 50, 1000);
92 cout <<
"generating 100000 points ..." << flush;
94 cout <<
" done." << endl;
107 cout <<
"LASSO training ..." << flush;
108 trainer.
train(model, data);
109 cout <<
" done." << endl;
112 RealMatrix m = model.
matrix();
116 for (
size_t j=0; j<m.size2(); j++)
121 if (j < 10) correct++;
125 cout <<
"solution statistics:" << endl;
126 cout <<
" number of non-zero coefficients: " << nnz << endl;
127 cout <<
" correctly identified coefficients: " << correct << endl;
128 cout <<
" wrongly identified coefficients: " << wrong << endl;