c# - Trouble loading the training dataset in LibSVMSharp -


if familiar libsvm (https://www.csie.ntu.edu.tw/~cjlin/libsvm/), working libsvmsharp, same thing, in c# wrapper, believe.

on github, give following example of how write simple classification, using svm:

svmproblem problem = svmproblemhelper.load(@"dataset_path.txt"); svmproblem testproblem = svmproblemhelper.load(@"test_dataset_path.txt");  svmparameter parameter = new svmparameter(); parameter.type = svmtype.c_svc; parameter.kernel = svmkerneltype.rbf; parameter.c = 1; parameter.gamma = 1;  svmmodel model = svm.train(problem, parameter);  double target[] = new double[testproblem.length]; (int = 0; < testproblem.length; i++)   target[i] = svm.predict(model, testproblem.x[i]);  double accuracy = svmhelper.evaluateclassificationproblem(testproblem, target); 

that makes perfect sense, loading in training data path specified, , same test data...well, that's run problems.

i wanted test out in c# ensure full understanding of how works, before implementing in larger project i've been working on. have small program called program.cs (very original, know), , in same folder, have train.txt , test.txt. have folder contains program.cs, train.txt, , test.txt, along other standard stuff created when make project in visual studio.

so snippet of code looks this:

svmproblem trainingset = svmproblemhelper.load(@"train.txt"); svmproblem testset = svmproblemhelper.load(@"test.txt");  trainingset = trainingset.normalize(svmnormtype.l2); testset = testset.normalize(svmnormtype.l2); 

and on. however, when run this, says variable "trainingset" null, because svmproblemhelper never managed load train.txt.

i feel there glaringly obvious solution this, i'm lost. i'm not entirely sure what's going wrong, here. in svmproblemhelper.load function, says set variable (in case, trainingset) equal null if cannot find file in question. how not finding file? it's in same directory .cs file. i'm not sure i'm missing can't figure out.

any gladly welcomed!


Comments

Popular posts from this blog

jOOQ update returning clause with Oracle -

java - Warning equals/hashCode on @Data annotation lombok with inheritance -

java - BasicPathUsageException: Cannot join to attribute of basic type -