from sklearn import preprocessing
import numpy as np
from sklearn.cross_validation import train_test_split
from sklearn.datasets.samples_generator import make_classification
from sklearn.svm import SVC
import matplotlib.pyplot as plt
X, y =make_classification(n_sample=300, n_feature=2, n_redundant=0,n_informative=2, random_state=22, n_cluster_per_class=1, scale=100) # random_state 随机22个数但是每次运行这22个数不变,n_sample 样本数,n_feature特征数, scale规模
# X = preprocessing.min_max_scale(X, feature_range=(-1,1)) # feature_range浓缩范围
X = preprocessing.scale(X)
X_train, X_test, y_train, y_test = train_test_split(X,y,test_size=.3)
clf = SVC()
clf.fit(X_train, y_train)
print(clf.score(X_test,y_test)) # 用预测值与原始值比较