Path4.Mod2.b - Training Models with Scripts - Code to support Model Tracking with Jobs using MLFlow Flashcards

1
Q

le

Code that Lists all Experiments with MLFlow and what parameter to use if you want to limit those results.

A

Retrive N experiements or all by excluding the max_results parameter

Use mlflow.list_experiments. To limit, use the max_results parameter:

experiments = mlflow.list_experiments(max_results=10)
for exp in experiements:
    print(exp.name);
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

sr

Code that retrieves runs within a single Experiment

A

Retrive N experiements or all by excluding the max_results parameter

Use mlflow.search_runs, pass it the specific Experiment ID:

mlflow.search_runs(exp.experment_id)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

se

Code that searches for all Experiments by a certain ViewType

The three ViewTypes

A

Retrive N experiements or all by excluding the max_results parameter

Use mlflow.search_experiments, pass it the specific ViewType enum value via view_type parameter:

from mlflow.entities import ViewType

experiments = mlflow.search_experiments(view_type=ViewType.ALL)
for exp in experiments:
    print(exp.name)

ViewType: ACTIVE_ONLY DELETED_ONLY ALL

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

gebn

Code that gets an Experiment by name

A

Retrive N experiements or all by excluding the max_results parameter

Use mlflow.get_experiment_by_name (DUR!), pass it the desired Experiment’s name as a string:

exp = mlflow.get_experiment_by_name(experiment_name)
print(exp)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

The default field Experiments are ordered by on retrieval

A

start_time

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Code that customizes the order_by parameter for the mlflow.search_runs function

A

Give the order_by a query modifier:

mlflow.search_runs(exp.experiment_id, order_by=["attributes.start_time DESC"], max_results=2)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

order_by doesn’t support ordering expressions containing these three subexpressions, and the alternative if you want to sort those expressions

A

Expressions that contain wildcards, specfically metrics.*, params.* and tags.*

The alternative is to use the sort_values method from Pandas:

runs = mlflow.search_runs(experiment_ids=[ "1234-5678-90AB-CDEFG" ])
runs.sort_values("metrics.accuracy", ascending=False)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Code that searches for runs based on Hyperparameter values using the mlflow.search_runs function

The only three operators supported when filtering params

A

Give the filter_string parameter the name and value of the target Hyperparameter in syntax similar to FluxQL:

mlflow.search_runs(
    exp.experiment_id,
    filter_string="params.num_boost_round='100'", max_results=2)

Operator support: = != like

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Code that queries for runs using the mlflow.search_runs function

A

Give the filter_string parameter a straight-up full query that looks similar to FluxQL:

query = "metrics.AUC > 0.8 and tags.model_type = 'LogisticRegression'"
mlflow.search_runs(exp.experiment_id, filter_string=query)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly