mlrun 1.6.4rc2__py3-none-any.whl → 1.7.0rc20__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of mlrun might be problematic. Click here for more details.
- mlrun/__init__.py +11 -1
- mlrun/__main__.py +26 -112
- mlrun/alerts/__init__.py +15 -0
- mlrun/alerts/alert.py +144 -0
- mlrun/api/schemas/__init__.py +5 -4
- mlrun/artifacts/__init__.py +8 -3
- mlrun/artifacts/base.py +46 -257
- mlrun/artifacts/dataset.py +11 -192
- mlrun/artifacts/manager.py +47 -48
- mlrun/artifacts/model.py +31 -159
- mlrun/artifacts/plots.py +23 -380
- mlrun/common/constants.py +69 -0
- mlrun/common/db/sql_session.py +2 -3
- mlrun/common/formatters/__init__.py +19 -0
- mlrun/common/formatters/artifact.py +21 -0
- mlrun/common/formatters/base.py +78 -0
- mlrun/common/formatters/function.py +41 -0
- mlrun/common/formatters/pipeline.py +53 -0
- mlrun/common/formatters/project.py +51 -0
- mlrun/common/helpers.py +1 -2
- mlrun/common/model_monitoring/helpers.py +9 -5
- mlrun/{runtimes → common/runtimes}/constants.py +37 -9
- mlrun/common/schemas/__init__.py +24 -4
- mlrun/common/schemas/alert.py +203 -0
- mlrun/common/schemas/api_gateway.py +148 -0
- mlrun/common/schemas/artifact.py +18 -8
- mlrun/common/schemas/auth.py +11 -5
- mlrun/common/schemas/background_task.py +1 -1
- mlrun/common/schemas/client_spec.py +4 -1
- mlrun/common/schemas/feature_store.py +16 -16
- mlrun/common/schemas/frontend_spec.py +8 -7
- mlrun/common/schemas/function.py +5 -1
- mlrun/common/schemas/hub.py +11 -18
- mlrun/common/schemas/memory_reports.py +2 -2
- mlrun/common/schemas/model_monitoring/__init__.py +18 -3
- mlrun/common/schemas/model_monitoring/constants.py +83 -26
- mlrun/common/schemas/model_monitoring/grafana.py +13 -9
- mlrun/common/schemas/model_monitoring/model_endpoints.py +99 -16
- mlrun/common/schemas/notification.py +4 -4
- mlrun/common/schemas/object.py +2 -2
- mlrun/{runtimes/mpijob/v1alpha1.py → common/schemas/pagination.py} +10 -13
- mlrun/common/schemas/pipeline.py +1 -10
- mlrun/common/schemas/project.py +24 -23
- mlrun/common/schemas/runtime_resource.py +8 -12
- mlrun/common/schemas/schedule.py +3 -3
- mlrun/common/schemas/tag.py +1 -2
- mlrun/common/schemas/workflow.py +2 -2
- mlrun/common/types.py +7 -1
- mlrun/config.py +54 -17
- mlrun/data_types/to_pandas.py +10 -12
- mlrun/datastore/__init__.py +5 -8
- mlrun/datastore/alibaba_oss.py +130 -0
- mlrun/datastore/azure_blob.py +17 -5
- mlrun/datastore/base.py +62 -39
- mlrun/datastore/datastore.py +28 -9
- mlrun/datastore/datastore_profile.py +146 -20
- mlrun/datastore/filestore.py +0 -1
- mlrun/datastore/google_cloud_storage.py +6 -2
- mlrun/datastore/hdfs.py +56 -0
- mlrun/datastore/inmem.py +2 -2
- mlrun/datastore/redis.py +6 -2
- mlrun/datastore/s3.py +9 -0
- mlrun/datastore/snowflake_utils.py +43 -0
- mlrun/datastore/sources.py +201 -96
- mlrun/datastore/spark_utils.py +1 -2
- mlrun/datastore/store_resources.py +7 -7
- mlrun/datastore/targets.py +358 -104
- mlrun/datastore/utils.py +72 -58
- mlrun/datastore/v3io.py +5 -1
- mlrun/db/base.py +185 -35
- mlrun/db/factory.py +1 -1
- mlrun/db/httpdb.py +614 -179
- mlrun/db/nopdb.py +210 -26
- mlrun/errors.py +12 -1
- mlrun/execution.py +41 -24
- mlrun/feature_store/__init__.py +0 -2
- mlrun/feature_store/api.py +40 -72
- mlrun/feature_store/common.py +1 -1
- mlrun/feature_store/feature_set.py +76 -55
- mlrun/feature_store/feature_vector.py +28 -30
- mlrun/feature_store/ingestion.py +7 -6
- mlrun/feature_store/retrieval/base.py +16 -11
- mlrun/feature_store/retrieval/conversion.py +11 -13
- mlrun/feature_store/retrieval/dask_merger.py +2 -0
- mlrun/feature_store/retrieval/job.py +9 -3
- mlrun/feature_store/retrieval/local_merger.py +2 -0
- mlrun/feature_store/retrieval/spark_merger.py +34 -24
- mlrun/feature_store/steps.py +37 -34
- mlrun/features.py +9 -20
- mlrun/frameworks/_common/artifacts_library.py +9 -9
- mlrun/frameworks/_common/mlrun_interface.py +5 -5
- mlrun/frameworks/_common/model_handler.py +48 -48
- mlrun/frameworks/_common/plan.py +2 -3
- mlrun/frameworks/_common/producer.py +3 -4
- mlrun/frameworks/_common/utils.py +5 -5
- mlrun/frameworks/_dl_common/loggers/logger.py +6 -7
- mlrun/frameworks/_dl_common/loggers/mlrun_logger.py +9 -9
- mlrun/frameworks/_dl_common/loggers/tensorboard_logger.py +23 -47
- mlrun/frameworks/_ml_common/artifacts_library.py +1 -2
- mlrun/frameworks/_ml_common/loggers/logger.py +3 -4
- mlrun/frameworks/_ml_common/loggers/mlrun_logger.py +4 -5
- mlrun/frameworks/_ml_common/model_handler.py +24 -24
- mlrun/frameworks/_ml_common/pkl_model_server.py +2 -2
- mlrun/frameworks/_ml_common/plan.py +1 -1
- mlrun/frameworks/_ml_common/plans/calibration_curve_plan.py +2 -3
- mlrun/frameworks/_ml_common/plans/confusion_matrix_plan.py +2 -3
- mlrun/frameworks/_ml_common/plans/dataset_plan.py +3 -3
- mlrun/frameworks/_ml_common/plans/feature_importance_plan.py +3 -3
- mlrun/frameworks/_ml_common/plans/roc_curve_plan.py +4 -4
- mlrun/frameworks/_ml_common/utils.py +4 -4
- mlrun/frameworks/auto_mlrun/auto_mlrun.py +9 -9
- mlrun/frameworks/huggingface/model_server.py +4 -4
- mlrun/frameworks/lgbm/__init__.py +33 -33
- mlrun/frameworks/lgbm/callbacks/callback.py +2 -4
- mlrun/frameworks/lgbm/callbacks/logging_callback.py +4 -5
- mlrun/frameworks/lgbm/callbacks/mlrun_logging_callback.py +4 -5
- mlrun/frameworks/lgbm/mlrun_interfaces/booster_mlrun_interface.py +1 -3
- mlrun/frameworks/lgbm/mlrun_interfaces/mlrun_interface.py +6 -6
- mlrun/frameworks/lgbm/model_handler.py +10 -10
- mlrun/frameworks/lgbm/model_server.py +6 -6
- mlrun/frameworks/lgbm/utils.py +5 -5
- mlrun/frameworks/onnx/dataset.py +8 -8
- mlrun/frameworks/onnx/mlrun_interface.py +3 -3
- mlrun/frameworks/onnx/model_handler.py +6 -6
- mlrun/frameworks/onnx/model_server.py +7 -7
- mlrun/frameworks/parallel_coordinates.py +4 -3
- mlrun/frameworks/pytorch/__init__.py +18 -18
- mlrun/frameworks/pytorch/callbacks/callback.py +4 -5
- mlrun/frameworks/pytorch/callbacks/logging_callback.py +17 -17
- mlrun/frameworks/pytorch/callbacks/mlrun_logging_callback.py +11 -11
- mlrun/frameworks/pytorch/callbacks/tensorboard_logging_callback.py +23 -29
- mlrun/frameworks/pytorch/callbacks_handler.py +38 -38
- mlrun/frameworks/pytorch/mlrun_interface.py +20 -20
- mlrun/frameworks/pytorch/model_handler.py +17 -17
- mlrun/frameworks/pytorch/model_server.py +7 -7
- mlrun/frameworks/sklearn/__init__.py +13 -13
- mlrun/frameworks/sklearn/estimator.py +4 -4
- mlrun/frameworks/sklearn/metrics_library.py +14 -14
- mlrun/frameworks/sklearn/mlrun_interface.py +3 -6
- mlrun/frameworks/sklearn/model_handler.py +2 -2
- mlrun/frameworks/tf_keras/__init__.py +10 -7
- mlrun/frameworks/tf_keras/callbacks/logging_callback.py +15 -15
- mlrun/frameworks/tf_keras/callbacks/mlrun_logging_callback.py +11 -11
- mlrun/frameworks/tf_keras/callbacks/tensorboard_logging_callback.py +19 -23
- mlrun/frameworks/tf_keras/mlrun_interface.py +9 -11
- mlrun/frameworks/tf_keras/model_handler.py +14 -14
- mlrun/frameworks/tf_keras/model_server.py +6 -6
- mlrun/frameworks/xgboost/__init__.py +13 -13
- mlrun/frameworks/xgboost/model_handler.py +6 -6
- mlrun/k8s_utils.py +14 -16
- mlrun/launcher/__init__.py +1 -1
- mlrun/launcher/base.py +16 -15
- mlrun/launcher/client.py +8 -6
- mlrun/launcher/factory.py +1 -1
- mlrun/launcher/local.py +17 -11
- mlrun/launcher/remote.py +16 -10
- mlrun/lists.py +7 -6
- mlrun/model.py +238 -73
- mlrun/model_monitoring/__init__.py +1 -1
- mlrun/model_monitoring/api.py +138 -315
- mlrun/model_monitoring/application.py +5 -296
- mlrun/model_monitoring/applications/__init__.py +24 -0
- mlrun/model_monitoring/applications/_application_steps.py +157 -0
- mlrun/model_monitoring/applications/base.py +282 -0
- mlrun/model_monitoring/applications/context.py +214 -0
- mlrun/model_monitoring/applications/evidently_base.py +211 -0
- mlrun/model_monitoring/applications/histogram_data_drift.py +349 -0
- mlrun/model_monitoring/applications/results.py +99 -0
- mlrun/model_monitoring/controller.py +104 -84
- mlrun/model_monitoring/controller_handler.py +13 -5
- mlrun/model_monitoring/db/__init__.py +18 -0
- mlrun/model_monitoring/{stores → db/stores}/__init__.py +43 -36
- mlrun/model_monitoring/db/stores/base/__init__.py +15 -0
- mlrun/model_monitoring/{stores/model_endpoint_store.py → db/stores/base/store.py} +64 -40
- mlrun/model_monitoring/db/stores/sqldb/__init__.py +13 -0
- mlrun/model_monitoring/db/stores/sqldb/models/__init__.py +71 -0
- mlrun/model_monitoring/{stores → db/stores/sqldb}/models/base.py +109 -5
- mlrun/model_monitoring/db/stores/sqldb/models/mysql.py +88 -0
- mlrun/model_monitoring/{stores/models/mysql.py → db/stores/sqldb/models/sqlite.py} +19 -13
- mlrun/model_monitoring/db/stores/sqldb/sql_store.py +684 -0
- mlrun/model_monitoring/db/stores/v3io_kv/__init__.py +13 -0
- mlrun/model_monitoring/{stores/kv_model_endpoint_store.py → db/stores/v3io_kv/kv_store.py} +310 -165
- mlrun/model_monitoring/db/tsdb/__init__.py +100 -0
- mlrun/model_monitoring/db/tsdb/base.py +329 -0
- mlrun/model_monitoring/db/tsdb/helpers.py +30 -0
- mlrun/model_monitoring/db/tsdb/tdengine/__init__.py +15 -0
- mlrun/model_monitoring/db/tsdb/tdengine/schemas.py +240 -0
- mlrun/model_monitoring/db/tsdb/tdengine/stream_graph_steps.py +45 -0
- mlrun/model_monitoring/db/tsdb/tdengine/tdengine_connector.py +397 -0
- mlrun/model_monitoring/db/tsdb/v3io/__init__.py +15 -0
- mlrun/model_monitoring/db/tsdb/v3io/stream_graph_steps.py +117 -0
- mlrun/model_monitoring/db/tsdb/v3io/v3io_connector.py +630 -0
- mlrun/model_monitoring/evidently_application.py +6 -118
- mlrun/model_monitoring/features_drift_table.py +134 -106
- mlrun/model_monitoring/helpers.py +127 -28
- mlrun/model_monitoring/metrics/__init__.py +13 -0
- mlrun/model_monitoring/metrics/histogram_distance.py +127 -0
- mlrun/model_monitoring/model_endpoint.py +3 -2
- mlrun/model_monitoring/prometheus.py +1 -4
- mlrun/model_monitoring/stream_processing.py +62 -231
- mlrun/model_monitoring/tracking_policy.py +9 -2
- mlrun/model_monitoring/writer.py +152 -124
- mlrun/package/__init__.py +6 -6
- mlrun/package/context_handler.py +5 -5
- mlrun/package/packager.py +7 -7
- mlrun/package/packagers/default_packager.py +6 -6
- mlrun/package/packagers/numpy_packagers.py +15 -15
- mlrun/package/packagers/pandas_packagers.py +5 -5
- mlrun/package/packagers/python_standard_library_packagers.py +10 -10
- mlrun/package/packagers_manager.py +19 -23
- mlrun/package/utils/_formatter.py +6 -6
- mlrun/package/utils/_pickler.py +2 -2
- mlrun/package/utils/_supported_format.py +4 -4
- mlrun/package/utils/log_hint_utils.py +2 -2
- mlrun/package/utils/type_hint_utils.py +4 -9
- mlrun/platforms/__init__.py +11 -10
- mlrun/platforms/iguazio.py +24 -203
- mlrun/projects/operations.py +35 -21
- mlrun/projects/pipelines.py +68 -99
- mlrun/projects/project.py +830 -266
- mlrun/render.py +3 -11
- mlrun/run.py +162 -166
- mlrun/runtimes/__init__.py +62 -7
- mlrun/runtimes/base.py +39 -32
- mlrun/runtimes/daskjob.py +8 -8
- mlrun/runtimes/databricks_job/databricks_cancel_task.py +1 -1
- mlrun/runtimes/databricks_job/databricks_runtime.py +7 -7
- mlrun/runtimes/databricks_job/databricks_wrapper.py +1 -1
- mlrun/runtimes/funcdoc.py +0 -28
- mlrun/runtimes/function_reference.py +1 -1
- mlrun/runtimes/kubejob.py +28 -122
- mlrun/runtimes/local.py +6 -3
- mlrun/runtimes/mpijob/__init__.py +0 -20
- mlrun/runtimes/mpijob/abstract.py +9 -10
- mlrun/runtimes/mpijob/v1.py +1 -1
- mlrun/{model_monitoring/stores/models/sqlite.py → runtimes/nuclio/__init__.py} +7 -9
- mlrun/runtimes/nuclio/api_gateway.py +709 -0
- mlrun/runtimes/nuclio/application/__init__.py +15 -0
- mlrun/runtimes/nuclio/application/application.py +523 -0
- mlrun/runtimes/nuclio/application/reverse_proxy.go +95 -0
- mlrun/runtimes/{function.py → nuclio/function.py} +112 -73
- mlrun/runtimes/{nuclio.py → nuclio/nuclio.py} +6 -6
- mlrun/runtimes/{serving.py → nuclio/serving.py} +45 -51
- mlrun/runtimes/pod.py +286 -88
- mlrun/runtimes/remotesparkjob.py +2 -2
- mlrun/runtimes/sparkjob/spark3job.py +51 -34
- mlrun/runtimes/utils.py +7 -75
- mlrun/secrets.py +9 -5
- mlrun/serving/remote.py +2 -7
- mlrun/serving/routers.py +13 -10
- mlrun/serving/server.py +22 -26
- mlrun/serving/states.py +99 -25
- mlrun/serving/utils.py +3 -3
- mlrun/serving/v1_serving.py +6 -7
- mlrun/serving/v2_serving.py +59 -20
- mlrun/track/tracker.py +2 -1
- mlrun/track/tracker_manager.py +3 -3
- mlrun/track/trackers/mlflow_tracker.py +1 -2
- mlrun/utils/async_http.py +5 -7
- mlrun/utils/azure_vault.py +1 -1
- mlrun/utils/clones.py +1 -2
- mlrun/utils/condition_evaluator.py +3 -3
- mlrun/utils/db.py +3 -3
- mlrun/utils/helpers.py +183 -197
- mlrun/utils/http.py +2 -5
- mlrun/utils/logger.py +76 -14
- mlrun/utils/notifications/notification/__init__.py +17 -12
- mlrun/utils/notifications/notification/base.py +14 -2
- mlrun/utils/notifications/notification/console.py +2 -0
- mlrun/utils/notifications/notification/git.py +3 -1
- mlrun/utils/notifications/notification/ipython.py +3 -1
- mlrun/utils/notifications/notification/slack.py +101 -21
- mlrun/utils/notifications/notification/webhook.py +11 -1
- mlrun/utils/notifications/notification_pusher.py +155 -30
- mlrun/utils/retryer.py +208 -0
- mlrun/utils/singleton.py +1 -1
- mlrun/utils/v3io_clients.py +2 -4
- mlrun/utils/version/version.json +2 -2
- mlrun/utils/version/version.py +2 -6
- {mlrun-1.6.4rc2.dist-info → mlrun-1.7.0rc20.dist-info}/METADATA +31 -19
- mlrun-1.7.0rc20.dist-info/RECORD +353 -0
- mlrun/kfpops.py +0 -868
- mlrun/model_monitoring/batch.py +0 -1095
- mlrun/model_monitoring/stores/models/__init__.py +0 -27
- mlrun/model_monitoring/stores/sql_model_endpoint_store.py +0 -384
- mlrun/platforms/other.py +0 -306
- mlrun-1.6.4rc2.dist-info/RECORD +0 -314
- {mlrun-1.6.4rc2.dist-info → mlrun-1.7.0rc20.dist-info}/LICENSE +0 -0
- {mlrun-1.6.4rc2.dist-info → mlrun-1.7.0rc20.dist-info}/WHEEL +0 -0
- {mlrun-1.6.4rc2.dist-info → mlrun-1.7.0rc20.dist-info}/entry_points.txt +0 -0
- {mlrun-1.6.4rc2.dist-info → mlrun-1.7.0rc20.dist-info}/top_level.txt +0 -0
mlrun/frameworks/_common/plan.py
CHANGED
|
@@ -13,7 +13,6 @@
|
|
|
13
13
|
# limitations under the License.
|
|
14
14
|
#
|
|
15
15
|
from abc import ABC, abstractmethod
|
|
16
|
-
from typing import Dict
|
|
17
16
|
|
|
18
17
|
import mlrun
|
|
19
18
|
from mlrun.artifacts import Artifact
|
|
@@ -33,7 +32,7 @@ class Plan(ABC):
|
|
|
33
32
|
self._artifacts = {} # type: Dict[str, Artifact]
|
|
34
33
|
|
|
35
34
|
@property
|
|
36
|
-
def artifacts(self) ->
|
|
35
|
+
def artifacts(self) -> dict[str, Artifact]:
|
|
37
36
|
"""
|
|
38
37
|
Get the plan's produced artifacts.
|
|
39
38
|
|
|
@@ -59,7 +58,7 @@ class Plan(ABC):
|
|
|
59
58
|
pass
|
|
60
59
|
|
|
61
60
|
@abstractmethod
|
|
62
|
-
def produce(self, *args, **kwargs) ->
|
|
61
|
+
def produce(self, *args, **kwargs) -> dict[str, Artifact]:
|
|
63
62
|
"""
|
|
64
63
|
Produce the artifact according to this plan.
|
|
65
64
|
|
|
@@ -12,7 +12,6 @@
|
|
|
12
12
|
# See the License for the specific language governing permissions and
|
|
13
13
|
# limitations under the License.
|
|
14
14
|
#
|
|
15
|
-
from typing import Dict, List
|
|
16
15
|
|
|
17
16
|
import mlrun
|
|
18
17
|
from mlrun.artifacts import Artifact
|
|
@@ -29,7 +28,7 @@ class Producer:
|
|
|
29
28
|
def __init__(
|
|
30
29
|
self,
|
|
31
30
|
context: mlrun.MLClientCtx = None,
|
|
32
|
-
plans:
|
|
31
|
+
plans: list[Plan] = None,
|
|
33
32
|
):
|
|
34
33
|
"""
|
|
35
34
|
Initialize a producer with the given plans. The producer will log the produced artifacts using the given
|
|
@@ -68,7 +67,7 @@ class Producer:
|
|
|
68
67
|
return self._context
|
|
69
68
|
|
|
70
69
|
@property
|
|
71
|
-
def artifacts(self) ->
|
|
70
|
+
def artifacts(self) -> dict[str, Artifact]:
|
|
72
71
|
"""
|
|
73
72
|
Get the logged artifacts.
|
|
74
73
|
|
|
@@ -92,7 +91,7 @@ class Producer:
|
|
|
92
91
|
"""
|
|
93
92
|
self._context = context
|
|
94
93
|
|
|
95
|
-
def set_plans(self, plans:
|
|
94
|
+
def set_plans(self, plans: list[Plan]):
|
|
96
95
|
"""
|
|
97
96
|
Update the plans of this logger to the given list of plans here.
|
|
98
97
|
|
|
@@ -16,7 +16,7 @@ import re
|
|
|
16
16
|
from abc import ABC
|
|
17
17
|
from enum import Enum
|
|
18
18
|
from pathlib import Path
|
|
19
|
-
from typing import Any,
|
|
19
|
+
from typing import Any, TypeVar, Union
|
|
20
20
|
|
|
21
21
|
import numpy as np
|
|
22
22
|
import pandas as pd
|
|
@@ -42,10 +42,10 @@ class CommonTypes(ABC):
|
|
|
42
42
|
MLRunInterfaceableType = TypeVar("MLRunInterfaceableType")
|
|
43
43
|
|
|
44
44
|
# Type for a MLRun Interface restoration tuple as returned from 'remove_interface':
|
|
45
|
-
MLRunInterfaceRestorationType =
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
45
|
+
MLRunInterfaceRestorationType = tuple[
|
|
46
|
+
dict[str, Any], # Interface properties.
|
|
47
|
+
dict[str, Any], # Replaced properties.
|
|
48
|
+
list[str], # Replaced methods and functions.
|
|
49
49
|
]
|
|
50
50
|
|
|
51
51
|
# Common dataset type to all frameworks:
|
|
@@ -12,7 +12,6 @@
|
|
|
12
12
|
# See the License for the specific language governing permissions and
|
|
13
13
|
# limitations under the License.
|
|
14
14
|
#
|
|
15
|
-
from typing import Dict, List
|
|
16
15
|
|
|
17
16
|
import mlrun
|
|
18
17
|
|
|
@@ -79,7 +78,7 @@ class Logger:
|
|
|
79
78
|
return self._mode
|
|
80
79
|
|
|
81
80
|
@property
|
|
82
|
-
def training_results(self) ->
|
|
81
|
+
def training_results(self) -> dict[str, list[list[float]]]:
|
|
83
82
|
"""
|
|
84
83
|
Get the training results logged. The results will be stored in a dictionary where each key is the metric name
|
|
85
84
|
and the value is a list of lists of values. The first list is by epoch and the second list is by iteration
|
|
@@ -90,7 +89,7 @@ class Logger:
|
|
|
90
89
|
return self._training_results
|
|
91
90
|
|
|
92
91
|
@property
|
|
93
|
-
def validation_results(self) ->
|
|
92
|
+
def validation_results(self) -> dict[str, list[list[float]]]:
|
|
94
93
|
"""
|
|
95
94
|
Get the validation results logged. The results will be stored in a dictionary where each key is the metric name
|
|
96
95
|
and the value is a list of lists of values. The first list is by epoch and the second list is by iteration
|
|
@@ -101,7 +100,7 @@ class Logger:
|
|
|
101
100
|
return self._validation_results
|
|
102
101
|
|
|
103
102
|
@property
|
|
104
|
-
def training_summaries(self) ->
|
|
103
|
+
def training_summaries(self) -> dict[str, list[float]]:
|
|
105
104
|
"""
|
|
106
105
|
Get the training summaries of the metrics results. The summaries will be stored in a dictionary where each key
|
|
107
106
|
is the metric names and the value is a list of all the summary values per epoch.
|
|
@@ -111,7 +110,7 @@ class Logger:
|
|
|
111
110
|
return self._training_summaries
|
|
112
111
|
|
|
113
112
|
@property
|
|
114
|
-
def validation_summaries(self) ->
|
|
113
|
+
def validation_summaries(self) -> dict[str, list[float]]:
|
|
115
114
|
"""
|
|
116
115
|
Get the validation summaries of the metrics results. The summaries will be stored in a dictionary where each key
|
|
117
116
|
is the metric names and the value is a list of all the summary values per epoch.
|
|
@@ -121,7 +120,7 @@ class Logger:
|
|
|
121
120
|
return self._validation_summaries
|
|
122
121
|
|
|
123
122
|
@property
|
|
124
|
-
def static_hyperparameters(self) ->
|
|
123
|
+
def static_hyperparameters(self) -> dict[str, DLTypes.TrackableType]:
|
|
125
124
|
"""
|
|
126
125
|
Get the static hyperparameters logged. The hyperparameters will be stored in a dictionary where each key is the
|
|
127
126
|
hyperparameter name and the value is his logged value.
|
|
@@ -131,7 +130,7 @@ class Logger:
|
|
|
131
130
|
return self._static_hyperparameters
|
|
132
131
|
|
|
133
132
|
@property
|
|
134
|
-
def dynamic_hyperparameters(self) ->
|
|
133
|
+
def dynamic_hyperparameters(self) -> dict[str, list[DLTypes.TrackableType]]:
|
|
135
134
|
"""
|
|
136
135
|
Get the dynamic hyperparameters logged. The hyperparameters will be stored in a dictionary where each key is the
|
|
137
136
|
hyperparameter name and the value is a list of his logged values per epoch.
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
# limitations under the License.
|
|
14
14
|
#
|
|
15
15
|
import itertools
|
|
16
|
-
from typing import
|
|
16
|
+
from typing import Union
|
|
17
17
|
|
|
18
18
|
import numpy as np
|
|
19
19
|
import plotly.graph_objects as go
|
|
@@ -63,7 +63,7 @@ class MLRunLogger(Logger):
|
|
|
63
63
|
:param context: MLRun context to log to. The context parameters can be logged as static
|
|
64
64
|
hyperparameters.
|
|
65
65
|
"""
|
|
66
|
-
super(
|
|
66
|
+
super().__init__(context=context)
|
|
67
67
|
|
|
68
68
|
# Prepare the artifacts collection:
|
|
69
69
|
self._artifacts = {} # type: Dict[str, Artifact]
|
|
@@ -144,9 +144,9 @@ class MLRunLogger(Logger):
|
|
|
144
144
|
self,
|
|
145
145
|
model_handler: DLModelHandler,
|
|
146
146
|
tag: str = "",
|
|
147
|
-
labels:
|
|
148
|
-
parameters:
|
|
149
|
-
extra_data:
|
|
147
|
+
labels: dict[str, DLTypes.TrackableType] = None,
|
|
148
|
+
parameters: dict[str, DLTypes.TrackableType] = None,
|
|
149
|
+
extra_data: dict[str, Union[DLTypes.TrackableType, Artifact]] = None,
|
|
150
150
|
):
|
|
151
151
|
"""
|
|
152
152
|
Log the run, summarizing the validation metrics and dynamic hyperparameters across all epochs. If 'update' is
|
|
@@ -227,7 +227,7 @@ class MLRunLogger(Logger):
|
|
|
227
227
|
# Commit to update the changes, so they will be available in the MLRun UI:
|
|
228
228
|
self._context.commit(completed=False)
|
|
229
229
|
|
|
230
|
-
def _generate_metrics_summary(self) ->
|
|
230
|
+
def _generate_metrics_summary(self) -> dict[str, float]:
|
|
231
231
|
"""
|
|
232
232
|
Generate a metrics summary to log along the model.
|
|
233
233
|
|
|
@@ -254,7 +254,7 @@ class MLRunLogger(Logger):
|
|
|
254
254
|
|
|
255
255
|
@staticmethod
|
|
256
256
|
def _generate_metric_results_artifact(
|
|
257
|
-
loop: str, name: str, epochs_results:
|
|
257
|
+
loop: str, name: str, epochs_results: list[list[float]]
|
|
258
258
|
) -> PlotlyArtifact:
|
|
259
259
|
"""
|
|
260
260
|
Generate a plotly artifact for the results of the metric provided.
|
|
@@ -300,7 +300,7 @@ class MLRunLogger(Logger):
|
|
|
300
300
|
|
|
301
301
|
@staticmethod
|
|
302
302
|
def _generate_summary_results_artifact(
|
|
303
|
-
name: str, training_results:
|
|
303
|
+
name: str, training_results: list[float], validation_results: list[float]
|
|
304
304
|
) -> PlotlyArtifact:
|
|
305
305
|
"""
|
|
306
306
|
Generate a plotly artifact for the results summary across all the epochs of training.
|
|
@@ -351,7 +351,7 @@ class MLRunLogger(Logger):
|
|
|
351
351
|
|
|
352
352
|
@staticmethod
|
|
353
353
|
def _generate_dynamic_hyperparameter_values_artifact(
|
|
354
|
-
name: str, values:
|
|
354
|
+
name: str, values: list[float]
|
|
355
355
|
) -> PlotlyArtifact:
|
|
356
356
|
"""
|
|
357
357
|
Generate a plotly artifact for the values of the hyperparameter provided.
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
import os
|
|
16
16
|
from abc import abstractmethod
|
|
17
17
|
from datetime import datetime
|
|
18
|
-
from typing import Any, Callable,
|
|
18
|
+
from typing import Any, Callable, Generic, Union
|
|
19
19
|
|
|
20
20
|
import yaml
|
|
21
21
|
|
|
@@ -60,7 +60,7 @@ class TensorboardLogger(Logger, Generic[DLTypes.WeightType]):
|
|
|
60
60
|
|
|
61
61
|
def __init__(
|
|
62
62
|
self,
|
|
63
|
-
statistics_functions:
|
|
63
|
+
statistics_functions: list[
|
|
64
64
|
Callable[[DLTypes.WeightType], Union[float, DLTypes.WeightType]]
|
|
65
65
|
],
|
|
66
66
|
context: mlrun.MLClientCtx = None,
|
|
@@ -94,7 +94,7 @@ class TensorboardLogger(Logger, Generic[DLTypes.WeightType]):
|
|
|
94
94
|
:raise MLRunInvalidArgumentError: If the `update_frequency` is illegal or if `tensorboard_directory` and
|
|
95
95
|
`context` were not given.
|
|
96
96
|
"""
|
|
97
|
-
super(
|
|
97
|
+
super().__init__(context=context)
|
|
98
98
|
|
|
99
99
|
# Validate the context and tensorboard directory combination:
|
|
100
100
|
if tensorboard_directory is None and context is None:
|
|
@@ -136,7 +136,7 @@ class TensorboardLogger(Logger, Generic[DLTypes.WeightType]):
|
|
|
136
136
|
self._weights_statistics[statistic_function.__name__] = {} # type: Dict[str, List[float]]
|
|
137
137
|
|
|
138
138
|
@property
|
|
139
|
-
def weights(self) ->
|
|
139
|
+
def weights(self) -> dict[str, DLTypes.WeightType]:
|
|
140
140
|
"""
|
|
141
141
|
Get the logged weights dictionary. Each of the logged weight will be found by its name.
|
|
142
142
|
|
|
@@ -145,7 +145,7 @@ class TensorboardLogger(Logger, Generic[DLTypes.WeightType]):
|
|
|
145
145
|
return self._weights
|
|
146
146
|
|
|
147
147
|
@property
|
|
148
|
-
def weight_statistics(self) ->
|
|
148
|
+
def weight_statistics(self) -> dict[str, dict[str, list[float]]]:
|
|
149
149
|
"""
|
|
150
150
|
Get the logged statistics for all the tracked weights. Each statistic has a dictionary of weights and their list
|
|
151
151
|
of epochs values.
|
|
@@ -514,23 +514,15 @@ class TensorboardLogger(Logger, Generic[DLTypes.WeightType]):
|
|
|
514
514
|
+ list(self._dynamic_hyperparameters.keys()),
|
|
515
515
|
],
|
|
516
516
|
):
|
|
517
|
-
text += "\n * **{}**: {}"
|
|
518
|
-
property_name.capitalize(),
|
|
519
|
-
self._markdown_print(value=property_value, tabs=2),
|
|
520
|
-
)
|
|
517
|
+
text += f"\n * **{property_name.capitalize()}**: {self._markdown_print(value=property_value, tabs=2)}"
|
|
521
518
|
|
|
522
519
|
# Add the context state:
|
|
523
520
|
if self._context is not None:
|
|
524
|
-
text += "\n####Context initial state: ({})"
|
|
525
|
-
self._generate_context_link(context=self._context)
|
|
526
|
-
)
|
|
521
|
+
text += f"\n####Context initial state: ({self._generate_context_link(context=self._context)})"
|
|
527
522
|
for property_name, property_value in self._extract_properties_from_context(
|
|
528
523
|
context=self._context
|
|
529
524
|
).items():
|
|
530
|
-
text += "\n * **{}**: {}"
|
|
531
|
-
property_name.capitalize(),
|
|
532
|
-
self._markdown_print(value=property_value, tabs=2),
|
|
533
|
-
)
|
|
525
|
+
text += f"\n * **{property_name.capitalize()}**: {self._markdown_print(value=property_value, tabs=2)}"
|
|
534
526
|
|
|
535
527
|
return text
|
|
536
528
|
|
|
@@ -541,7 +533,7 @@ class TensorboardLogger(Logger, Generic[DLTypes.WeightType]):
|
|
|
541
533
|
|
|
542
534
|
:return: The generated text.
|
|
543
535
|
"""
|
|
544
|
-
text = "####Epoch {} summary:"
|
|
536
|
+
text = f"####Epoch {self._epochs} summary:"
|
|
545
537
|
if self._context is not None:
|
|
546
538
|
for property_name, property_value in self._extract_properties_from_context(
|
|
547
539
|
context=self._context
|
|
@@ -555,16 +547,13 @@ class TensorboardLogger(Logger, Generic[DLTypes.WeightType]):
|
|
|
555
547
|
"inputs",
|
|
556
548
|
"parameters",
|
|
557
549
|
]:
|
|
558
|
-
text +=
|
|
559
|
-
property_name.capitalize()
|
|
560
|
-
self._markdown_print(value=property_value, tabs=2)
|
|
550
|
+
text += (
|
|
551
|
+
f"\n * **{property_name.capitalize()}**: "
|
|
552
|
+
f"{self._markdown_print(value=property_value, tabs=2)}"
|
|
561
553
|
)
|
|
562
554
|
else:
|
|
563
555
|
for property_name, property_value in self._extract_epoch_results().items():
|
|
564
|
-
text += "\n * **{}**: {}"
|
|
565
|
-
property_name.capitalize(),
|
|
566
|
-
self._markdown_print(value=property_value, tabs=2),
|
|
567
|
-
)
|
|
556
|
+
text += f"\n * **{property_name.capitalize()}**: {self._markdown_print(value=property_value, tabs=2)}"
|
|
568
557
|
return text
|
|
569
558
|
|
|
570
559
|
def _generate_run_end_text(self) -> str:
|
|
@@ -575,30 +564,22 @@ class TensorboardLogger(Logger, Generic[DLTypes.WeightType]):
|
|
|
575
564
|
:return: The generated text.
|
|
576
565
|
"""
|
|
577
566
|
# Write the run summary:
|
|
578
|
-
text = "\n####Run final summary - epoch {}:"
|
|
567
|
+
text = f"\n####Run final summary - epoch {self._epochs}:"
|
|
579
568
|
for property_name, property_value in self._extract_epoch_results().items():
|
|
580
|
-
text += "\n * **{}**: {}"
|
|
581
|
-
property_name.capitalize(),
|
|
582
|
-
self._markdown_print(value=property_value, tabs=2),
|
|
583
|
-
)
|
|
569
|
+
text += f"\n * **{property_name.capitalize()}**: {self._markdown_print(value=property_value, tabs=2)}"
|
|
584
570
|
|
|
585
571
|
# Add the context final state:
|
|
586
572
|
if self._context is not None:
|
|
587
|
-
text += "\n####Context final state: ({})"
|
|
588
|
-
self._generate_context_link(context=self._context)
|
|
589
|
-
)
|
|
573
|
+
text += f"\n####Context final state: ({self._generate_context_link(context=self._context)})"
|
|
590
574
|
for property_name, property_value in self._extract_properties_from_context(
|
|
591
575
|
context=self._context
|
|
592
576
|
).items():
|
|
593
|
-
text += "\n * **{}**: {}"
|
|
594
|
-
property_name.capitalize(),
|
|
595
|
-
self._markdown_print(value=property_value, tabs=2),
|
|
596
|
-
)
|
|
577
|
+
text += f"\n * **{property_name.capitalize()}**: {self._markdown_print(value=property_value, tabs=2)}"
|
|
597
578
|
return text
|
|
598
579
|
|
|
599
580
|
def _extract_epoch_results(
|
|
600
581
|
self, epoch: int = -1
|
|
601
|
-
) ->
|
|
582
|
+
) -> dict[str, dict[str, DLTypes.TrackableType]]:
|
|
602
583
|
"""
|
|
603
584
|
Extract the given epoch results from all the collected values and results.
|
|
604
585
|
|
|
@@ -633,17 +614,12 @@ class TensorboardLogger(Logger, Generic[DLTypes.WeightType]):
|
|
|
633
614
|
:return: The generated link.
|
|
634
615
|
"""
|
|
635
616
|
return (
|
|
636
|
-
'<a href="{}/{}/{}
|
|
637
|
-
|
|
638
|
-
config.ui.projects_prefix,
|
|
639
|
-
context.project,
|
|
640
|
-
context.uid,
|
|
641
|
-
link_text,
|
|
642
|
-
)
|
|
617
|
+
f'<a href="{config.resolve_ui_url()}/{config.ui.projects_prefix}/{context.project}'
|
|
618
|
+
f'/jobs/monitor/{context.uid}/overview" target="_blank">{link_text}</a>'
|
|
643
619
|
)
|
|
644
620
|
|
|
645
621
|
@staticmethod
|
|
646
|
-
def _extract_properties_from_context(context: mlrun.MLClientCtx) ->
|
|
622
|
+
def _extract_properties_from_context(context: mlrun.MLClientCtx) -> dict[str, Any]:
|
|
647
623
|
"""
|
|
648
624
|
Extract the properties of the run this context belongs to.
|
|
649
625
|
|
|
@@ -672,13 +648,13 @@ class TensorboardLogger(Logger, Generic[DLTypes.WeightType]):
|
|
|
672
648
|
if isinstance(value, list):
|
|
673
649
|
if len(value) == 0:
|
|
674
650
|
return ""
|
|
675
|
-
text = "\n" + yaml.
|
|
651
|
+
text = "\n" + yaml.safe_dump(value)
|
|
676
652
|
text = " \n".join([" " * tabs + line for line in text.splitlines()])
|
|
677
653
|
return text
|
|
678
654
|
if isinstance(value, dict):
|
|
679
655
|
if len(value) == 0:
|
|
680
656
|
return ""
|
|
681
|
-
text = yaml.
|
|
657
|
+
text = yaml.safe_dump(value)
|
|
682
658
|
text = " \n".join(
|
|
683
659
|
[" " * tabs + "- " + line for line in text.splitlines()]
|
|
684
660
|
)
|
|
@@ -13,7 +13,6 @@
|
|
|
13
13
|
# limitations under the License.
|
|
14
14
|
#
|
|
15
15
|
from abc import ABC
|
|
16
|
-
from typing import List
|
|
17
16
|
|
|
18
17
|
from .._common.artifacts_library import ArtifactsLibrary, Plan
|
|
19
18
|
from .plans import (
|
|
@@ -47,7 +46,7 @@ class MLArtifactsLibrary(ArtifactsLibrary, ABC):
|
|
|
47
46
|
@classmethod
|
|
48
47
|
def default(
|
|
49
48
|
cls, model: MLTypes.ModelType, y: MLTypes.DatasetType = None, *args, **kwargs
|
|
50
|
-
) ->
|
|
49
|
+
) -> list[Plan]:
|
|
51
50
|
"""
|
|
52
51
|
Get the default artifacts plans list of this framework's library.
|
|
53
52
|
|
|
@@ -12,7 +12,6 @@
|
|
|
12
12
|
# See the License for the specific language governing permissions and
|
|
13
13
|
# limitations under the License.
|
|
14
14
|
#
|
|
15
|
-
from typing import Dict, List
|
|
16
15
|
|
|
17
16
|
from ..utils import MLTypes
|
|
18
17
|
|
|
@@ -42,7 +41,7 @@ class Logger:
|
|
|
42
41
|
self._iterations = 0
|
|
43
42
|
|
|
44
43
|
@property
|
|
45
|
-
def results(self) ->
|
|
44
|
+
def results(self) -> dict[str, dict[str, list[float]]]:
|
|
46
45
|
"""
|
|
47
46
|
Get the results logged. The results will be stored in a dictionary where each key is the validation set name
|
|
48
47
|
and the value is a dictionary of metrics to their list of iterations values.
|
|
@@ -52,7 +51,7 @@ class Logger:
|
|
|
52
51
|
return self._results
|
|
53
52
|
|
|
54
53
|
@property
|
|
55
|
-
def static_hyperparameters(self) ->
|
|
54
|
+
def static_hyperparameters(self) -> dict[str, MLTypes.TrackableType]:
|
|
56
55
|
"""
|
|
57
56
|
Get the static hyperparameters logged. The hyperparameters will be stored in a dictionary where each key is the
|
|
58
57
|
hyperparameter name and the value is his logged value.
|
|
@@ -62,7 +61,7 @@ class Logger:
|
|
|
62
61
|
return self._static_hyperparameters
|
|
63
62
|
|
|
64
63
|
@property
|
|
65
|
-
def dynamic_hyperparameters(self) ->
|
|
64
|
+
def dynamic_hyperparameters(self) -> dict[str, list[MLTypes.TrackableType]]:
|
|
66
65
|
"""
|
|
67
66
|
Get the dynamic hyperparameters logged. The hyperparameters will be stored in a dictionary where each key is the
|
|
68
67
|
hyperparameter name and the value is a list of his logged values per epoch.
|
|
@@ -13,7 +13,6 @@
|
|
|
13
13
|
# limitations under the License.
|
|
14
14
|
#
|
|
15
15
|
import re
|
|
16
|
-
from typing import Dict, List
|
|
17
16
|
|
|
18
17
|
import numpy as np
|
|
19
18
|
import plotly.graph_objects as go
|
|
@@ -39,7 +38,7 @@ class MLRunLogger(Logger):
|
|
|
39
38
|
|
|
40
39
|
:param context: MLRun context to log to. The context parameters can be logged as static hyperparameters.
|
|
41
40
|
"""
|
|
42
|
-
super(
|
|
41
|
+
super().__init__()
|
|
43
42
|
|
|
44
43
|
# An MLRun context to log to:
|
|
45
44
|
self._context = context
|
|
@@ -47,7 +46,7 @@ class MLRunLogger(Logger):
|
|
|
47
46
|
# Prepare the artifacts dictionary:
|
|
48
47
|
self._artifacts = {} # type: Dict[str, Artifact]
|
|
49
48
|
|
|
50
|
-
def get_artifacts(self) ->
|
|
49
|
+
def get_artifacts(self) -> dict[str, Artifact]:
|
|
51
50
|
"""
|
|
52
51
|
Get the artifacts created by this logger.
|
|
53
52
|
|
|
@@ -55,7 +54,7 @@ class MLRunLogger(Logger):
|
|
|
55
54
|
"""
|
|
56
55
|
return self._artifacts
|
|
57
56
|
|
|
58
|
-
def get_metrics(self) ->
|
|
57
|
+
def get_metrics(self) -> dict[str, float]:
|
|
59
58
|
"""
|
|
60
59
|
Generate a metrics summary to log along the model.
|
|
61
60
|
|
|
@@ -144,7 +143,7 @@ class MLRunLogger(Logger):
|
|
|
144
143
|
|
|
145
144
|
@staticmethod
|
|
146
145
|
def _produce_convergence_plot_artifact(
|
|
147
|
-
name: str, values:
|
|
146
|
+
name: str, values: list[float]
|
|
148
147
|
) -> PlotlyArtifact:
|
|
149
148
|
"""
|
|
150
149
|
Produce the convergences for the provided metric according.
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
# limitations under the License.
|
|
14
14
|
#
|
|
15
15
|
from abc import ABC
|
|
16
|
-
from typing import
|
|
16
|
+
from typing import Union
|
|
17
17
|
|
|
18
18
|
import mlrun
|
|
19
19
|
from mlrun.artifacts import Artifact
|
|
@@ -35,10 +35,10 @@ class MLModelHandler(ModelHandler, ABC):
|
|
|
35
35
|
model_path: MLTypes.PathType = None,
|
|
36
36
|
model_name: str = None,
|
|
37
37
|
modules_map: Union[
|
|
38
|
-
|
|
38
|
+
dict[str, Union[None, str, list[str]]], MLTypes.PathType
|
|
39
39
|
] = None,
|
|
40
40
|
custom_objects_map: Union[
|
|
41
|
-
|
|
41
|
+
dict[str, Union[str, list[str]]], MLTypes.PathType
|
|
42
42
|
] = None,
|
|
43
43
|
custom_objects_directory: MLTypes.PathType = None,
|
|
44
44
|
context: mlrun.MLClientCtx = None,
|
|
@@ -105,7 +105,7 @@ class MLModelHandler(ModelHandler, ABC):
|
|
|
105
105
|
self._feature_weights = None # type: List[float]
|
|
106
106
|
|
|
107
107
|
# Continue the initialization:
|
|
108
|
-
super(
|
|
108
|
+
super().__init__(
|
|
109
109
|
model=model,
|
|
110
110
|
model_path=model_path,
|
|
111
111
|
model_name=model_name,
|
|
@@ -153,7 +153,7 @@ class MLModelHandler(ModelHandler, ABC):
|
|
|
153
153
|
return self._feature_vector
|
|
154
154
|
|
|
155
155
|
@property
|
|
156
|
-
def feature_weights(self) ->
|
|
156
|
+
def feature_weights(self) -> list[float]:
|
|
157
157
|
"""
|
|
158
158
|
Get the feature weights set in this handler.
|
|
159
159
|
|
|
@@ -213,7 +213,7 @@ class MLModelHandler(ModelHandler, ABC):
|
|
|
213
213
|
"""
|
|
214
214
|
self._feature_vector = feature_vector
|
|
215
215
|
|
|
216
|
-
def set_feature_weights(self, feature_weights:
|
|
216
|
+
def set_feature_weights(self, feature_weights: list[float]):
|
|
217
217
|
"""
|
|
218
218
|
Set the feature weights this model will be logged with.
|
|
219
219
|
|
|
@@ -224,18 +224,18 @@ class MLModelHandler(ModelHandler, ABC):
|
|
|
224
224
|
def log(
|
|
225
225
|
self,
|
|
226
226
|
tag: str = "",
|
|
227
|
-
labels:
|
|
228
|
-
parameters:
|
|
229
|
-
inputs:
|
|
230
|
-
outputs:
|
|
231
|
-
metrics:
|
|
232
|
-
artifacts:
|
|
233
|
-
extra_data:
|
|
227
|
+
labels: dict[str, Union[str, int, float]] = None,
|
|
228
|
+
parameters: dict[str, Union[str, int, float]] = None,
|
|
229
|
+
inputs: list[Feature] = None,
|
|
230
|
+
outputs: list[Feature] = None,
|
|
231
|
+
metrics: dict[str, Union[int, float]] = None,
|
|
232
|
+
artifacts: dict[str, Artifact] = None,
|
|
233
|
+
extra_data: dict[str, MLTypes.ExtraDataType] = None,
|
|
234
234
|
algorithm: str = None,
|
|
235
235
|
sample_set: MLTypes.DatasetType = None,
|
|
236
236
|
target_columns: MLTypes.TargetColumnsNamesType = None,
|
|
237
237
|
feature_vector: str = None,
|
|
238
|
-
feature_weights:
|
|
238
|
+
feature_weights: list[float] = None,
|
|
239
239
|
):
|
|
240
240
|
"""
|
|
241
241
|
Log the model held by this handler into the MLRun context provided.
|
|
@@ -281,7 +281,7 @@ class MLModelHandler(ModelHandler, ABC):
|
|
|
281
281
|
self.set_feature_weights(feature_weights=feature_weights)
|
|
282
282
|
|
|
283
283
|
# Continue with the handler logging:
|
|
284
|
-
super(
|
|
284
|
+
super().log(
|
|
285
285
|
tag=tag,
|
|
286
286
|
labels=labels,
|
|
287
287
|
parameters=parameters,
|
|
@@ -299,15 +299,15 @@ class MLModelHandler(ModelHandler, ABC):
|
|
|
299
299
|
|
|
300
300
|
def update(
|
|
301
301
|
self,
|
|
302
|
-
labels:
|
|
303
|
-
parameters:
|
|
304
|
-
inputs:
|
|
305
|
-
outputs:
|
|
306
|
-
metrics:
|
|
307
|
-
artifacts:
|
|
308
|
-
extra_data:
|
|
302
|
+
labels: dict[str, Union[str, int, float]] = None,
|
|
303
|
+
parameters: dict[str, Union[str, int, float]] = None,
|
|
304
|
+
inputs: list[Feature] = None,
|
|
305
|
+
outputs: list[Feature] = None,
|
|
306
|
+
metrics: dict[str, Union[int, float]] = None,
|
|
307
|
+
artifacts: dict[str, Artifact] = None,
|
|
308
|
+
extra_data: dict[str, MLTypes.ExtraDataType] = None,
|
|
309
309
|
feature_vector: str = None,
|
|
310
|
-
feature_weights:
|
|
310
|
+
feature_weights: list[float] = None,
|
|
311
311
|
):
|
|
312
312
|
"""
|
|
313
313
|
Update the model held by this handler into the MLRun context provided, updating the model's artifact properties
|
|
@@ -336,7 +336,7 @@ class MLModelHandler(ModelHandler, ABC):
|
|
|
336
336
|
self._feature_weights = feature_weights
|
|
337
337
|
|
|
338
338
|
# Continue with the handler update:
|
|
339
|
-
super(
|
|
339
|
+
super().update(
|
|
340
340
|
labels=labels,
|
|
341
341
|
parameters=parameters,
|
|
342
342
|
inputs=inputs,
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
# See the License for the specific language governing permissions and
|
|
13
13
|
# limitations under the License.
|
|
14
14
|
#
|
|
15
|
-
from typing import Any
|
|
15
|
+
from typing import Any
|
|
16
16
|
|
|
17
17
|
import numpy as np
|
|
18
18
|
import pandas as pd
|
|
@@ -59,7 +59,7 @@ class PickleModelServer(V2ModelServer):
|
|
|
59
59
|
|
|
60
60
|
return y_pred.tolist()
|
|
61
61
|
|
|
62
|
-
def explain(self, request:
|
|
62
|
+
def explain(self, request: dict[str, Any]) -> str:
|
|
63
63
|
"""
|
|
64
64
|
Returns a string listing the model that is being served in this serving function and the function name.
|
|
65
65
|
|
|
@@ -12,7 +12,6 @@
|
|
|
12
12
|
# See the License for the specific language governing permissions and
|
|
13
13
|
# limitations under the License.
|
|
14
14
|
#
|
|
15
|
-
from typing import Dict
|
|
16
15
|
|
|
17
16
|
import plotly.graph_objects as go
|
|
18
17
|
from sklearn.calibration import calibration_curve
|
|
@@ -51,7 +50,7 @@ class CalibrationCurvePlan(MLPlotPlan):
|
|
|
51
50
|
self._strategy = strategy
|
|
52
51
|
|
|
53
52
|
# Continue the initialization for the MLPlan:
|
|
54
|
-
super(
|
|
53
|
+
super().__init__(need_probabilities=True)
|
|
55
54
|
|
|
56
55
|
def is_ready(self, stage: MLPlanStages, is_probabilities: bool) -> bool:
|
|
57
56
|
"""
|
|
@@ -73,7 +72,7 @@ class CalibrationCurvePlan(MLPlotPlan):
|
|
|
73
72
|
model: MLTypes.ModelType = None,
|
|
74
73
|
x: MLTypes.DatasetType = None,
|
|
75
74
|
**kwargs,
|
|
76
|
-
) ->
|
|
75
|
+
) -> dict[str, Artifact]:
|
|
77
76
|
"""
|
|
78
77
|
Produce the calibration curve according to the ground truth (y) and predictions (y_pred) values. If predictions
|
|
79
78
|
are not available, the model and a dataset can be given to produce them.
|