In XGBoost Regression to predict prices, How to get coefficients, intercepts of model? How to get summary of model like we get in Statsmodel for Linear regression? See below code
from xgboost import XGBRegressor
# fit model no training data
model = XGBRegressor()
model.fit(X_train, y_train)
# make predictions for test data
y_pred = model.predict(X_test)
print("R^2: {}".format(model.score(X_test, y_test)))
rmse = np.sqrt(mean_squared_error(y_test, y_pred))
print("Root Mean Squared Error: {}".format(rmse))
This is how I build the model and tried to get coefficients like this:
#print the intercept
print(model.intercept_)
AttributeError: Intercept (bias) is not defined for Booster type gbtree
print(model.coef_)
AttributeError: Coefficients are not defined for Booster type gbtree
Can someone please help me to solve this. Thanks.