Skip to content

Commit 729e72c

Browse files
committed
Notebook and example asset updates for pzmm
1 parent 8c30289 commit 729e72c

25 files changed

+343
-1966
lines changed
Binary file not shown.
Binary file not shown.

examples/data/hmeqModels/DecisionTreeClassifier/DecisionTreeClassifierScore.py

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,12 @@
1-
2-
31
import math
42
import pickle
53
import pandas as pd
64
import numpy as np
75

86
import settings
7+
from pathlib import Path
98

10-
11-
_thisModelFit
12-
13-
with open(settings.pickle_path + 'DecisionTreeClassifier.pickle', 'rb') as _pFile:
9+
with open(Path(settings.pickle_path) / 'DecisionTreeClassifier.pickle', 'rb') as _pFile:
1410
_thisModelFit = pickle.load(_pFile)
1511

1612
def scoreDecisionTreeClassifier(LOAN, MORTDUE, VALUE, YOJ, DEROG, DELINQ, CLAGE, NINQ, CLNO, DEBTINC):
@@ -20,7 +16,7 @@ def scoreDecisionTreeClassifier(LOAN, MORTDUE, VALUE, YOJ, DEROG, DELINQ, CLAGE,
2016
global _thisModelFit
2117
except NameError:
2218

23-
with open(settings.pickle_path + 'DecisionTreeClassifier.pickle', 'rb') as _pFile:
19+
with open(Path(settings.pickle_path) / 'DecisionTreeClassifier.pickle', 'rb') as _pFile:
2420
_thisModelFit = pickle.load(_pFile)
2521

2622
try:
@@ -39,9 +35,9 @@ def scoreDecisionTreeClassifier(LOAN, MORTDUE, VALUE, YOJ, DEROG, DELINQ, CLAGE,
3935
try:
4036
EM_EVENTPROBABILITY = float(prediction)
4137
except TypeError:
42-
# If the model expects non-binary responses, a TypeError will be raised.
43-
# The except block shifts the prediction to accept a non-binary response.
44-
EM_EVENTPROBABILITY = float(prediction[:,1])
38+
# If the prediction returns as a list of values or improper value type, a TypeError will be raised.
39+
# Attempt to handle the prediction output in the except block.
40+
EM_EVENTPROBABILITY = float(prediction[0])
4541

4642
if (EM_EVENTPROBABILITY >= 0.199496644295302):
4743
EM_CLASSIFICATION = '1'

examples/data/hmeqModels/DecisionTreeClassifier/ModelProperties.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,5 @@
1212
"eventProbVar": "EM_EVENTPROBABILITY",
1313
"modeler": "sasdemo",
1414
"tool": "Python 3",
15-
"toolVersion": "3.8.3"
15+
"toolVersion": "3.8.16"
1616
}

examples/data/hmeqModels/DecisionTreeClassifier/dmcas_fitstat.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -216,12 +216,12 @@
216216
"_RASE_": 0.0,
217217
"_NObs_": 4172,
218218
"_GINI_": 1.0,
219-
"_GAMMA_": 2.880334878688322,
219+
"_GAMMA_": 2.880334878656814,
220220
"_formattedPartition_": " 1",
221221
"_DataRole_": "TRAIN",
222222
"_MCE_": 0.0,
223223
"_ASE_": 0.0,
224-
"_MCLL_": 9.992007221626413e-16,
224+
"_MCLL_": 2.220446049250313e-16,
225225
"_KS_": 1.0,
226226
"_KSPostCutoff_": null,
227227
"_DIV_": 4172,
@@ -243,7 +243,7 @@
243243
"_DataRole_": "TEST",
244244
"_MCE_": 0.1470917225950783,
245245
"_ASE_": 0.1470917225950783,
246-
"_MCLL_": 5.0803882403500396,
246+
"_MCLL_": 5.301723065625175,
247247
"_KS_": 0.34052961140098437,
248248
"_KSPostCutoff_": null,
249249
"_DIV_": 1788,
Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
[
22
{
33
"name": "EM_EVENTPROBABILITY",
4-
"length": 1,
5-
"type": "string",
6-
"level": "nominal"
7-
},
8-
{
9-
"name": "EM_CLASSIFICATION",
104
"length": 8,
115
"type": "decimal",
126
"level": "interval"
7+
},
8+
{
9+
"name": "EM_CLASSIFICATION",
10+
"length": 1,
11+
"type": "string",
12+
"level": "nominal"
1313
}
1414
]
Binary file not shown.
Binary file not shown.

examples/data/hmeqModels/GradientBoosting/GradientBoostingScore.py

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,12 @@
1-
2-
31
import math
42
import pickle
53
import pandas as pd
64
import numpy as np
75

86
import settings
7+
from pathlib import Path
98

10-
11-
_thisModelFit
12-
13-
with open(settings.pickle_path + 'GradientBoosting.pickle', 'rb') as _pFile:
9+
with open(Path(settings.pickle_path) / 'GradientBoosting.pickle', 'rb') as _pFile:
1410
_thisModelFit = pickle.load(_pFile)
1511

1612
def scoreGradientBoosting(LOAN, MORTDUE, VALUE, YOJ, DEROG, DELINQ, CLAGE, NINQ, CLNO, DEBTINC):
@@ -20,7 +16,7 @@ def scoreGradientBoosting(LOAN, MORTDUE, VALUE, YOJ, DEROG, DELINQ, CLAGE, NINQ,
2016
global _thisModelFit
2117
except NameError:
2218

23-
with open(settings.pickle_path + 'GradientBoosting.pickle', 'rb') as _pFile:
19+
with open(Path(settings.pickle_path) / 'GradientBoosting.pickle', 'rb') as _pFile:
2420
_thisModelFit = pickle.load(_pFile)
2521

2622
try:
@@ -39,9 +35,9 @@ def scoreGradientBoosting(LOAN, MORTDUE, VALUE, YOJ, DEROG, DELINQ, CLAGE, NINQ,
3935
try:
4036
EM_EVENTPROBABILITY = float(prediction)
4137
except TypeError:
42-
# If the model expects non-binary responses, a TypeError will be raised.
43-
# The except block shifts the prediction to accept a non-binary response.
44-
EM_EVENTPROBABILITY = float(prediction[:,1])
38+
# If the prediction returns as a list of values or improper value type, a TypeError will be raised.
39+
# Attempt to handle the prediction output in the except block.
40+
EM_EVENTPROBABILITY = float(prediction[0])
4541

4642
if (EM_EVENTPROBABILITY >= 0.199496644295302):
4743
EM_CLASSIFICATION = '1'

examples/data/hmeqModels/GradientBoosting/ModelProperties.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,5 @@
1212
"eventProbVar": "EM_EVENTPROBABILITY",
1313
"modeler": "sasdemo",
1414
"tool": "Python 3",
15-
"toolVersion": "3.8.3"
15+
"toolVersion": "3.8.16"
1616
}

0 commit comments

Comments
 (0)