I'm trying to figure out what is the proper format of a python list to be given as input to a svm_problem function in python. I got the following program from the web, stackoverflow.
I have the following:
from svm import *
x=[ [1,0,1],[-1,0,-1],[1,0,0]]
#x=[ [1,0,1],[-1,0,-1]]
prob = svm_problem( [1,-1],x )
param = svm_parameter(kernel_type = LINEAR, C = 10)
m = svm_model(prob, param)
print m.predict([ 1,1, 1])
It raises an assertion error, says assert failed: assert len(x)==len(y).
But if x=[ [1,0,1],[-1,0,-1]], the program works perfectly. Am I not supposed to give a train-data problem of length more than 2?
Also I don't understand what in x=[[1,0,1],[-1,0,-1]] is a label and what is the data?
Any help is highly appreciated.