Created
January 4, 2020 08:03
-
-
Save javierluraschi/78fba6bb7f5fa4d74e6af972a2bceedb to your computer and use it in GitHub Desktop.
Multiverse YouTube MLflow Intro
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
library(glmnet) | |
wine_file <- pins::pin("https://raw.githubusercontent.com/rstudio/mlflow-example/master/wine-quality.csv") | |
train <- read.csv(wine_file) | |
train_x <- as.matrix(train[, !(names(train) == "quality")]) | |
train_y <- train[, "quality"] | |
alpha <- mlflow_log_param("alpha", 0.7, "numeric") | |
lambda <- mlflow_log_param("lambda", 0.4, "numeric") | |
with(mlflow_start_run(), { | |
model <- glmnet(train_x, train_y, alpha = alpha, lambda = lambda, family = "gaussian") | |
predicted <- glmnet::predict.glmnet(model, train_x) | |
rmse <- sqrt(mean((predicted - train_y)^2)) | |
mae <- mean(abs(predicted - train_y)) | |
mlflow_log_metric("rmse", rmse) | |
mlflow_log_metric("mae", mae) | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment