I'm trying to use XGBoost Regressor to predict revenue, given some input features. However, I get a feature_names mismatch error when I run it. The features are all numerical features and there are no missing values.
cols_to_use = ['Product Visitors', 'Product Pageviews', 'Rating']
X = df[cols_to_use]
y = df['Revenue']
X_train, X_test, y_train, y_test = train_test_split(X, y, random_state=0)
xgboostmodel = XGBRegressor(n_estimators=1000, max_depth=7)
xgboostmodel.fit(X_train, y_train)
y_pred = xgboostmodel.predict(X_test)
xgboostmodel.score(y_test, y_pred)
Error:
ValueError: feature_names mismatch: ['Product Visitors', 'Product Pageviews', 'Rating']['f0', 'f1', 'f2']
expected Product Pageviews, Product Visitors, Ratings in input data
training data did not have the following fields f34, f5, f11, f7