dmlc / xgboost

Scalable, Portable and Distributed Gradient Boosting (GBDT, GBRT or GBM) Library, for Python, R, Java, Scala, C++ and more. Runs on single machine, Hadoop, Spark, Dask, Flink and DataFlow
https://xgboost.readthedocs.io/en/stable/
Apache License 2.0
26.07k stars 8.7k forks source link

xgboost model fit error in python #10594

Closed oldwan2 closed 3 weeks ago

oldwan2 commented 1 month ago

When I use the following code in python: import xgboost as xgb import pandas as pd import numpy as np import matplotlib. pyplot as plt plt.style.use('seaborn-v0_8') import shap from sklearn. model_selection import train_test_split

my_random_state = 50

data = pd. read_csv('G:/Input for model.csv')

cols = [ 'Aspect', 'Aspect_cv', 'Slope_cv', 'Elevation_cv', 'Forest height', 'Root depth', 'Tree density', 'Drought intensity', 'Available water capacity', 'Soil clay', 'Soil sand', 'Precipitation', 'Native plant species richness' ]

x_all = data[cols].values y_all = data['y'].values x_train, x_test, y_train, y_test = train_test_split(x_all, y_all,test_size=0.3, random_state=my_random_state)

model = xgb. XGBRegressor(max_depth=4, learning_rate=0.05, n_estimators=150)

model. fit(x_train, y_train) Error occurs Snipaste I have reinstalled the xgboost package and python several times, but it still doesn't work, what can I do?

trivialfis commented 1 month ago

Hi, could you please share how you install XGBoost?

oldwan2 commented 1 month ago

Hi, could you please share how you install XGBoost?

Snipaste2 thks for u reply,I use the windows powershell to install it.

trivialfis commented 1 month ago

@hcho3 Have you seen this on Windows before?

trivialfis commented 3 weeks ago

Closing due to unable to reproduce.