rogercheng
發表於 2018-1-21 17:05:44
尝试下西片吧
gu80542
發表於 2018-1-21 18:29:35
偶尔换个口味
功夫茶
發表於 2018-1-21 20:56:35
import numpy as np
import matplotlib.pyplot as plt
import utilities
# Load input data
input_file = 'D:\\1.Modeling material\\Py_Study\\2.code_model\\Python-Machine-Learning-Cookbook\\Python-Machine-Learning-Cookbook-master\\Chapter03\\data_multivar.txt'
X, y = utilities.load_data(input_file)
###############################################
# Separate the data into classes based on 'y'
class_0 = np.array( for i in range(len(X)) if y==0])
class_1 = np.array( for i in range(len(X)) if y==1])
# Plot the input data
plt.figure()
plt.scatter(class_0[:,0], class_0[:,1], facecolors='black', edgecolors='black', marker='s')
plt.scatter(class_1[:,0], class_1[:,1], facecolors='None', edgecolors='black', marker='s')
plt.title('Input data')
###############################################
# Train test split and SVM training
from sklearn import cross_validation
from sklearn.svm import SVC
X_train, X_test, y_train, y_test = cross_validation.train_test_split(X, y, test_size=0.25, random_state=5)
#params = {'kernel': 'linear'}
#params = {'kernel': 'poly', 'degree': 3}
params = {'kernel': 'rbf'}
classifier = SVC(**params)
classifier.fit(X_train, y_train)
utilities.plot_classifier(classifier, X_train, y_train, 'Training dataset')
y_test_pred = classifier.predict(X_test)
utilities.plot_classifier(classifier, X_test, y_test, 'Test dataset')
###############################################
# Evaluate classifier performance
from sklearn.metrics import classification_report
target_names = ['Class-' + str(int(i)) for i in set(y)]
print "\n" + "#"*30
print "\nClassifier performance on training dataset\n"
print classification_report(y_train, classifier.predict(X_train), target_names=target_names)
print "#"*30 + "\n"
print "#"*30
print "\nClassification report on test dataset\n"
print classification_report(y_test, y_test_pred, target_names=target_names)
print "#"*30 + "\n"
jteo21
發表於 2018-1-24 07:26:19
{:7_268:}好片强烈支持
wxw0214
發表於 2018-1-24 12:40:31
你就我们摸我
正大符
發表於 2018-1-24 20:16:18
精华帖,力鼎,巨乳
hzfdy
發表於 2018-1-25 17:48:33
很具有野性
阑珊灯焱
發表於 2018-1-26 08:48:57
看上去还不错
wongyuro
發表於 2018-1-26 12:10:01
感觉还是不错
violetrain2
發表於 2018-1-26 21:47:26
看着图片很有感觉的