test.py
Go to the documentation of this file.
00001 import svm
00002 
00003 
00004 labels = [0, 1]
00005 samples = [[0, 0], [0, 1]]
00006 
00007 labels = [0, 1, 1, 2]
00008 samples = [[0, 0], [0, 1], [1, 0], [1, 1]]
00009 
00010 import svm
00011 
00012 labels = [0, 0, 1, 1]
00013 samples = [[1, 1], [1, -1], [-1, 1], [-1, -1]]
00014 
00015 param = svm.svm_parameter('-c 1')
00016 problem = svm.svm_problem(labels, samples)
00017 
00018 model = svm.libsvm.svm_train(problem, param)
00019 pmodel = svm.toPyModel(model)
00020 pmodel.predict_values(samples[0])
00021 for i in range(len(samples)):
00022     print svm.libsvm.svm_predict(model, svm.gen_svm_nodearray(samples[i])[0])
00023 
00024 
00025 r = (c_double*6)()
00026 svm.libsvm.svm_predict_values(model, svm.gen_svm_nodearray(samples[0])[0], r)
00027 
00028 


libsvm3
Author(s): various
autogenerated on Wed Nov 27 2013 11:36:23