Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

register_model within an estimator does not include experiment/runID in Model Repository #400

Open
buswrecker opened this issue Oct 26, 2020 · 0 comments
Assignees

Comments

@buswrecker
Copy link

Describe the bug
When registering a model within an estimator run, the register_model function does not include the current runID or experiment in the model repository.

image

To Reproduce
Inside train.R

# This script loads a dataset of which the last column is supposed to be the
# class and logs the accuracy

library(azuremlsdk)
library(caret)
library(optparse)


options <- list(
    make_option(c("-d", "--data_folder"))
)

opt_parser <- OptionParser(option_list = options)
opt <- parse_args(opt_parser)

paste(opt$data_folder)

all_data <- read.csv(file.path(opt$data_folder, "iris.csv"))
summary(all_data)

in_train <- createDataPartition(y = all_data$Species, p = .8, list = FALSE)
train_data <- all_data[in_train, ]
test_data <- all_data[-in_train, ]

# Run algorithms using 10-fold cross validation
control <- trainControl(method = "cv", number = 10)
metric <- "Accuracy"

set.seed(7)
model <- train(Species ~ .,
               data = train_data,
               method = "lda",
               metric = metric,
               trControl = control)
predictions <- predict(model, test_data)
conf_matrix <- confusionMatrix(predictions, test_data$Species)
message(conf_matrix)

log_metric_to_run(metric, conf_matrix$overall["Accuracy"])

dir.create('outputs')
saveRDS(model, file = "./outputs/model.rds")

dir('outputs')
message("Model saved")

run <- get_current_run()
ws <- run$experiment$workspace

model <- register_model(ws, model_path = "./outputs/model.rds", model_name = "modelwithinestimator.rds",
                        tags=list("type"="remotecompute", "who"="julian"), description="julian-test-model")

message("Model registered to workspace")

train.R is called within an estimator as follows

est <- estimator(source_directory = ".",
                 entry_script = "train.R",
                 script_params = list("--data_folder" = ds$path(target_path)),
                 compute_target = compute_target,
                 environment = refreshEnvironment)

experiment_name <- "train-r-script-on-registermodel"
exp <- experiment(ws, experiment_name)

# Submit job and display the run details
run <- submit_experiment(exp, est)

Expected behavior
ExperimentID and RunID should be included when register_model is executed (similar to python)

image

Screenshots
If applicable, add screenshots to help explain your problem.

Additional context
Add any other context about the problem here.

@diondrapeck diondrapeck self-assigned this Jan 19, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants