From 091509ea78463a95ddb1fa47cfdd028bdb4a3e3f Mon Sep 17 00:00:00 2001 From: harupy Date: Fri, 26 Nov 2021 14:15:27 +0900 Subject: [PATCH 1/4] rename _get_args_for_metrics Signed-off-by: harupy --- mlflow/sklearn/__init__.py | 4 ++-- mlflow/sklearn/utils.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/mlflow/sklearn/__init__.py b/mlflow/sklearn/__init__.py index 9a56915668347..f6484c6263a63 100644 --- a/mlflow/sklearn/__init__.py +++ b/mlflow/sklearn/__init__.py @@ -1162,7 +1162,7 @@ def fetch_logged_data(run_id): _MIN_SKLEARN_VERSION, _TRAINING_PREFIX, _is_supported_version, - _get_args_for_metrics, + _get_X_y_and_sample_weight, _log_estimator_content, _all_estimators, _get_estimator_info_tags, @@ -1262,7 +1262,7 @@ def infer_model_signature(input_example): return infer_signature(input_example, estimator.predict(input_example)) - (X, y_true, sample_weight) = _get_args_for_metrics(estimator.fit, args, kwargs) + (X, y_true, sample_weight) = _get_X_y_and_sample_weight(estimator.fit, args, kwargs) # log common metrics and artifacts for estimators (classifier, regressor) logged_metrics = _log_estimator_content( diff --git a/mlflow/sklearn/utils.py b/mlflow/sklearn/utils.py index 930c1a9210c8d..cbad448e098fe 100644 --- a/mlflow/sklearn/utils.py +++ b/mlflow/sklearn/utils.py @@ -45,9 +45,9 @@ def _get_estimator_info_tags(estimator): } -def _get_args_for_metrics(fit_func, fit_args, fit_kwargs): +def _get_X_y_and_sample_weight(fit_func, fit_args, fit_kwargs): """ - Get arguments to pass to metric computations in the following steps. + Get a tuple of (X, y, sample_weight) to pass to metric computations in the following steps. 1. Extract X and y from fit_args and fit_kwargs. 2. If the sample_weight argument exists in fit_func, From 7d854b0b4011ff83ccce0e6a32a8d2d9ebd86c30 Mon Sep 17 00:00:00 2001 From: harupy Date: Fri, 26 Nov 2021 14:18:21 +0900 Subject: [PATCH 2/4] fix docstring Signed-off-by: harupy --- mlflow/sklearn/utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mlflow/sklearn/utils.py b/mlflow/sklearn/utils.py index cbad448e098fe..9926b70adc758 100644 --- a/mlflow/sklearn/utils.py +++ b/mlflow/sklearn/utils.py @@ -47,7 +47,7 @@ def _get_estimator_info_tags(estimator): def _get_X_y_and_sample_weight(fit_func, fit_args, fit_kwargs): """ - Get a tuple of (X, y, sample_weight) to pass to metric computations in the following steps. + Get a tuple of (X, y, sample_weight) using the given arguments in the following steps. 1. Extract X and y from fit_args and fit_kwargs. 2. If the sample_weight argument exists in fit_func, From ef2012eddd806ad04f7cbd978ca4bea24598457f Mon Sep 17 00:00:00 2001 From: harupy Date: Fri, 26 Nov 2021 14:21:51 +0900 Subject: [PATCH 3/4] fix docstring Signed-off-by: harupy --- mlflow/sklearn/utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mlflow/sklearn/utils.py b/mlflow/sklearn/utils.py index 9926b70adc758..d4511142d6fda 100644 --- a/mlflow/sklearn/utils.py +++ b/mlflow/sklearn/utils.py @@ -47,7 +47,7 @@ def _get_estimator_info_tags(estimator): def _get_X_y_and_sample_weight(fit_func, fit_args, fit_kwargs): """ - Get a tuple of (X, y, sample_weight) using the given arguments in the following steps. + Extract (X, y, sample_weight) from `fit_args` and `fit_kwargs`. 1. Extract X and y from fit_args and fit_kwargs. 2. If the sample_weight argument exists in fit_func, From f6e596246da274965e6acf6ac4d51049f96727ce Mon Sep 17 00:00:00 2001 From: harupy Date: Fri, 26 Nov 2021 17:01:02 +0900 Subject: [PATCH 4/4] fix docstring again Signed-off-by: harupy --- mlflow/sklearn/utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mlflow/sklearn/utils.py b/mlflow/sklearn/utils.py index d4511142d6fda..361a2bf97ff8e 100644 --- a/mlflow/sklearn/utils.py +++ b/mlflow/sklearn/utils.py @@ -47,7 +47,7 @@ def _get_estimator_info_tags(estimator): def _get_X_y_and_sample_weight(fit_func, fit_args, fit_kwargs): """ - Extract (X, y, sample_weight) from `fit_args` and `fit_kwargs`. + Get a tuple of (X, y, sample_weight) in the following steps. 1. Extract X and y from fit_args and fit_kwargs. 2. If the sample_weight argument exists in fit_func,