【发布时间】:2021-04-19 18:54:56
【问题描述】:
我正在尝试预测一堆商店的每周销售额。我想使用XGBoost,但我一直遇到这个错误:
IndexError: tuple index out of range
我的代码:
from sklearn.model_selection import train_test_split
features = ["Store",'Dept','Temperature','Fuel_Price','CPI','Unemployment']
y = allmergecopy.Weekly_Sales
X = allmergecopy[features]
X_train, y_train, X_valid, y_valid = train_test_split(y,X,test_size=.2, train_size=.8)
from xgboost import XGBRegressor
my_model = XGBRegressor(n_estimators=100)
my_model.fit(X_train, y_train)
供参考:
y_train.shape = (84314,), X_train.shape = (337256,).
【问题讨论】:
标签: python xgboost index-error