import numpy as np
import matplotlib.pyplot as plt
np.random.seed(666)
X = np.random.normal(0,1,(200,2))
y = np.array((X[:,0]**2+X[:,1])<1.5,dtype='int')for _ inrange(20):
y[np.random.randint(200)]=1
2.分割数据
from sklearn.model_selection import train_test_split
X_train, X_test, y_train, y_test = train_test_split(X, y, random_state=666)