Created
May 5, 2020 09:39
-
-
Save csiebler/117cc970bb23db45a659e71c9267ecf3 to your computer and use it in GitHub Desktop.
Prediction script example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import json | |
import os | |
import numpy as np | |
import pandas as pd | |
import joblib | |
# Your imports go here | |
# Update to your model's filename | |
model_filename = "model.pkl" | |
model_dir = "./" | |
print("Model dir:", model_dir) | |
print("Model filename:", model_filename) | |
model_path = os.path.join(model_dir, model_filename) | |
# Replace this line with your model loading code | |
model = joblib.load(model_path) | |
# Adapt this code with some sample data and also adapt prediction step | |
data = {...} # define some sample data | |
df = pd.DataFrame.from_dict(data) | |
proba = model.predict_proba(df) | |
result = {"predict_proba": proba.tolist()} | |
print(result) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment