mlflow (version 1.0.0)

mlflow_run: Run an MLflow Project

Description

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

Usage

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

Run this code
# 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)
# }
# NOT RUN {

# }

Run the code above in your browser using DataCamp Workspace