当前位置: 首页>>代码示例>>Python>>正文


Python mlflow.log_params方法代码示例

本文整理汇总了Python中mlflow.log_params方法的典型用法代码示例。如果您正苦于以下问题:Python mlflow.log_params方法的具体用法?Python mlflow.log_params怎么用?Python mlflow.log_params使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在mlflow的用法示例。


在下文中一共展示了mlflow.log_params方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: log_params

# 需要导入模块: import mlflow [as 别名]
# 或者: from mlflow import log_params [as 别名]
def log_params(params: Dict[str, Any]):
    mlflow.log_params(params) 
开发者ID:criteo,项目名称:tf-yarn,代码行数:4,代码来源:mlflow.py

示例2: log_params

# 需要导入模块: import mlflow [as 别名]
# 或者: from mlflow import log_params [as 别名]
def log_params(cls, params):
        raise NotImplementedError() 
开发者ID:deepset-ai,项目名称:FARM,代码行数:4,代码来源:utils.py

示例3: mlflow_log_pararms

# 需要导入模块: import mlflow [as 别名]
# 或者: from mlflow import log_params [as 别名]
def mlflow_log_pararms(self, key=None):
        mlflow.log_params(self.flatten(key))
        return self 
开发者ID:wbaek,项目名称:theconf,代码行数:5,代码来源:config.py

示例4: log_fn_args_as_params

# 需要导入模块: import mlflow [as 别名]
# 或者: from mlflow import log_params [as 别名]
def log_fn_args_as_params(fn, args, kwargs, unlogged=[]):  # pylint: disable=W0102
    """
    Log parameters explicitly passed to a function.
    :param fn: function whose parameters are to be logged
    :param args: arguments explicitly passed into fn
    :param kwargs: kwargs explicitly passed into fn
    :param unlogged: parameters not to be logged
    :return: None
    """
    # all_default_values has length n, corresponding to values of the
    # last n elements in all_param_names
    pos_params, _, _, pos_defaults, kw_params, kw_defaults, _ = inspect.getfullargspec(fn)

    kw_params = list(kw_params) if kw_params else []
    pos_defaults = list(pos_defaults) if pos_defaults else []
    all_param_names = pos_params + kw_params
    all_default_values = pos_defaults + [kw_defaults[param] for param in kw_params]

    # Checking if default values are present for logging. Known bug that getargspec will return an
    # empty argspec for certain functions, despite the functions having an argspec.
    if all_default_values is not None and len(all_default_values) > 0:
        # Logging the default arguments not passed by the user
        defaults = get_unspecified_default_args(args, kwargs, all_param_names, all_default_values)

        for name in [name for name in defaults.keys() if name in unlogged]:
            del defaults[name]
        try_mlflow_log(mlflow.log_params, defaults)

    # Logging the arguments passed by the user
    args_dict = dict((param_name, param_val) for param_name, param_val
                     in zip(all_param_names, args)
                     if param_name not in unlogged)

    if args_dict:
        try_mlflow_log(mlflow.log_params, args_dict)

    # Logging the kwargs passed by the user
    for param_name in kwargs:
        if param_name not in unlogged:
            try_mlflow_log(mlflow.log_param, param_name, kwargs[param_name]) 
开发者ID:mlflow,项目名称:mlflow,代码行数:42,代码来源:autologging_utils.py

示例5: test_log_params

# 需要导入模块: import mlflow [as 别名]
# 或者: from mlflow import log_params [as 别名]
def test_log_params():
    expected_params = {"name_1": "c", "name_2": "b", "nested/nested/name": 5}
    with start_run() as active_run:
        run_id = active_run.info.run_id
        mlflow.log_params(expected_params)
    finished_run = tracking.MlflowClient().get_run(run_id)
    # Validate params
    assert finished_run.data.params == {"name_1": "c", "name_2": "b", "nested/nested/name": "5"} 
开发者ID:mlflow,项目名称:mlflow,代码行数:10,代码来源:test_tracking.py

示例6: mlflow_callback

# 需要导入模块: import mlflow [as 别名]
# 或者: from mlflow import log_params [as 别名]
def mlflow_callback(study, trial):
    trial_value = trial.value if trial.value is not None else float("nan")
    with mlflow.start_run(run_name=study.study_name):
        mlflow.log_params(trial.params)
        mlflow.log_metrics({"mean_squared_error": trial_value}) 
开发者ID:optuna,项目名称:optuna,代码行数:7,代码来源:keras_mlflow.py

示例7: __call__

# 需要导入模块: import mlflow [as 别名]
# 或者: from mlflow import log_params [as 别名]
def __call__(self, study: optuna.study.Study, trial: optuna.trial.FrozenTrial) -> None:

        # This sets the tracking_uri for MLflow.
        if self._tracking_uri is not None:
            mlflow.set_tracking_uri(self._tracking_uri)

        # This sets the experiment of MLflow.
        mlflow.set_experiment(study.study_name)

        with mlflow.start_run(run_name=str(trial.number)):

            # This sets the metric for MLflow.
            trial_value = trial.value if trial.value is not None else float("nan")
            mlflow.log_metric(self._metric_name, trial_value)

            # This sets the params for MLflow.
            mlflow.log_params(trial.params)

            # This sets the tags for MLflow.
            tags = {}  # type: Dict[str, str]
            tags["number"] = str(trial.number)
            tags["datetime_start"] = str(trial.datetime_start)
            tags["datetime_complete"] = str(trial.datetime_complete)

            # Set state and convert it to str and remove the common prefix.
            trial_state = trial.state
            if isinstance(trial_state, TrialState):
                tags["state"] = str(trial_state).split(".")[-1]

            # Set direction and convert it to str and remove the common prefix.
            study_direction = study.direction
            if isinstance(study_direction, StudyDirection):
                tags["direction"] = str(study_direction).split(".")[-1]

            tags.update(trial.user_attrs)
            distributions = {
                (k + "_distribution"): str(v) for (k, v) in trial.distributions.items()
            }
            tags.update(distributions)
            mlflow.set_tags(tags) 
开发者ID:optuna,项目名称:optuna,代码行数:42,代码来源:mlflow.py

示例8: _plx_log_params

# 需要导入模块: import mlflow [as 别名]
# 或者: from mlflow import log_params [as 别名]
def _plx_log_params(params_dict):
    from polyaxon_client.tracking import Experiment

    plx_exp = Experiment()
    plx_exp.log_params(
        **{"pytorch version": torch.__version__, "ignite version": ignite.__version__,}
    )
    plx_exp.log_params(**params_dict) 
开发者ID:pytorch,项目名称:ignite,代码行数:10,代码来源:exp_tracking.py

示例9: _mlflow_log_params

# 需要导入模块: import mlflow [as 别名]
# 或者: from mlflow import log_params [as 别名]
def _mlflow_log_params(params_dict):
    mlflow.log_params(
        {"pytorch version": torch.__version__, "ignite version": ignite.__version__,}
    )
    mlflow.log_params(params_dict) 
开发者ID:pytorch,项目名称:ignite,代码行数:7,代码来源:exp_tracking.py


注:本文中的mlflow.log_params方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。