graphssl.py 文件源码

python
阅读 19 收藏 0 点赞 0 评论 0

项目:graph-based-semi-supervised-learning 作者: deerishi 项目源码 文件源码
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
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号