Skip to content

Commit 473edd9

Browse files
committed
Add updated model content for H2O model example.
1 parent 31aa548 commit 473edd9

File tree

8 files changed

+14
-22
lines changed

8 files changed

+14
-22
lines changed
659 Bytes
Binary file not shown.
Binary file not shown.

examples/data/hmeqModels/H2OBinaryGLM/outputVar.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
[
22
{
33
"name": "EM_CLASSIFICATION",
4-
"level": "interval",
5-
"type": "decimal",
6-
"length": 8
4+
"level": "nominal",
5+
"type": "string",
6+
"length": 1
77
},
88
{
9-
"name": "EM_PROBABILITY",
9+
"name": "EM_EVENTPROBABILITY",
1010
"level": "interval",
1111
"type": "decimal",
1212
"length": 8

examples/data/hmeqModels/H2OBinaryGLM/score_glmfit_binary.py

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,26 +4,22 @@
44
import numpy as np
55
from pathlib import Path
66

7-
import settings
8-
97
import h2o
108
import gzip
119
import shutil
1210
import os
1311

1412
h2o.init()
1513

16-
model = h2o.load(str(Path(settings.pickle_path) / glmfit.pickle))
14+
model = h2o.load(str(Path("/models/resources/viya/b3b0fcef-81d8-4da1-a78d-8284dbb590a8/glmfit.pickle")))
1715

1816
def score(LOAN, MORTDUE, VALUE, REASON, JOB, YOJ, DEROG, DELINQ, CLAGE, NINQ, CLNO, DEBTINC):
1917
"Output: EM_CLASSIFICATION, EM_EVENTPROBABILITY"
2018

2119
try:
2220
global model
2321
except NameError:
24-
model = h2o.load(str(Path(settings.pickle_path) / glmfit.pickle))
25-
26-
22+
model = h2o.load(str(Path("/models/resources/viya/b3b0fcef-81d8-4da1-a78d-8284dbb590a8/glmfit.pickle")))
2723

2824
try:
2925
if math.isnan(LOAN):
@@ -88,7 +84,7 @@ def score(LOAN, MORTDUE, VALUE, REASON, JOB, YOJ, DEROG, DELINQ, CLAGE, NINQ, CL
8884
columns=["LOAN", "MORTDUE", "VALUE", "REASON", "JOB", "YOJ", "DEROG", "DELINQ", "CLAGE", "NINQ", "CLNO", "DEBTINC"],
8985
dtype=float,
9086
index=[0])
91-
column_types = ['"LOAN" : "numeric"', '"MORTDUE" : "numeric"', '"VALUE" : "numeric"', '"REASON" : "string"', '"JOB" : "string"', '"YOJ" : "numeric"', '"DEROG" : "numeric"', '"DELINQ" : "numeric"', '"CLAGE" : "numeric"', '"NINQ" : "numeric"', '"CLNO" : "numeric"', '"DEBTINC" : "numeric"']
87+
column_types = {"LOAN" : "numeric", "MORTDUE" : "numeric", "VALUE" : "numeric", "REASON" : "string", "JOB" : "string", "YOJ" : "numeric", "DEROG" : "numeric", "DELINQ" : "numeric", "CLAGE" : "numeric", "NINQ" : "numeric", "CLNO" : "numeric", "DEBTINC" : "numeric"}
9288
h2o_array = h2o.H2OFrame(input_array, column_types=column_types)
9389
prediction = model.predict(h2o_array)
9490
prediction = h2o.as_list(prediction, use_pandas=False)
16 Bytes
Binary file not shown.
Binary file not shown.

examples/data/hmeqModels/H2OMOJOGLM/outputVar.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
[
22
{
33
"name": "EM_CLASSIFICATION",
4-
"level": "interval",
5-
"type": "decimal",
6-
"length": 8
4+
"level": "nominal",
5+
"type": "string",
6+
"length": 1
77
},
88
{
9-
"name": "EM_PROBABILITY",
9+
"name": "EM_EVENTPROBABILITY",
1010
"level": "interval",
1111
"type": "decimal",
1212
"length": 8

examples/data/hmeqModels/H2OMOJOGLM/score_glmfit_mojo.py

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,26 +4,22 @@
44
import numpy as np
55
from pathlib import Path
66

7-
import settings
8-
97
import h2o
108
import gzip
119
import shutil
1210
import os
1311

1412
h2o.init()
1513

16-
model = h2o.import_mojo(str(Path(settings.pickle_path) / glmfit.mojo))
14+
model = h2o.import_mojo(str(Path("/models/resources/viya/1758598b-cff6-4993-9ac2-8199d4ec6564/glmfit.mojo")))
1715

1816
def score(LOAN, MORTDUE, VALUE, REASON, JOB, YOJ, DEROG, DELINQ, CLAGE, NINQ, CLNO, DEBTINC):
1917
"Output: EM_CLASSIFICATION, EM_EVENTPROBABILITY"
2018

2119
try:
2220
global model
2321
except NameError:
24-
model = h2o.import_mojo(str(Path(settings.pickle_path) / glmfit.mojo))
25-
26-
22+
model = h2o.import_mojo(str(Path("/models/resources/viya/1758598b-cff6-4993-9ac2-8199d4ec6564/glmfit.mojo")))
2723

2824
try:
2925
if math.isnan(LOAN):
@@ -88,7 +84,7 @@ def score(LOAN, MORTDUE, VALUE, REASON, JOB, YOJ, DEROG, DELINQ, CLAGE, NINQ, CL
8884
columns=["LOAN", "MORTDUE", "VALUE", "REASON", "JOB", "YOJ", "DEROG", "DELINQ", "CLAGE", "NINQ", "CLNO", "DEBTINC"],
8985
dtype=float,
9086
index=[0])
91-
column_types = ['"LOAN" : "numeric"', '"MORTDUE" : "numeric"', '"VALUE" : "numeric"', '"REASON" : "string"', '"JOB" : "string"', '"YOJ" : "numeric"', '"DEROG" : "numeric"', '"DELINQ" : "numeric"', '"CLAGE" : "numeric"', '"NINQ" : "numeric"', '"CLNO" : "numeric"', '"DEBTINC" : "numeric"']
87+
column_types = {"LOAN" : "numeric", "MORTDUE" : "numeric", "VALUE" : "numeric", "REASON" : "string", "JOB" : "string", "YOJ" : "numeric", "DEROG" : "numeric", "DELINQ" : "numeric", "CLAGE" : "numeric", "NINQ" : "numeric", "CLNO" : "numeric", "DEBTINC" : "numeric"}
9288
h2o_array = h2o.H2OFrame(input_array, column_types=column_types)
9389
prediction = model.predict(h2o_array)
9490
prediction = h2o.as_list(prediction, use_pandas=False)

0 commit comments

Comments
 (0)