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

svm_problem * Impala::Core::Training::ConvertToSvmProblem ( const Core::Vector::VectorTem< double > *  feature  ) 

Definition at line 360 of file Svm.h.

References Impala::Core::Vector::VectorTem< ElemT >::GetData(), svm_node::index, svm_problem::l, Impala::Core::Vector::VectorTem< ElemT >::Size(), svm_node::value, svm_problem::x, and svm_problem::y.

Referenced by Impala::Core::Training::Svm::Predict().

00361 {
00362     svm_problem* svm = new svm_problem;
00363     svm->l = 1;
00364     svm->y = new double[svm->l];
00365     svm->x = new struct svm_node *[svm->l];
00366     struct svm_node* nodes = new struct svm_node[svm->l*(feature->Size() + 1)];
00367     for(int i=0 ; i<svm->l ; i++)
00368     {
00369         svm->y[i] = 0;
00370         svm->x[i] = nodes;
00371         const double* values = feature->GetData();
00372         int j;
00373         for(j=0 ; j<feature->Size() ; j++)
00374         {
00375             svm->x[i][j].index = j+1;
00376             svm->x[i][j].value = values[j];
00377         }
00378         svm->x[i][j].index = -1;
00379     }
00380     return svm;
00381 }

Here is the call graph for this function:


Generated on Fri Mar 19 11:23:02 2010 for ImpalaSrc by  doxygen 1.5.1