就是我行对train文件训练后,直接训练test.xls。请问这个应该怎么办呢,越简单越好。
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
#from competition.ml import score
%matplotlib inline
%config InlineBackend.figure_format = 'retina'
%config IPCompleter.greedy = True
%config IPCompleter.use_jedi = True
pd.options.display.max_colwidth = 100
plt.rcParams['figure.figsize'] = (12, 8)
train_path = r'C:\Users\MyPC\Desktop\train.xls'
test_path = r'C:\Users\MyPC\Desktop\test.xls'
train = pd.read_excel(train_path)
test = pd.read_excel(test_path)
train.shape, test.shape
train.info()
test.info()
train.head()
test.head()
train.describe()
test.describe()
from sklearn.ensemble import ExtraTreesClassifier
model=ExtraTreesClassifier()
trainX=train[['X1','X2','X3','X4','X5','X6','X7','X8','X9','X10','X11','X12','X13','X14','X15','X16','X17','X18','X19','X20','X21','X22','X23']]
trainY=train['Y']
testX=train[['X1','X2','X3','X4','X5','X6','X7','X8','X9','X10','X11','X12','X13','X14','X15','X16','X17','X18','X19','X20','X21','X22','X23']]
testY=train['Y']
model.fit(trainX,trainY)
y_pred =model.predict(testX)#######预测
np.savetxt(r'C:\Users\MyPC\Desktop\predict.csv', y_pred)
#score(y_pred)
就是我行对train文件训练后,直接训练test.xls。请问这个应该怎么办呢,越简单越好。