mirror of
https://github.com/wassname/ray.git
synced 2026-06-28 14:12:00 +08:00
[xgb] update docs (#12549)
This commit is contained in:
@@ -4,13 +4,15 @@ logger = logging.getLogger(__name__)
|
||||
|
||||
train = None
|
||||
predict = None
|
||||
RayParams = None
|
||||
RayDMatrix = None
|
||||
RayFileType = None
|
||||
|
||||
try:
|
||||
from xgboost_ray import train, predict, RayDMatrix, RayFileType
|
||||
from xgboost_ray import train, predict, RayParams, RayDMatrix, RayFileType
|
||||
except ImportError:
|
||||
logger.info(
|
||||
"xgboost_ray is not installed. Please run "
|
||||
"`pip install git+https://github.com/ray-project/xgboost_ray`.")
|
||||
|
||||
__all__ = ["train", "predict", "RayDMatrix", "RayFileType"]
|
||||
__all__ = ["train", "predict", "RayParams", "RayDMatrix", "RayFileType"]
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
from sklearn import datasets
|
||||
from sklearn.model_selection import train_test_split
|
||||
|
||||
from ray.util.xgboost import RayDMatrix, train
|
||||
from ray.util.xgboost import RayDMatrix, RayParams, train
|
||||
|
||||
|
||||
# __xgboost_begin__
|
||||
@@ -31,8 +31,7 @@ def main():
|
||||
train_set,
|
||||
evals=[(test_set, "eval")],
|
||||
evals_result=evals_result,
|
||||
max_actor_restarts=1,
|
||||
checkpoint_path="/tmp/checkpoint/",
|
||||
ray_params=RayParams(max_actor_restarts=1),
|
||||
verbose_eval=False)
|
||||
|
||||
bst.save_model("simple.xgb")
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
from sklearn import datasets
|
||||
from sklearn.model_selection import train_test_split
|
||||
|
||||
from ray.util.xgboost import RayDMatrix, train
|
||||
from ray.util.xgboost import RayDMatrix, RayParams, train
|
||||
|
||||
# __train_begin__
|
||||
num_cpus_per_actor = 1
|
||||
@@ -25,8 +25,8 @@ def train_model(config):
|
||||
evals=[(test_set, "eval")],
|
||||
evals_result=evals_result,
|
||||
verbose_eval=False,
|
||||
num_actors=num_actors,
|
||||
cpus_per_actor=num_cpus_per_actor)
|
||||
ray_params=RayParams(
|
||||
num_actors=num_actors, cpus_per_actor=num_cpus_per_actor))
|
||||
bst.save_model("model.xgb")
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user