Skip to content

Instantly share code, notes, and snippets.

@afcotroneo
Created July 18, 2021 03:53
Show Gist options
  • Select an option

  • Save afcotroneo/df9af8d24e4c41bcbba12d409c6f0cf1 to your computer and use it in GitHub Desktop.

Select an option

Save afcotroneo/df9af8d24e4c41bcbba12d409c6f0cf1 to your computer and use it in GitHub Desktop.
# get predictions
y_pred = RFtree.predict(test_features)
# compute accuracy metric, then log
R2_score = r2_score(test_labels, y_pred)
print("R2_Score: ", R2_score)
mlflow.log_metric("r2", R2_score)
# plot and save plot graphic linked to model run
xgb.plot_importance(gbtree)
plt.savefig("importance.png", dpi = 200, bbox_inches = "tight")
mlflow.log_artifact("importance.png")
# log model
mlflow.sklearn.log_model(RFtree, "model")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment