就是我行对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。请问这个应该怎么办呢,越简单越好。
简单的机器学习更改,指定数据集预测
- 写回答
- 好问题 0 提建议
- 追加酬金
- 关注问题
- 邀请回答
-
1条回答 默认 最新
- 二心TOT 2019-11-08 09:28关注
首先,不建议这么做,如果把train和test都用来训练,没测试集来看效果。
如果真要这么做,可以在训练前先把两个文件合并再投入训练本回答被题主选为最佳回答 , 对您是否有帮助呢?解决 无用评论 打赏 举报
悬赏问题
- ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
- ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
- ¥20 有关区间dp的问题求解
- ¥15 多电路系统共用电源的串扰问题
- ¥15 slam rangenet++配置
- ¥15 有没有研究水声通信方面的帮我改俩matlab代码
- ¥15 ubuntu子系统密码忘记
- ¥15 信号傅里叶变换在matlab上遇到的小问题请求帮助
- ¥15 保护模式-系统加载-段寄存器
- ¥15 电脑桌面设定一个区域禁止鼠标操作