Skip to content

Instantly share code, notes, and snippets.

@elijahbenizzy
Created June 26, 2024 18:01
Show Gist options
  • Save elijahbenizzy/ccfca4ea76a1041154f7d59a8f0ebf00 to your computer and use it in GitHub Desktop.
Save elijahbenizzy/ccfca4ea76a1041154f7d59a8f0ebf00 to your computer and use it in GitHub Desktop.
with mlflow.start_run():
lr = ElasticNet(alpha=alpha, l1_ratio=l1_ratio, random_state=42)
lr.fit(train_x, train_y)
predicted_qualities = lr.predict(test_x)
(rmse, mae, r2) = eval_metrics(test_y, predicted_qualities)
mlflow.log_param("alpha", alpha)
mlflow.log_param("l1_ratio", l1_ratio)
mlflow.log_metric("rmse", rmse)
mlflow.log_metric("r2", r2)
mlflow.log_metric("mae", mae)
mlflow.sklearn.log_model(lr, "model", registered_model_name="ElasticnetWineModel")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment