Home || Architecture || Video Search || Visual Search || Scripts || Applications || Important Messages || OGL || Src

svm_problem* Impala::Core::Training::TrainDataSrcKernelMatrix::MakeProblem ( int  start,
int  end 
) [inline, private]

Note:
this code is suspiciously similar to TrainDataSrcKernelTable::MakeProblem I guess some refeactoring is in order

The resulting svm_problem can only be used for prediction, not for training.

This code wants to be compatible to how libsvm handles kernel matrices so that's why we add an empty column in the matrix where libsvm normally has a column with indices for training.

Definition at line 85 of file TrainDataSrcKernelMatrix.h.

References Impala::Core::Array::Array2dTem< StorT, elemSize, ArithT >::CPB(), Impala::Core::Array::Array2dTem< StorT, elemSize, ArithT >::CW(), ILOG_VAR, svm_node::index, svm_problem::l, mMatrix, svm_node::value, svm_problem::x, and svm_problem::y.

Referenced by MakeSvmProblem().

00086     {
00087         ILOG_VAR(Core.Training.Svm.KernelSvmProblem);
00088         int vectorLength = mMatrix->CW();
00089         svm_problem* problem = new svm_problem;
00090         problem->l = end - start;
00091         problem->y = new double[problem->l];
00092         problem->x = new struct svm_node *[problem->l];
00093         struct svm_node* nodes = new struct svm_node[problem->l*(2+vectorLength)];
00094         for(int i=0 ; i<problem->l ; i++)
00095         {
00096             problem->y[i] = 0;
00097             problem->x[i] = &nodes[i*(vectorLength+2)];
00098             problem->x[i][0].index = 0;
00099             problem->x[i][0].value = 0; // empty column expected by libsvm
00100             const double* values = mMatrix->CPB(0, start+i);
00101             int j;
00102             for(j=0 ; j<vectorLength ; j++)
00103             {
00104                 problem->x[i][j+1].index = j+1;
00105                 problem->x[i][j+1].value = values[j];
00106             }
00107             problem->x[i][j+1].index = -1;
00108         }
00109         return problem;
00110     }

Here is the call graph for this function:


Generated on Fri Mar 19 11:25:05 2010 for ImpalaSrc by  doxygen 1.5.1