Skip to content

Instantly share code, notes, and snippets.

@csiebler
Created May 5, 2020 09:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save csiebler/117cc970bb23db45a659e71c9267ecf3 to your computer and use it in GitHub Desktop.
Save csiebler/117cc970bb23db45a659e71c9267ecf3 to your computer and use it in GitHub Desktop.
Prediction script example
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