mlflow.log_metric("foo", 4, step=2)
  mlflow.log_metric("foo", 6, step=3)


  # Log an artifact (output file)
  with open("output.txt", "w") as f:
      f.write("Hello world!")
  mlflow.log_artifact("output.txt")

# COMMAND ----------

# MAGIC %md ## Switch to Azure Machine Learning backend

# COMMAND ----------

workspace.get_mlflow_tracking_uri()

# COMMAND ----------

mlflow.get_tracking_uri()

# COMMAND ----------

# change to AML
mlflow.set_tracking_uri(workspace.get_mlflow_tracking_uri())
mlflow.get_tracking_uri()

# COMMAND ----------

# # revert changes back to databricks
# mlflow.set_tracking_uri('databricks')
Example #2
0
# COMMAND ----------

!pip install azureml-mlflow

# COMMAND ----------

run.wait_for_completion()

import mlflow

# Get best model from automl run
best_run, non_onnx_model = run.get_output()

artifact_path = experiment_name + "_artifact"

mlflow.set_tracking_uri(ws.get_mlflow_tracking_uri())
mlflow.set_experiment(experiment_name)

with mlflow.start_run() as run:
    # Save the model to the outputs directory for capture
    mlflow.sklearn.log_model(non_onnx_model, artifact_path)

    # Register the model to AML model registry
    mlflow.register_model("runs:/" + run.info.run_id + "/" + artifact_path, "satraining-nyc_taxi-20210525085738-Best")

# COMMAND ----------

# MAGIC %md
# MAGIC Model registry functionality is unavailable; got unsupported URI 'azureml://westeurope.experiments.azureml.net/mlflow/v1.0/subscriptions/f80606e5-788f-4dc3-a9ea-2eb9a7836082/resourceGroups/rg-synapse-training/providers/Microsoft.MachineLearningServices/workspaces/mlworkspace-training?' for model registry data storage. Supported URI schemes are: ['', 'file', 'databricks', 'http', 'https', 'postgresql', 'mysql', 'sqlite', 'mssql']. See https://www.mlflow.org/docs/latest/tracking.html#storage for how to run an MLflow server against one of the supported backend storage locations.

# COMMAND ----------