Skip to content

Commit fa499fc

Browse files
authored
Merge branch 'master' into model_cards
2 parents 48d2ab5 + 28a3e22 commit fa499fc

File tree

4 files changed

+19
-24
lines changed

4 files changed

+19
-24
lines changed

src/sasctl/_services/model_repository.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -359,10 +359,9 @@ def create_model(
359359

360360
model["scoreCodeType"] = score_code_type or model.get("scoreCodeType")
361361
model["trainTable"] = training_table or model.get("trainTable")
362-
model[
363-
"classificationEventProbabilityVariableName"
364-
] = event_prob_variable or model.get(
365-
"classificationEventProbabilityVariableName"
362+
model["classificationEventProbabilityVariableName"] = (
363+
event_prob_variable
364+
or model.get("classificationEventProbabilityVariableName")
366365
)
367366
model["classificationTargetEventValue"] = event_target_value or model.get(
368367
"classificationTargetEventValue"

src/sasctl/pzmm/mlflow_model.py

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,14 +39,20 @@ def read_mlflow_model_file(cls, m_path=Path.cwd()):
3939
var_dict = {
4040
"python_version": m_yml["flavors"]["python_function"]["python_version"],
4141
"model_path": m_yml["flavors"]["python_function"]["model_path"],
42-
"serialization_format": m_yml["flavors"]["sklearn"]["serialization_format"],
42+
"serialization_format": m_yml["flavors"]["sklearn"][
43+
"serialization_format"
44+
],
4345
"run_id": m_yml["run_id"],
44-
"mlflowPath": m_path
46+
"mlflowPath": m_path,
4547
}
4648
except KeyError:
47-
raise ValueError("This MLFlow model type is not currently supported.") from None
49+
raise ValueError(
50+
"This MLFlow model type is not currently supported."
51+
) from None
4852
except TypeError:
49-
raise ValueError("This MLFlow model type is not currently supported.") from None
53+
raise ValueError(
54+
"This MLFlow model type is not currently supported."
55+
) from None
5056

5157
# Read in the input and output variables
5258
try:
@@ -57,5 +63,5 @@ def read_mlflow_model_file(cls, m_path=Path.cwd()):
5763
"Improper or unset signature values for model. No input or output "
5864
"dicts could be generated. "
5965
) from None
60-
66+
6167
return var_dict, inputs_dict, outputs_dict

src/sasctl/pzmm/write_json_files.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -877,9 +877,9 @@ def assess_model_bias(
877877
# run assessBias, if levels=None then assessBias treats the input like a regression problem
878878
tables = conn.fairaitools.assessbias(
879879
modelTableType="None",
880-
predictedVariables=pred_values
881-
if pred_values is not None
882-
else prob_values,
880+
predictedVariables=(
881+
pred_values if pred_values is not None else prob_values
882+
),
883883
response=actual_values,
884884
responseLevels=levels,
885885
sensitiveVariable=x,
@@ -1294,6 +1294,7 @@ def calculate_model_statistics(
12941294
.to_dict()
12951295
)
12961296
json_dict[0]["data"][i]["dataMap"].update(fitstat_dict)
1297+
12971298
if target_type == 'classification':
12981299
roc_df = pd.DataFrame(conn.CASTable("ROC", caslib="Public").to_frame())
12991300
roc_dict = cls.apply_dataframe_to_json(json_dict[1]["data"], i, roc_df)
@@ -1308,6 +1309,7 @@ def calculate_model_statistics(
13081309
"_Gamma_": roc_dict[j]["dataMap"]["_Gamma_"],
13091310
"_Tau_": roc_dict[j]["dataMap"]["_Tau_"]
13101311
}
1312+
13111313
json_dict[0]["data"][i]["dataMap"].update(fitstat_data)
13121314

13131315
lift_df = pd.DataFrame(conn.CASTable("Lift", caslib="Public").to_frame())

src/sasctl/pzmm/write_score_code.py

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -475,19 +475,7 @@ def _write_imports(
475475
import tensorflow as tf
476476
477477
"""
478-
elif binary_string:
479-
cls.score_code += (
480-
f'import codecs\n\nbinary_string = "{binary_string}"'
481-
f"\nmodel = {pickle_type}.loads(codecs.decode(binary_string"
482-
'.encode(), "base64"))\n\n'
483-
)
484-
"""
485-
import codecs
486478

487-
binary_string = "<binary string>"
488-
model = pickle.load(codecs.decode(binary_string.encode(), "base64"))
489-
490-
"""
491479

492480
@classmethod
493481
def _viya35_model_load(

0 commit comments

Comments
 (0)