mlflow_run: Run an MLflow Project

Description Usage Arguments Value Examples

View source: R/project-run.R

Description

Wrapper for the 'mlflow run' CLI command. See https://www.mlflow.org/docs/latest/cli.html#mlflow-run for more info.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
mlflow_run(
  uri = ".",
  entry_point = NULL,
  version = NULL,
  parameters = NULL,
  experiment_id = NULL,
  experiment_name = NULL,
  backend = NULL,
  backend_config = NULL,
  no_conda = FALSE,
  storage_dir = NULL
)

Arguments

uri

A directory containing modeling scripts, defaults to the current directory.

entry_point

Entry point within project, defaults to 'main' if not specified.

version

Version of the project to run, as a Git commit reference for Git projects.

parameters

A list of parameters.

experiment_id

ID of the experiment under which to launch the run.

experiment_name

Name of the experiment under which to launch the run.

backend

Execution backend to use for run.

backend_config

Path to JSON file which will be passed to the backend. For the Databricks backend, it should describe the cluster to use when launching a run on Databricks.

no_conda

If specified, assume that MLflow is running within a Conda environment with the necessary dependencies for the current project instead of attempting to create a new Conda environment. Only valid if running locally.

storage_dir

Valid only when 'backend' is local. MLflow downloads artifacts from distributed URIs passed to parameters of type 'path' to subdirectories of 'storage_dir'.

Value

The run associated with this run.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
## Not run: 
# This parametrized script trains a GBM model on the Iris dataset and can be run as an MLflow
# project. You can run this script (assuming it's saved at /some/directory/params_example.R)
# with custom parameters via:
# mlflow_run(entry_point = "params_example.R", uri = "/some/directory",
#   parameters = list(num_trees = 200, learning_rate = 0.1))
install.packages("gbm")
library(mlflow)
library(gbm)
# define and read input parameters
num_trees <- mlflow_param(name = "num_trees", default = 200, type = "integer")
lr <- mlflow_param(name = "learning_rate", default = 0.1, type = "numeric")
# use params to fit a model
ir.adaboost <- gbm(Species ~., data=iris, n.trees=num_trees, shrinkage=lr)

## End(Not run)

mlflow documentation built on Sept. 6, 2021, 9:06 a.m.