當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。