Closed Jeffwan closed 3 years ago
Hi @Jeffwan, there is this line:
train_x, train_y = None, None # Load data here
which you have to replace with the training data you want to be training on. Something like this will work:
from xgboost_ray import RayDMatrix, RayParams, train
from sklearn.datasets import load_breast_cancer
train_x, train_y = load_breast_cancer(return_X_y=True) # Load data here
train_set = RayDMatrix(train_x, train_y)
evals_result = {}
bst = train(
{
"objective": "binary:logistic",
"eval_metric": ["logloss", "error"],
},
train_set,
evals_result=evals_result,
evals=[(train_set, "train")],
verbose_eval=False,
ray_params=RayParams(
num_actors=2,
cpus_per_actor=1))
bst.save_model("model.xgb")
print("Final training error: {:.4f}".format(
evals_result["train"]["error"][-1]))
But yeah, we probably should update the readme to use an example with actual data. I'll file a PR for that
Ah, thanks. I didn't notice the adjustment requirement. If there's a full example, that will be great!
I tried example you attached in the PR. It's working well. Thanks for the improvement
XGBoost example doesn't work
code snippet is from README.md