Document How to Generate Prediction Contributions from an Existing MOJO

Description

Let’s update the following page to also include code snippets in pysparkling and scala on how to get the prediction contributions from an already existing mojo.

Here is an example for pysparkling:

{code}

from pysparkling.ml import *

path = '/Users/laurend/GBM_model_python_1567046427048_53.zip' # path to my mojo

settings = H2OMOJOSettings(withDetailedPredictionCol=True)
model = H2OMOJOModel.createFromMojo(path, settings)

predictions = model.transform(testingDF) # testingDF is type pyspark.sql.dataframe.DataFrame


predictions.select("detailed_prediction.contributions").show()

{code}

Status

Assignee

Jakub Hava

Reporter

Lauren DiPerna

Labels

None

CustomerVisible

No

testcase 1

None

testcase 2

None

testcase 3

None

h2ostream link

None

Affected Spark version

None

AffectedContact

None

AffectedCustomers

None

AffectedPilots

None

AffectedOpenSource

None

Support Assessment

None

Customer Request Type

None

Support ticket URL

None

End date

None

Baseline start date

None

Baseline end date

None

Task progress

None

Task mode

None

Fix versions

Priority

Major
Configure