<jupyter_start><jupyter_text>MLflow Project Example      <img src="https://raw.githubusercontent.com/dmatrix/mlflow-workshop-part-2/master/images/project.png"         alt="Bank Note " width="400">  An MLflow Project is a format for packaging data science code in a reusable and reproducible way, based primarily on conventions. In addition, the Projects component includes an API and command-line tools for running projects, making it possible to chain together projects into workflows.You can run projects as:* From command line: ```mlflow run git:// -P = ... -P =```* In GitHub Repo: ``` cd ; mlflow run . -e  -P = ... -P =```* Programmatically: ``` mlflow.run("git://", parameters={'arg':value, 'arg':value})```* Programmatically: ``` mlflow.projects.run("git://", parameters={'arg':value, 'arg':value})```  What's does a MLflow Project Look Like?[MLflow Project Example](https://github.com/mlflow/mlflow-example) * MLProject * conda.yaml * code ... * data<jupyter_code>import mlflow
import warnings
from mlflow import projects
print(mlflow.__version__)<jupyter_output>1.10.0<jupyter_text>Configure databricks CLIWe have to configure the credentials here only for Databricks notebooks. On a localhost this step is unecessary. Define arguments for alpha<jupyter_code>parameters = [{'alpha': 0.3}]
ml_project_uri = "git://github.com/mlflow/mlflow-example.git"<jupyter_output><empty_output><jupyter_text>Use MLflow Fluent API * [mlflow.run(...)](https://mlflow.org/docs/latest/python_api/mlflow.htmlmlflow.run) * Returns [SubmittedRun](https://mlflow.org/docs/latest/python_api/mlflow.projects.htmlmlflow.projects.SubmittedRunhttps://mlflow.org/docs/latest/python_api/mlflow.projects.htmlmlflow.projects.SubmittedRunhttps://mlflow.org/docs/latest/python_api/mlflow.projects.htmlmlflow.projects.SubmittedRun) object<jupyter_code>warnings.filterwarnings("ignore", category=DeprecationWarning)
# Iterate over three different runs with different parameters
for param in parameters:
  print(f"Running with param = {param}"),
  res_sub = mlflow.run(ml_project_uri, parameters=param)
  print(f"status={res_sub.get_status()}")
  print(f"run_id={res_sub.run_id}")<jupyter_output>2020/08/18 14:37:59 INFO mlflow.projects.utils: === Fetching project from git://github.com/mlflow/mlflow-example.git into /<KEY> ===<jupyter_text>Use MLflow Project API * [mlflow.projects.run(...)](https://mlflow.org/docs/latest/python_api/mlflow.projects.htmlmlflow.projects.run) * Returns [SubmittedRun](https://mlflow.org/docs/latest/python_api/mlflow.projects.htmlmlflow.projects.SubmittedRun) object<jupyter_code>warnings.filterwarnings("ignore", category=DeprecationWarning)
# Iterate over three different runs with different parameters
for param in parameters:
  print(f"Running with param = {param}"),
  res_sub = projects.run(ml_project_uri, parameters=param)
  print(f"status={res_sub.get_status()}")
  print(f"run_id={res_sub.run_id}")<jupyter_output>2020/08/18 14:39:08 INFO mlflow.projects.utils: === Fetching project from git://github.com/mlflow/mlflow-example.git into /<KEY> ===<jupyter_text>Check the MLflow UI * Add Notes & Tags * Compare Runs pick two best runs * Annotate with descriptions and tags * Evaluate the best run * Check for conda.yaml * Check for Metrics<jupyter_code>!mlflow ui<jupyter_output>[2020-08-18 14:39:53 -0700] [2814] [INFO] Starting gunicorn 20.0.4
[2020-08-18 14:39:53 -0700] [2814] [INFO] Listening at: http://127.0.0.1:5000 (2814)
[2020-08-18 14:39:53 -0700] [2814] [INFO] Using worker: sync
[2020-08-18 14:39:53 -0700] [2821] [INFO] Booting worker with pid: 2821
{'fraction_non_alphanumeric': 0.14098269123394752, 'fraction_numerical': 0.0413176996091569, 'mean_word_length': 5.798861480075901, 'pattern_counts': {'":': 0, '<': 20, '<?xml version=': 0, '>': 20, 'https://': 8, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 1, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '5', 'dir': 'jupyter-structured-clean-dedup', 'id': '371692', 'license': 'Apache-2.0', 'n_tokens_mistral': 1276, 'n_tokens_neox': 1170, 'n_words': 269, 'path': 'projects/notebooks/jupyter/1_run_project_example.ipynb', 'repo_name': 'dmatrix/olt-mlflow', 'size': '3690'}