# -*- coding=utf8 -*-
from sklearn import preprocessing
from sklearn import datasets
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

a = np.array(
    [[10, 2.7, 3.6],
     [-100, 5, -2],
     [120, 20, 40]], dtype=np.float64
)
print(a)
print(preprocessing.scale(a))
# 300数据, 2个属性，2个比较相关的，
X, y = datasets.make_classification(n_samples=300, n_features=2, n_redundant=0, n_informative=2,
                           random_state=22, n_clusters_per_class=1, scale=150)
# plt.scatter(X[:, 0], X[:, 1], c=y)
# plt.show()

#x_ed=preprocessing.scale(x) #默认是0-1
# X=preprocessing.scale(X)
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.3)
clf = SVC()
clf.fit(X_train, y_train)
print(clf.score(X_test, y_test))
# plt.scatter(X[:,0],X[:,1],c=y)
# plt.show()