本文整理汇总了Python中sklearn.multiclass.OneVsOneClassifier.get_params方法的典型用法代码示例。如果您正苦于以下问题:Python OneVsOneClassifier.get_params方法的具体用法?Python OneVsOneClassifier.get_params怎么用?Python OneVsOneClassifier.get_params使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sklearn.multiclass.OneVsOneClassifier
的用法示例。
在下文中一共展示了OneVsOneClassifier.get_params方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: load_svmlight_file
# 需要导入模块: from sklearn.multiclass import OneVsOneClassifier [as 别名]
# 或者: from sklearn.multiclass.OneVsOneClassifier import get_params [as 别名]
startTime = time.ctime()
start = time.time()
X_train, y_train = load_svmlight_file(train_feature_path)
X_test, y_test = load_svmlight_file(test_feature_path)
#X = np.array([[1,1], [2,2], [-1,2], [-2,3], [-1,-1], [-2,-3], [2,-4], [3,-5]])
#y = np.array([0, 0, 1, 1, 2, 2, 3, 3])
print('start at %s' % startTime)
print('start training...')
clf = OneVsOneClassifier(LinearSVC(random_state = 0))
#clf = OneVsRestClassifier(LinearSVC(random_state = 0))
clf = clf.fit(X_train, y_train)
print(clf.get_params())
#joblib.dump(clf, modelPath) # save the trained model
#lists =[[5, -1], [-2, -6], [2,1], [-2, 5]]
#test = np.array(lists)
#test_label = np.array([3, 2, 0, 1])
print("start predicting...")
#clf = joblib.load(modelPath) # load the model
score = clf.score(X_test, y_test)
print('accuracy is {0}'.format(score))
#==============================================================================
# count = 0
# predictions = clf.predict(X_test)
# lens = len(predictions)
# for i in xrange(lens):