上传者: 38689477
|
上传时间: 2021-11-04 09:33:19
|
文件大小: 59KB
|
文件类型: -
1、sklearn库
import numpy as np
import pandas as pd
from sklearn.model_selection import train_test_split
from sklearn.neighbors import KNeighborsClassifier
df = pd.read_table('D:\datingTestSet2.txt',header = None)
data=df.iloc[:,0:3]
target=df.iloc[:,3]
x_train,x_test, y_train, y_test =train_test_spl