mirror of
https://github.com/vale981/ray
synced 2025-03-08 19:41:38 -05:00

This PR adds a user guide to AIR for using Ray Train. It provides a high level overview of the trainers and removes redundant sections. The main file to review is here: doc/source/ray-air/trainer.rst. Signed-off-by: xwjiang2010 <xwjiang2010@gmail.com> Signed-off-by: Richard Liaw <rliaw@berkeley.edu> Signed-off-by: Kai Fricke <kai@anyscale.com> Co-authored-by: Richard Liaw <rliaw@berkeley.edu> Co-authored-by: Kai Fricke <kai@anyscale.com>
13 lines
418 B
Python
13 lines
418 B
Python
import ray
|
|
|
|
from ray.train.sklearn import SklearnTrainer
|
|
from sklearn.ensemble import RandomForestRegressor
|
|
|
|
train_dataset = ray.data.from_items([{"x": x, "y": x + 1} for x in range(32)])
|
|
trainer = SklearnTrainer(
|
|
estimator=RandomForestRegressor(),
|
|
label_column="y",
|
|
scaling_config=ray.air.config.ScalingConfig(trainer_resources={"CPU": 4}),
|
|
datasets={"train": train_dataset},
|
|
)
|
|
result = trainer.fit()
|