Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[NotForMerging]Add mlflow loader for glassbox models #123

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from

Conversation

eedeleon
Copy link
Contributor

@eedeleon eedeleon commented Apr 18, 2020

  • Add loader functions for mlflow log_model and load_model support.

Allows for operationalizing EBM along with all glassbox models that support explain_global.

Example:

import json
import os

import pytest

from sklearn.datasets import ,load_boston

from interpret.glassbox import ExplainableBoostingRegressor
from interpret.glassbox.mlflow import log_model


boston = load_boston()
glassbox_model_ebm = ExplainableBoostingRegressor(feature_names=boston.feature_names)

X, y = boston.data, boston.target

glassbox_model_ebm.fit(X, y)

log_model("ebm", glassbox_model_ebm)

import mlflow
run_id = mlflow.active_run().info.run_id

# Starts up the server with {"columns":columns, "data":data} as inputs with returned predict(data)
print("mlflow models serve -m runs:/{}/{} &".format(run_id, "ebm"))
pred_data = [[x.item() for x in row] for row in X[:2]]

# Wait until the service is running before executing the curl command
print("curl http://127.0.0.1:5000/invocations -H 'Content-Type: application/json' -d '{}'".format({"data": str(pred_data).replace("'", '"').replace(" ", "")}))
# [26.34637146659037, 22.031728888383835]

# The two printed commands can be copied into commandline to test the service.

Code follows a similar paradigm to: https://www.mlflow.org/docs/latest/models.html#example-creating-a-custom-add-n-model without enforcing interpret take a dependency on mlflow.

mlflow is a soft dependency to allow for an enhanced mlflow experience without affecting existing user experiences

Eduardo de Leon added 2 commits April 18, 2020 15:08
Signed-off-by: Eduardo de Leon <eddeleon@microsoft.com>
Signed-off-by: Eduardo de Leon <eddeleon@microsoft.com>
@eedeleon eedeleon force-pushed the eedeleon/add_mlflow_loader_for_glassbox_models branch from b897e28 to c0e9122 Compare April 18, 2020 19:08
@eedeleon eedeleon changed the title Eedeleon/add mlflow loader for glassbox models [WIP] add mlflow loader for glassbox models Apr 18, 2020
Signed-off-by: Eduardo de Leon <eddeleon@microsoft.com>
@eedeleon eedeleon force-pushed the eedeleon/add_mlflow_loader_for_glassbox_models branch from e2db6e4 to 37754d2 Compare April 21, 2020 00:48
@eedeleon eedeleon marked this pull request as ready for review April 21, 2020 21:15
@eedeleon eedeleon changed the title [WIP] add mlflow loader for glassbox models Add mlflow loader for glassbox models Apr 22, 2020
@eedeleon eedeleon changed the title Add mlflow loader for glassbox models [NotForMerging]Add mlflow loader for glassbox models Jun 11, 2020
@paulbkoch
Copy link
Collaborator

Hi @eedeleon -- I see this PR has been labeled "NotForMerging" for a while now. What's the current status?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants