MLFlow 搜索按指标运行顺序

问题描述 投票:0回答:1

我正在尝试使用 MlFlow 客户端按特定指标 (test_rmse) 来排序我的运行。但是,order_by 参数无法识别该指标,并返回空白结果。我认为这与 search_runs 函数的嵌套结果有关......

工作示例:

runs = mlflow_client.search_runs(experiment_ids = experiment_ids, order_by=["info.end_time"])

不工作示例:

runs = mlflow_client.search_runs(experiment_ids = experiment_ids, order_by=["metrics.test_rmse"])

not工作示例遵循下面链接到 T 的文档。 https://mlflow.org/docs/latest/python_api/mlflow.client.html

我尝试了许多不同的语法来获取 test_rmse 指标,包括: “data.metrics.test_rmse”,“metrics.'test_rmse'”,“data.metrics.'test_rmse'”,“metrics['test_rmse'],data.metrics.['test_rmse']”,“metrics[test_rmse] , data.metrics.[test_rmse]"

但没有一个有效。

以下是如果没有 order_by 则返回“Run”元素的示例:

<Run: data=<RunData: metrics={'test_mape': 20.545290384026003,
 'test_rmse': 7722.505535457056,
 'training_mae': 1317.665098010665,
 'training_mse': 2600325.7268625204,
 'training_r2_score': 0.9597774286238024,
 'training_rmse': 1612.5525501088391,
 'training_score': 0.9597774286238023}, params={'alpha': '0.9',
 'criterion': 'friedman_mse',
 'init': 'None',
 'learning_rate': '0.1',
 'loss': 'ls',
 'max_depth': '3',
 'max_features': 'None',
 'max_leaf_nodes': 'None',
 'min_impurity_decrease': '0.0',
 'min_impurity_split': 'None',
 'min_samples_leaf': '1',
 'min_samples_split': '2',
 'min_weight_fraction_leaf': '0.0',
 'n_estimators': '100',
 'n_iter_no_change': 'None',
 'presort': 'auto',
 'random_state': '12',
 'subsample': '1.0',
 'tol': '0.0001',
 'validation_fraction': '0.1',
 'verbose': '0',
 'warm_start': 'False'}, tags={'brand': 'dominicks',
 'estimator_class': 'sklearn.ensemble.gradient_boosting.GradientBoostingRegressor',
 'estimator_name': 'GradientBoostingRegressor',
 'mlflow.parentRunId': '2bccc81e-a97c-4704-bb06-e889701172e2',
 'mlflow.rootRunId': 'red_planet_0b4kbtckls',
 'mlflow.runName': 'plum_neck_0svr7057',
 'mlflow.user': 'Zack Soenen',
 'store': '1000'}>, info=<RunInfo: artifact_uri='', end_time=1704397763872, experiment_id='e6a75da7-2df2-4211-8f15-b4e8d9ee8e23', lifecycle_stage='active', run_id='65dcfeea-aa57-4c83-80a4-6b1ee9ac8c9c', run_name='plum_neck_0svr7057', run_uuid='65dcfeea-aa57-4c83-80a4-6b1ee9ac8c9c', start_time=1704397755468, status='FINISHED'>```
mlflow
1个回答
0
投票

您作为

"Not working example"
提供的代码在语法方面实际上是正确的。该问题可能与运行期间如何记录指标有关。

以下是一些需要检查的事项:

  1. 指标记录:确保您在 MLflow 运行期间正确记录“test_rmse”指标。确保使用正确的密钥记录指标。

示例:

mlflow.log_metric("test_rmse", your_test_rmse_value)
  1. 指标可用性:确认“test_rmse”指标可用于您尝试订购的所有运行。如果运行未记录此指标,则它可能不会包含在排序中。

  2. MLflow 版本:确保您使用的 MLflow 版本支持按指标排序。某些功能可能已在不同的 MLflow 版本中引入或更改。

© www.soinside.com 2019 - 2024. All rights reserved.