【发布时间】:2020-12-16 02:45:27
【问题描述】:
我目前在 mlflow 中创建了一个实验,并在该实验中创建了多次运行。
from sklearn.ensemble import RandomForestRegressor
from sklearn.metrics import mean_squared_error
import mlflow
experiment_name="experiment-1"
mlflow.set_experiment(experiment_name)
no_of_trees=[100,200,300]
depths=[2,3,4]
for trees in no_of_trees:
for depth in depths:
with mlflow.start_run() as run:
model=RandomForestRegressor(n_estimators=trees, criterion='mse',max_depth=depth)
model.fit(x_train, y_train)
predictions=model.predict(x_cv)
mlflow.log_metric('rmse',mean_squared_error(y_cv, predictions))
创建运行后,我想为此实验获得最佳 run_id。目前,我可以通过查看 mlflow 的 UI 来获得最佳运行,但我们如何才能正确地执行程序呢?
【问题讨论】: