Skip to content

Instantly share code, notes, and snippets.

@kylegallatin
Created July 28, 2022 14:32
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 kylegallatin/0e7b767dbb88a419d92bc9ac5b26aa82 to your computer and use it in GitHub Desktop.
Save kylegallatin/0e7b767dbb88a419d92bc9ac5b26aa82 to your computer and use it in GitHub Desktop.
def load_latest_model() -> sklearn.pipeline.Pipeline:
latest_model_path = pd.read_csv("metadata_store.csv").query("timestamp == timestamp.max()")["model_path"].values[0]
loaded_model = joblib.load(latest_model_path)
return loaded_model
def model_predict(user_id: str) -> float:
model = load_latest_model()
features = feature_store.get_user_feature(user_id)
return model.predict([[v for k,v in features.items() if k != "target"]])
model_predict("a27b0912-0cf8-11ed-899e-b29c4abd48f4")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment