in

Ejemplo de XGBoost Python

0y1vE1Hdlri6XkDGL
geralt pixabay

Ejemplo de XGBoost Python

Cory Maklin

Cory Maklin

9 de mayo de 2020·8 min de lectura

1*CznsYocUz NzlTPFEGSgA

1*mynM3RNnGAc2Ur ReHyvXQ

1*kZBStLI44hfjzgleOpdjNw

1*XnpRXiSy9ayq6w daeS9RQ

1*RH1

1*TE2pPIVsFiCMUiu EAk Yg

1*XnpRXiSy9ayq6w daeS9RQ

1*2YIQAquP EtL 6i N6BlFg

1*lcIydfnM7S6mhACZE3PUCA

1*XnpRXiSy9ayq6w daeS9RQ

1*YY IglOMnMUFX J8uRQRQ

1*fEYAQC21BbUF d8iu51bEQ

1*XnpRXiSy9ayq6w daeS9RQ

1*IFGNacm Nr1UbDF5 COSgQ

1*wKLXLmhrGazFQVAmuc8zKg

1*XnpRXiSy9ayq6w daeS9RQ

1*r8vurgf8Si0hQRwMB mNpg

1*ZmbQEQjtv3WcSUXBJi9USw

1*1JZaqBqnbdFUxfK6bncc Q

1*XnpRXiSy9ayq6w daeS9RQ

1*Bw5yMS70ONZYPYCBgk9BrA

1*dC5G3rz1 BCtdaVNlRahYw

1*XnpRXiSy9ayq6w daeS9RQ

0*CNpI0vCAGseL51Cd

1*XnpRXiSy9ayq6w daeS9RQ

1* IIEF55klogdhmsJ5AG8Cg

1*XnpRXiSy9ayq6w daeS9RQ

1*SUn4Kq1SWXXvuEYePI7sQA

1*jbDCA yMZV09iqB3D4h2YA

1*fBTA5v15LCY1zXFjeyVN6w

1*T0c9h2p6KUKTvbR YmzZ A

1*W IpXlXFGoacE67IaRZpDQ

Código Python

conda install -c conda-forge xgboostconda install -c anaconda py-xgboost
import pandas as pd
import xgboost as xgb
from sklearn.datasets import load_boston
from sklearn.model_selection import train_test_split
from sklearn.metrics import mean_squared_error
boston = load_boston()
X = pd.DataFrame(boston.data, columns=boston.feature_names)
y = pd.Series(boston.target)
X.head()

X_train, X_test, y_train, y_test = train_test_split(X, y)
regressor = xgb.XGBRegressor(
n_estimators=100,
reg_lambda=1,
gamma=0,
max_depth=3
)
regressor.fit(X_train, y_train)
pd.DataFrame(regressor.feature_importances_.reshape(1, -1), columns=boston.feature_names)

y_pred = regressor.predict(X_test)
mean_squared_error(y_test, y_pred)
1*4amfO2Ojfuofyg2BeMvqIQ

Deja una respuesta

Tu dirección de correo electrónico no será publicada. Los campos obligatorios están marcados con *

00aW8xFplPRNprbE20Umj6A 3.1632255625.fit lim.size 1200x630

Microsoft agrega 5G, cámara mejorada al teléfono plegable Surface Duo 2

oracleLinux: Descargas | Red de tecnología de Oracle