Recipes¶
Recipes ¶
Interact with recipes in the Driverless AI server.
explainers
property
¶
explainers: ExplainerRecipes
Interact with explainer recipes in the Driverless AI server.
Returns:
individuals
property
¶
individuals: IndividualRecipes
Interact with individual recipes in the Driverless AI server.
Driverless AI version requirement
Requires Driverless AI server 1.10.2 or higher.
Returns:
models
property
¶
models: ModelRecipes
Interact with model recipes in the Driverless AI server.
Returns:
pre_transformers
property
¶
pre_transformers: PreTransformerRecipes
Interact with pre-transformer recipes in the Driverless AI server.
Returns:
scorers
property
¶
scorers: ScorerRecipes
Interact with scorer recipes in the Driverless AI server.
Returns:
transformers
property
¶
transformers: TransformerRecipes
Interact with transformer recipes in the Driverless AI server.
Returns:
create ¶
Creates a custom recipe in the Driverless AI server.
Parameters:
Returns:
-
Recipe
–Created custom recipe.
Example
recipe = client.recipes.create(
recipe="https://github.com/h2oai/driverlessai-recipes/blob/master/scorers/regression/explained_variance.py"
)
create_async ¶
Launches the creation of a custom recipe in the Driverless AI server.
Parameters:
Returns:
-
RecipeJob
–Started the custome recipe job.
Example
recipe_job = client.recipes.create_async(
recipe="https://github.com/h2oai/driverlessai-recipes/blob/master/scorers/regression/explained_variance.py"
)
DataRecipes ¶
Interact with data recipes in the Driverless AI server.
list ¶
list() -> Sequence[DataRecipe]
Retrieves data recipes in the Driverless AI server.
Returns:
-
Sequence[DataRecipe]
–Data recipes.
Example
# Get names of all data recipes.
data_recipes = [r.name for r in client.recipes.data.list()]
# Get custom data recipes.
custom_data_recipes = [
r for r in client.recipes.data.list() if r.is_custom
]
DataRecipe ¶
Bases: Recipe
A data recipe in the Driverless AI server.
code
property
¶
code: str
Python code of the custom recipe.
Driverless AI version requirement
Requires Driverless AI server 1.10.3 or higher.
Returns:
-
str
–
key
property
¶
key: str
Unique key of the recipe.
Driverless AI version requirement
Requires Driverless AI server 1.10.3 or higher.
Returns:
-
str
–
activate ¶
activate() -> Recipe
Activates the custom recipe if it is inactive, and returns the newly activated custom recipe.
Returns:
-
Recipe
–Activated custom recipe.
Raises:
-
InvalidOperationException
–If the recipe is a non-custom recipe.
-
InvalidStateException
–If the recipe is already active.
deactivate ¶
deactivate() -> None
Deactivates the custom recipe if it is active.
Raises:
-
InvalidOperationException
–If the recipe is a non-custom recipe.
-
InvalidStateException
–If the recipe is already inactive.
Driverless AI version requirement
Requires Driverless AI server 1.10.3 or higher.
ExplainerRecipes ¶
Interact with explainer recipes in the Driverless AI server.
list ¶
list() -> Sequence[ExplainerRecipe]
Retrieves explainer recipes in the Driverless AI server.
Example
# Get all binomial explainer recipes.
binomial_explainers = [
r for r in client.recipes.explainers.list() if r.for_binomial
]
# Get all multiclass explainer recipes.
multiclass_explainers = [
r for r in client.recipes.explainers.list() if r.for_multiclass
]
# Get all regression explainer recipes.
regression_explainers = [
r for r in client.recipes.explainers.list() if r.for_regression
]
# Get all IID explainer recipes.
iid_explainers = [
r for r in client.recipes.explainers.list() if r.for_iid
]
# Get all time series explainer recipes.
time_series_explainers = [
r for r in client.recipes.explainers.list() if r.for_timeseries
]
# Get all custom explainer recipes.
custom_explainers = [
r for r in client.recipes.explainers.list() if r.is_custom
]
ExplainerRecipe ¶
Bases: Recipe
An explainer recipe in the Driverless AI server.
code
property
¶
code: str
Python code of the custom recipe.
Driverless AI version requirement
Requires Driverless AI server 1.10.3 or higher.
Returns:
-
str
–
for_binomial
property
¶
for_binomial: bool
True
if explainer works for binomial models.
Returns:
-
bool
–
for_multiclass
property
¶
for_multiclass: bool
True
if explainer works for multiclass models.
Returns:
-
bool
–
for_regression
property
¶
for_regression: bool
True
if explainer works for regression models.
Returns:
-
bool
–
for_timeseries
property
¶
for_timeseries: bool
True
if explainer works for time series models.
Returns:
-
bool
–
key
property
¶
key: str
Unique key of the recipe.
Driverless AI version requirement
Requires Driverless AI server 1.10.3 or higher.
Returns:
-
str
–
activate ¶
activate() -> Recipe
Activates the custom recipe if it is inactive, and returns the newly activated custom recipe.
Returns:
-
Recipe
–Activated custom recipe.
Raises:
-
InvalidOperationException
–If the recipe is a non-custom recipe.
-
InvalidStateException
–If the recipe is already active.
deactivate ¶
deactivate() -> None
Deactivates the custom recipe if it is active.
Raises:
-
InvalidOperationException
–If the recipe is a non-custom recipe.
-
InvalidStateException
–If the recipe is already inactive.
Driverless AI version requirement
Requires Driverless AI server 1.10.3 or higher.
search_settings ¶
search_settings(
search_term: str = "",
show_description: bool = False,
show_dai_name: bool = False,
show_valid_values: bool = False,
) -> Table
Searches for explainer settings.
Parameters:
-
search_term
(str
, default:''
) –Case insensitive term to search for.
-
show_description
(bool
, default:False
) –Whether to include description of the setting in results.
-
show_dai_name
(bool
, default:False
) –Whether to include setting name used by the Driverless AI server.
-
show_valid_values
(bool
, default:False
) –Whether to include the valid values that can be set for each setting.
Returns:
-
Table
–Matching explainer settings in a table.
Example
results = explainer_recipe.search_settings(search_term)
print(results)
show_settings ¶
Displays the settings of the explainer with their corresponding values.
Parameters:
-
show_dai_name
(bool
, default:False
) –Whether to include setting name used by the Driverless AI server.
Returns:
-
Table
–Settings of the explainer in a table.
Example
settings = explainer_recipe.show_settings()
print(settings)
update_code ¶
Updates the code of the custom recipe and returns the newly created recipe with the updated code.
Returns:
-
Recipe
–Updated custom recipe.
Raises:
-
InvalidOperationException
–if the recipe is not a custom one.
with_settings ¶
with_settings(validate_value: bool = True, **kwargs: Any) -> ExplainerRecipe
Updates the settings of the explainer recipe.
Parameters:
-
validate_value
(bool
, default:True
) –Whether to validate new setting values or not.
-
kwargs
(Any
, default:{}
) –New explainer settings. Use driverlessai._recipes.ExplainerRecipe.search_settings to search for possible settings.
Returns:
-
ExplainerRecipe
–This explainer recipe.
IndividualRecipes ¶
Interact with individual recipes in the Driverless AI server.
list ¶
list() -> Sequence[IndividualRecipe]
Retrieves individual recipes in the Driverless AI server.
Returns:
-
Sequence[IndividualRecipe]
–Individual recipes.
Example
# Get all binary individual recipes.
binomial_individuals = [
r for r in client.recipes.individuals.list() if r.for_binary
]
# Get all multiclass individual recipes.
multiclass_individuals = [
r for r in client.recipes.individuals.list() if r.for_multiclass
]
# Get all regression individual recipes.
regression_individuals = [
r for r in client.recipes.individuals.list() if r.for_regression
]
# Get all custom individual recipes.
custom_individuals = [
r for r in client.recipes.individuals.list() if r.is_custom
]
IndividualRecipe ¶
Bases: Recipe
An individual recipe in the Driverless AI server.
code
property
¶
code: str
Python code of the custom recipe.
Driverless AI version requirement
Requires Driverless AI server 1.10.3 or higher.
Returns:
-
str
–
experiment_description
property
¶
experiment_description: str
Recipe experiment description.
Returns:
-
str
–
key
property
¶
key: str
Unique key of the recipe.
Driverless AI version requirement
Requires Driverless AI server 1.10.3 or higher.
Returns:
-
str
–
activate ¶
activate() -> Recipe
Activates the custom recipe if it is inactive, and returns the newly activated custom recipe.
Returns:
-
Recipe
–Activated custom recipe.
Raises:
-
InvalidOperationException
–If the recipe is a non-custom recipe.
-
InvalidStateException
–If the recipe is already active.
deactivate ¶
deactivate() -> None
Deactivates the custom recipe if it is active.
Raises:
-
InvalidOperationException
–If the recipe is a non-custom recipe.
-
InvalidStateException
–If the recipe is already inactive.
Driverless AI version requirement
Requires Driverless AI server 1.10.3 or higher.
ModelRecipes ¶
Interact with model recipes in the Driverless AI server.
list ¶
list() -> Sequence[ModelRecipe]
Retrieves model recipes in the Driverless AI server.
Returns:
-
Sequence[ModelRecipe]
–Model recipes.
Example
# Get all model recipes.
model_recipes = [
r for r in client.recipes.models.list() if r.for_regression
]
# Get all custom model recipes.
custom_model_recipes = [
r for r in client.recipes.models.list() if r.is_custom
]
ModelRecipe ¶
Bases: Recipe
A model recipe in the Driverless AI server.
code
property
¶
code: str
Python code of the custom recipe.
Driverless AI version requirement
Requires Driverless AI server 1.10.3 or higher.
Returns:
-
str
–
is_unsupervised
property
¶
is_unsupervised: bool
True
if recipe doesn't require a target column.
Returns:
-
bool
–
key
property
¶
key: str
Unique key of the recipe.
Driverless AI version requirement
Requires Driverless AI server 1.10.3 or higher.
Returns:
-
str
–
activate ¶
activate() -> Recipe
Activates the custom recipe if it is inactive, and returns the newly activated custom recipe.
Returns:
-
Recipe
–Activated custom recipe.
Raises:
-
InvalidOperationException
–If the recipe is a non-custom recipe.
-
InvalidStateException
–If the recipe is already active.
deactivate ¶
deactivate() -> None
Deactivates the custom recipe if it is active.
Raises:
-
InvalidOperationException
–If the recipe is a non-custom recipe.
-
InvalidStateException
–If the recipe is already inactive.
Driverless AI version requirement
Requires Driverless AI server 1.10.3 or higher.
ScorerRecipes ¶
Interact with scorer recipes in the Driverless AI server.
list ¶
list() -> Sequence[ScorerRecipe]
Retrieves scorer recipes in the Driverless AI server.
Returns:
-
Sequence[ScorerRecipe]
–Scorer recipes.
Example
# Get all binomial scorer recipes.
binomial_scorers = [
r for r in client.recipes.scorers.list() if r.for_binomial
]
# Get all multiclass scorer recipes.
multiclass_scorers = [
r for r in client.recipes.scorers.list() if r.for_multiclass
]
# Get all regression scorer recipes.
regression_scorers = [
r for r in client.recipes.scorers.list() if r.for_regression
]
# Get all custom scorer recipes.
custom_scorers = [r for r in client.recipes.scorers.list() if r.is_custom]
ScorerRecipe ¶
Bases: Recipe
A scorer recipe in the Driverless AI server.
code
property
¶
code: str
Python code of the custom recipe.
Driverless AI version requirement
Requires Driverless AI server 1.10.3 or higher.
Returns:
-
str
–
for_binomial
property
¶
for_binomial: bool
True
if scorer works for binomial models.
Returns:
-
bool
–
for_multiclass
property
¶
for_multiclass: bool
True
if scorer works for multiclass models.
Returns:
-
bool
–
for_regression
property
¶
for_regression: bool
True
if scorer works for regression models.
Returns:
-
bool
–
key
property
¶
key: str
Unique key of the recipe.
Driverless AI version requirement
Requires Driverless AI server 1.10.3 or higher.
Returns:
-
str
–
activate ¶
activate() -> Recipe
Activates the custom recipe if it is inactive, and returns the newly activated custom recipe.
Returns:
-
Recipe
–Activated custom recipe.
Raises:
-
InvalidOperationException
–If the recipe is a non-custom recipe.
-
InvalidStateException
–If the recipe is already active.
deactivate ¶
deactivate() -> None
Deactivates the custom recipe if it is active.
Raises:
-
InvalidOperationException
–If the recipe is a non-custom recipe.
-
InvalidStateException
–If the recipe is already inactive.
Driverless AI version requirement
Requires Driverless AI server 1.10.3 or higher.
TransformerRecipes ¶
Interact with transformer recipes in the Driverless AI server.
list ¶
list() -> Sequence[TransformerRecipe]
Retrieves transformer recipes in the Driverless AI server.
Returns:
-
Sequence[TransformerRecipe]
–Transformer recipes.
Example
```py
Get names of all transformers.¶
transformers = [r.name for r in client.recipes.transformers.list()]
Get custom transformers.¶
custom_transformers = [ r for r in client.recipes.transformers.list() if r.is_custom ]
```
TransformerRecipe ¶
Bases: Recipe
A transformer recipe in the Driverless AI server.
code
property
¶
code: str
Python code of the custom recipe.
Driverless AI version requirement
Requires Driverless AI server 1.10.3 or higher.
Returns:
-
str
–
key
property
¶
key: str
Unique key of the recipe.
Driverless AI version requirement
Requires Driverless AI server 1.10.3 or higher.
Returns:
-
str
–
activate ¶
activate() -> Recipe
Activates the custom recipe if it is inactive, and returns the newly activated custom recipe.
Returns:
-
Recipe
–Activated custom recipe.
Raises:
-
InvalidOperationException
–If the recipe is a non-custom recipe.
-
InvalidStateException
–If the recipe is already active.
deactivate ¶
deactivate() -> None
Deactivates the custom recipe if it is active.
Raises:
-
InvalidOperationException
–If the recipe is a non-custom recipe.
-
InvalidStateException
–If the recipe is already inactive.
Driverless AI version requirement
Requires Driverless AI server 1.10.3 or higher.
PreTransformerRecipes ¶
Interact with pre-transformer recipes in the Driverless AI server.
list ¶
list() -> Sequence[PreTransformerRecipe]
Retrieves pre-transformer recipes in the Driverless AI server.
Returns:
-
Sequence[PreTransformerRecipe]
–Pre-transformer recipes.
Example
```py
Get names of all pre-transformers.¶
pre_transformers = [r.name for r in client.recipes.pre_transformers.list()]
Get custom pre-transformers.¶
custom_pre_transformers = [ r for r in client.recipes.pre_transformers.list() if r.is_custom ]
```
PreTransformerRecipe ¶
Bases: Recipe
A pre-transformer recipe in the Driverless AI server.
code
property
¶
code: str
Python code of the custom recipe.
Driverless AI version requirement
Requires Driverless AI server 1.10.3 or higher.
Returns:
-
str
–
key
property
¶
key: str
Unique key of the recipe.
Driverless AI version requirement
Requires Driverless AI server 1.10.3 or higher.
Returns:
-
str
–
activate ¶
activate() -> Recipe
Activates the custom recipe if it is inactive, and returns the newly activated custom recipe.
Returns:
-
Recipe
–Activated custom recipe.
Raises:
-
InvalidOperationException
–If the recipe is a non-custom recipe.
-
InvalidStateException
–If the recipe is already active.
deactivate ¶
deactivate() -> None
Deactivates the custom recipe if it is active.
Raises:
-
InvalidOperationException
–If the recipe is a non-custom recipe.
-
InvalidStateException
–If the recipe is already inactive.
Driverless AI version requirement
Requires Driverless AI server 1.10.3 or higher.
RecipeJob ¶
Monitor the creation of a custom recipe in the Driverless AI server.
is_complete ¶
is_complete() -> bool
Whether the job has been completed successfully.
Returns:
-
bool
–True
if the job has been completed successfully, otherwiseFalse
.
is_running ¶
is_running() -> bool
Whether the job has been scheduled or is running, finishing, or syncing.
Returns:
-
bool
–True
if the job has not completed yet, otherwiseFalse
.
result ¶
Awaits the job's completion before returning the created custom recipe.
Parameters:
-
silent
(bool
, default:False
) –Whether to display status updates or not.
Returns:
-
Recipe | None
–Created custom recipe by the job.
Raises:
-
NotImplementedError
–If the recipe type is not implemented.
Recipe ¶
A recipe in the Driverless AI server.
code
property
¶
code: str
Python code of the custom recipe.
Driverless AI version requirement
Requires Driverless AI server 1.10.3 or higher.
Returns:
-
str
–
key
property
¶
key: str
Unique key of the recipe.
Driverless AI version requirement
Requires Driverless AI server 1.10.3 or higher.
Returns:
-
str
–
activate ¶
activate() -> Recipe
Activates the custom recipe if it is inactive, and returns the newly activated custom recipe.
Returns:
-
Recipe
–Activated custom recipe.
Raises:
-
InvalidOperationException
–If the recipe is a non-custom recipe.
-
InvalidStateException
–If the recipe is already active.
deactivate ¶
deactivate() -> None
Deactivates the custom recipe if it is active.
Raises:
-
InvalidOperationException
–If the recipe is a non-custom recipe.
-
InvalidStateException
–If the recipe is already inactive.
Driverless AI version requirement
Requires Driverless AI server 1.10.3 or higher.