Advertisement
Guest User

Untitled

a guest
Sep 6th, 2016
29
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.87 KB | None | 0 0
  1. init_shogun_with_defaults();
  2.  
  3. SGMatrix<float> shogun_testdata=CV2SGFactory::get_sgmatrix<float>(features);
  4. SGMatrix<float>::transpose_matrix(shogun_testdata.matrix, shogun_testdata.num_rows, shogun_testdata.num_cols);
  5. CDenseFeatures<float>* testfeatures=new CDenseFeatures<float>(shogun_testdata);
  6.  
  7. SGVector<float64_t> shogun_vector_response(6);
  8.  
  9. for(int i=0;i<6;i++){
  10. shogun_vector_response[i]=i;
  11. }
  12.  
  13. CLinearKernel* kernel = new CLinearKernel();
  14. kernel->init(testfeatures,testfeatures);
  15.  
  16. CMulticlassLibSVM* shogunsvm=new CMulticlassLibSVM(10, kernel,new CMulticlassLabels(shogun_vector_response));
  17.  
  18. FILE* f=fopen(model.c_str(),"r");
  19. if (f!=NULL)
  20. {
  21. shogunsvm->load(f);
  22.  
  23. cout << "start predict" << endl;
  24.  
  25. CMulticlassLabels* labels=shogunsvm->apply_multiclass();
  26.  
  27. fclose(f);
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement