def compareWithSvm(self,datasetTrain,datasetTest):
C=[0.000001,0.00001,0.0001,0.001,0.01,0.1,1,10,100,1000]
print '\n'
print 'dataset shape is ',datasetTrain.shape
self.y_train=self.y_train.reshape(-1,)
for c in C:
self.Svm=svm.LinearSVC(C=c)
self.Svm.fit(datasetTrain,self.y_train)
labels=self.Svm.predict(datasetTest)
print 'accuracy with c=',c,' is ',self.checkAccuracy(labels,self.y_test),'% ','\n'
#for graph based reasoning , replace every 0 with -1
graphssl.py 文件源码
python
阅读 19
收藏 0
点赞 0
评论 0
评论列表
文章目录