wizata-dsapi 1.3.20__tar.gz → 1.3.21__tar.gz
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.
- {wizata_dsapi-1.3.20/wizata_dsapi.egg-info → wizata_dsapi-1.3.21}/PKG-INFO +1 -1
- {wizata_dsapi-1.3.20 → wizata_dsapi-1.3.21}/wizata_dsapi/mlmodel.py +12 -1
- wizata_dsapi-1.3.21/wizata_dsapi/version.py +1 -0
- {wizata_dsapi-1.3.20 → wizata_dsapi-1.3.21}/wizata_dsapi/wizata_dsapi_client.py +5 -25
- {wizata_dsapi-1.3.20 → wizata_dsapi-1.3.21/wizata_dsapi.egg-info}/PKG-INFO +1 -1
- wizata_dsapi-1.3.20/wizata_dsapi/version.py +0 -1
- {wizata_dsapi-1.3.20 → wizata_dsapi-1.3.21}/LICENSE.txt +0 -0
- {wizata_dsapi-1.3.20 → wizata_dsapi-1.3.21}/README.rst +0 -0
- {wizata_dsapi-1.3.20 → wizata_dsapi-1.3.21}/setup.cfg +0 -0
- {wizata_dsapi-1.3.20 → wizata_dsapi-1.3.21}/setup.py +0 -0
- {wizata_dsapi-1.3.20 → wizata_dsapi-1.3.21}/wizata_dsapi/__init__.py +0 -0
- {wizata_dsapi-1.3.20 → wizata_dsapi-1.3.21}/wizata_dsapi/api_config.py +0 -0
- {wizata_dsapi-1.3.20 → wizata_dsapi-1.3.21}/wizata_dsapi/api_dto.py +0 -0
- {wizata_dsapi-1.3.20 → wizata_dsapi-1.3.21}/wizata_dsapi/api_interface.py +0 -0
- {wizata_dsapi-1.3.20 → wizata_dsapi-1.3.21}/wizata_dsapi/bucket.py +0 -0
- {wizata_dsapi-1.3.20 → wizata_dsapi-1.3.21}/wizata_dsapi/business_label.py +0 -0
- {wizata_dsapi-1.3.20 → wizata_dsapi-1.3.21}/wizata_dsapi/context.py +0 -0
- {wizata_dsapi-1.3.20 → wizata_dsapi-1.3.21}/wizata_dsapi/dataframe_toolkit.py +0 -0
- {wizata_dsapi-1.3.20 → wizata_dsapi-1.3.21}/wizata_dsapi/datapoint.py +0 -0
- {wizata_dsapi-1.3.20 → wizata_dsapi-1.3.21}/wizata_dsapi/datastore.py +0 -0
- {wizata_dsapi-1.3.20 → wizata_dsapi-1.3.21}/wizata_dsapi/ds_dataframe.py +0 -0
- {wizata_dsapi-1.3.20 → wizata_dsapi-1.3.21}/wizata_dsapi/dsapi_json_encoder.py +0 -0
- {wizata_dsapi-1.3.20 → wizata_dsapi-1.3.21}/wizata_dsapi/evaluation.py +0 -0
- {wizata_dsapi-1.3.20 → wizata_dsapi-1.3.21}/wizata_dsapi/execution.py +0 -0
- {wizata_dsapi-1.3.20 → wizata_dsapi-1.3.21}/wizata_dsapi/experiment.py +0 -0
- {wizata_dsapi-1.3.20 → wizata_dsapi-1.3.21}/wizata_dsapi/group_system.py +0 -0
- {wizata_dsapi-1.3.20 → wizata_dsapi-1.3.21}/wizata_dsapi/ilogger.py +0 -0
- {wizata_dsapi-1.3.20 → wizata_dsapi-1.3.21}/wizata_dsapi/insight.py +0 -0
- {wizata_dsapi-1.3.20 → wizata_dsapi-1.3.21}/wizata_dsapi/model_toolkit.py +0 -0
- {wizata_dsapi-1.3.20 → wizata_dsapi-1.3.21}/wizata_dsapi/models/__init__.py +0 -0
- {wizata_dsapi-1.3.20 → wizata_dsapi-1.3.21}/wizata_dsapi/models/common.py +0 -0
- {wizata_dsapi-1.3.20 → wizata_dsapi-1.3.21}/wizata_dsapi/paged_query_result.py +0 -0
- {wizata_dsapi-1.3.20 → wizata_dsapi-1.3.21}/wizata_dsapi/pipeline.py +0 -0
- {wizata_dsapi-1.3.20 → wizata_dsapi-1.3.21}/wizata_dsapi/pipeline_image.py +0 -0
- {wizata_dsapi-1.3.20 → wizata_dsapi-1.3.21}/wizata_dsapi/plot.py +0 -0
- {wizata_dsapi-1.3.20 → wizata_dsapi-1.3.21}/wizata_dsapi/plots/__init__.py +0 -0
- {wizata_dsapi-1.3.20 → wizata_dsapi-1.3.21}/wizata_dsapi/plots/common.py +0 -0
- {wizata_dsapi-1.3.20 → wizata_dsapi-1.3.21}/wizata_dsapi/request.py +0 -0
- {wizata_dsapi-1.3.20 → wizata_dsapi-1.3.21}/wizata_dsapi/script.py +0 -0
- {wizata_dsapi-1.3.20 → wizata_dsapi-1.3.21}/wizata_dsapi/scripts/__init__.py +0 -0
- {wizata_dsapi-1.3.20 → wizata_dsapi-1.3.21}/wizata_dsapi/scripts/common.py +0 -0
- {wizata_dsapi-1.3.20 → wizata_dsapi-1.3.21}/wizata_dsapi/solution_component.py +0 -0
- {wizata_dsapi-1.3.20 → wizata_dsapi-1.3.21}/wizata_dsapi/streamlit_utils.py +0 -0
- {wizata_dsapi-1.3.20 → wizata_dsapi-1.3.21}/wizata_dsapi/template.py +0 -0
- {wizata_dsapi-1.3.20 → wizata_dsapi-1.3.21}/wizata_dsapi/trigger.py +0 -0
- {wizata_dsapi-1.3.20 → wizata_dsapi-1.3.21}/wizata_dsapi/twin.py +0 -0
- {wizata_dsapi-1.3.20 → wizata_dsapi-1.3.21}/wizata_dsapi/twinregistration.py +0 -0
- {wizata_dsapi-1.3.20 → wizata_dsapi-1.3.21}/wizata_dsapi/wizard_function.py +0 -0
- {wizata_dsapi-1.3.20 → wizata_dsapi-1.3.21}/wizata_dsapi/wizard_request.py +0 -0
- {wizata_dsapi-1.3.20 → wizata_dsapi-1.3.21}/wizata_dsapi/words.py +0 -0
- {wizata_dsapi-1.3.20 → wizata_dsapi-1.3.21}/wizata_dsapi.egg-info/SOURCES.txt +0 -0
- {wizata_dsapi-1.3.20 → wizata_dsapi-1.3.21}/wizata_dsapi.egg-info/dependency_links.txt +0 -0
- {wizata_dsapi-1.3.20 → wizata_dsapi-1.3.21}/wizata_dsapi.egg-info/requires.txt +0 -0
- {wizata_dsapi-1.3.20 → wizata_dsapi-1.3.21}/wizata_dsapi.egg-info/top_level.txt +0 -0
|
@@ -12,6 +12,8 @@ def get_bool(obj, name: str):
|
|
|
12
12
|
class ModelInfo:
|
|
13
13
|
"""
|
|
14
14
|
define a pointer to a machine learning model.
|
|
15
|
+
|
|
16
|
+
:ivar model_type str: mlflow model flavour
|
|
15
17
|
"""
|
|
16
18
|
|
|
17
19
|
def __init__(self,
|
|
@@ -19,6 +21,7 @@ class ModelInfo:
|
|
|
19
21
|
twin_hardware_id: str = None,
|
|
20
22
|
property_name: str = None,
|
|
21
23
|
alias: str = None,
|
|
24
|
+
model_type: str = None,
|
|
22
25
|
file_format: str = 'pkl',
|
|
23
26
|
source: str = 'wizata'
|
|
24
27
|
):
|
|
@@ -28,6 +31,7 @@ class ModelInfo:
|
|
|
28
31
|
self.alias = alias
|
|
29
32
|
self.file_format = file_format
|
|
30
33
|
self.source = source
|
|
34
|
+
self.model_type = model_type
|
|
31
35
|
self.trained_model = None
|
|
32
36
|
self.scaler = None
|
|
33
37
|
|
|
@@ -68,6 +72,8 @@ class ModelInfo:
|
|
|
68
72
|
obj["property_name"] = self.property_name
|
|
69
73
|
if self.alias is not None:
|
|
70
74
|
obj["alias"] = self.alias
|
|
75
|
+
if self.model_type is not None:
|
|
76
|
+
obj["model_type"] = self.model_type
|
|
71
77
|
if self.file_format is not None:
|
|
72
78
|
obj["file_format"] = self.file_format
|
|
73
79
|
if self.source is not None:
|
|
@@ -86,6 +92,8 @@ class ModelInfo:
|
|
|
86
92
|
self.property_name = obj["property_name"]
|
|
87
93
|
if "alias" in obj.keys():
|
|
88
94
|
self.alias = obj["alias"]
|
|
95
|
+
if "model_type" in obj.keys():
|
|
96
|
+
self.model_type = obj["model_type"]
|
|
89
97
|
if "file_format" in obj.keys():
|
|
90
98
|
self.key = obj["file_format"]
|
|
91
99
|
if "source" in obj.keys():
|
|
@@ -192,13 +200,16 @@ class MLModelConfig(ApiDto):
|
|
|
192
200
|
:param hardware_id: provide a hardware id for this model if by_twin.
|
|
193
201
|
:return:
|
|
194
202
|
"""
|
|
203
|
+
if self.by_twin and hardware_id is None:
|
|
204
|
+
raise ValueError('hardware_id is required if by_twin to create a model info')
|
|
195
205
|
model_info = ModelInfo(
|
|
196
206
|
key=self.model_key,
|
|
197
207
|
twin_hardware_id=hardware_id,
|
|
198
208
|
property_name=self.property_name,
|
|
199
209
|
source=self.source,
|
|
200
210
|
alias=self.model_alias,
|
|
201
|
-
file_format=self.model_format
|
|
211
|
+
file_format=self.model_format,
|
|
212
|
+
model_type=self.model_type
|
|
202
213
|
)
|
|
203
214
|
return model_info
|
|
204
215
|
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "1.3.21"
|
|
@@ -23,7 +23,7 @@ from .api_dto import ApiDto, VarType
|
|
|
23
23
|
from .business_label import BusinessLabel
|
|
24
24
|
from .plot import Plot
|
|
25
25
|
from .request import Request
|
|
26
|
-
from .mlmodel import
|
|
26
|
+
from .mlmodel import ModelInfo, ModelList
|
|
27
27
|
from .experiment import Experiment
|
|
28
28
|
from .script import Script
|
|
29
29
|
from .execution import Execution, ExecutionStatus
|
|
@@ -590,15 +590,6 @@ class WizataDSAPIClient(ApiInterface):
|
|
|
590
590
|
return obj.script_id
|
|
591
591
|
else:
|
|
592
592
|
raise self.__raise_error(response)
|
|
593
|
-
if isinstance(obj, MLModel):
|
|
594
|
-
response = requests.put(self.__url() + "mlmodels/",
|
|
595
|
-
headers=self.__header(),
|
|
596
|
-
data=pickle.dumps(obj))
|
|
597
|
-
if response.status_code == 200:
|
|
598
|
-
obj.model_id = uuid.UUID(response.json()['id'])
|
|
599
|
-
return obj.model_id
|
|
600
|
-
else:
|
|
601
|
-
raise self.__raise_error(response)
|
|
602
593
|
if isinstance(obj, Template):
|
|
603
594
|
return self.upsert_template(obj.key, obj.name)
|
|
604
595
|
if isinstance(obj, Pipeline):
|
|
@@ -847,13 +838,6 @@ class WizataDSAPIClient(ApiInterface):
|
|
|
847
838
|
execution.script = self.get(script_name=script)
|
|
848
839
|
elif isinstance(script, Script):
|
|
849
840
|
execution.script = script
|
|
850
|
-
if ml_model is not None:
|
|
851
|
-
if isinstance(ml_model, uuid.UUID) or (isinstance(ml_model, str) and is_valid_uuid(ml_model)):
|
|
852
|
-
execution.ml_model = MLModel(ml_model)
|
|
853
|
-
elif isinstance(ml_model, str):
|
|
854
|
-
execution.ml_model = self.get(model_key=ml_model)
|
|
855
|
-
elif isinstance(ml_model, MLModel):
|
|
856
|
-
execution.ml_model = ml_model
|
|
857
841
|
if image is not None:
|
|
858
842
|
execution.pipeline_image_id = image
|
|
859
843
|
if isAnomalyDetection:
|
|
@@ -899,9 +883,6 @@ class WizataDSAPIClient(ApiInterface):
|
|
|
899
883
|
if "plots" in obj.keys():
|
|
900
884
|
for plot in obj["plots"]:
|
|
901
885
|
result_execution.plots.append(self.get(Plot(plot_id=plot["id"])))
|
|
902
|
-
if "models" in obj.keys():
|
|
903
|
-
for mlmodel in obj["models"]:
|
|
904
|
-
result_execution.models.append(self.get(MLModel(model_id=mlmodel["id"])))
|
|
905
886
|
if "resultDataframe" in obj.keys() and obj["resultDataframe"]["id"] is not None:
|
|
906
887
|
result_execution.output_ds_dataframe = self.get(DSDataFrame(df_id=obj["resultDataframe"]["id"]))
|
|
907
888
|
|
|
@@ -1104,7 +1085,7 @@ class WizataDSAPIClient(ApiInterface):
|
|
|
1104
1085
|
scaler=None,
|
|
1105
1086
|
has_anomalies: bool = False,
|
|
1106
1087
|
has_target_feat: bool = False,
|
|
1107
|
-
experiment_key = None) -> tuple[
|
|
1088
|
+
experiment_key = None) -> tuple[ModelInfo, pandas.DataFrame]:
|
|
1108
1089
|
"""
|
|
1109
1090
|
Register a Machine Learning model to Wizata.
|
|
1110
1091
|
Model is tested by the API against a sample dataframe.
|
|
@@ -1124,15 +1105,13 @@ class WizataDSAPIClient(ApiInterface):
|
|
|
1124
1105
|
elif df is None:
|
|
1125
1106
|
raise ValueError('A sample dataframe must be provided')
|
|
1126
1107
|
|
|
1127
|
-
|
|
1128
|
-
ml_model = MLModel()
|
|
1108
|
+
ml_model = ModelInfo(key=model_key)
|
|
1129
1109
|
ml_model.trained_model = train_model
|
|
1130
1110
|
if scaler is not None:
|
|
1131
1111
|
ml_model.scaler = scaler
|
|
1132
1112
|
ml_model.has_anomalies = has_anomalies
|
|
1133
1113
|
ml_model.has_target_feat = has_target_feat
|
|
1134
1114
|
ml_model.input_columns = df.columns
|
|
1135
|
-
ml_model.key = model_key
|
|
1136
1115
|
|
|
1137
1116
|
if experiment_key is not None:
|
|
1138
1117
|
ml_model.experimentId = self.get(experiment_key=experiment_key).experiment_id
|
|
@@ -1141,7 +1120,8 @@ class WizataDSAPIClient(ApiInterface):
|
|
|
1141
1120
|
result_df = predict(df, ml_model)
|
|
1142
1121
|
if result_df is not None:
|
|
1143
1122
|
ml_model.status = "valid"
|
|
1144
|
-
|
|
1123
|
+
#TODO: proper method to upload and download from registry to modify this one
|
|
1124
|
+
## self.upsert(ml_model)
|
|
1145
1125
|
return ml_model, result_df
|
|
1146
1126
|
else:
|
|
1147
1127
|
raise RuntimeError('no dataframe was generated by your model while testing predict capabilities')
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
__version__ = "1.3.20"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|