我有一个数据集,我分裂成80%-20%的训练和测试集。在训练集上,我做k折交叉验证,得到准确性的平均值。但是,我不清楚该如何将这个结果应用于我的原始测试集?
#Splitting Training & Test dataset
from sklearn.model_selection import train_test_split
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2, random_state=1)
#Standartisation scaling
from sklearn.p
如何使用LinearRegression()函数构建机器学习模型来预测客户的预期SpendValue 还可以使用10折交叉验证来测量模型的性能,测试集大小为20%。 ? X = sales.drop(['SpendValue'], axis=1).values
y = sales.SpendValue.values
print("The training dataset has {} examples and {} features.".format(X.shape[0], X.shape[1]))
lr = LinearRegression()
kf
我是数据科学的新手,一直在为Kaggle的问题而奋斗。用随机森林回归预测评分时,发现列车测试分割得分较高,而CV得分较低。
0.8746277302652172with 与列车测试split_randomforest无列车测试split_randomforest split_randomforest CV随机森林10.713885026374156 %
import time
import datetime
import pandas as pd
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
i