Advanced Tuning

class datarobot.models.advanced_tuning.AdvancedTuningSession(model)

A session enabling users to configure and run advanced tuning for a model.

Every model contains a set of one or more tasks. Every task contains a set of zero or more parameters. This class allows tuning the values of each parameter on each task of a model, before running that model.

This session is client-side only and is not persistent. Only the final model, constructed when run is called, is persisted on the DataRobot server.

Attributes:
descriptionstr

Description for the new advance-tuned model. Defaults to the same description as the base model.

get_task_names()

Get the list of task names that are available for this model

Returns:
list(str)

List of task names

Return type:

List[str]

get_parameter_names(task_name)

Get the list of parameter names available for a specific task

Returns:
list(str)

List of parameter names

Return type:

List[str]

set_parameter(value, task_name=None, parameter_name=None, parameter_id=None)

Set the value of a parameter to be used

The caller must supply enough of the optional arguments to this function to uniquely identify the parameter that is being set. For example, a less-common parameter name such as ‘building_block__complementary_error_function’ might only be used once (if at all) by a single task in a model. In which case it may be sufficient to simply specify ‘parameter_name’. But a more-common name such as ‘random_seed’ might be used by several of the model’s tasks, and it may be necessary to also specify ‘task_name’ to clarify which task’s random seed is to be set. This function only affects client-side state. It will not check that the new parameter value(s) are valid.

Parameters:
task_namestr

Name of the task whose parameter needs to be set

parameter_namestr

Name of the parameter to set

parameter_idstr

ID of the parameter to set

valueint, float, list, or str

New value for the parameter, with legal values determined by the parameter being set

Raises:
NoParametersFoundException

if no matching parameters are found.

NonUniqueParametersException

if multiple parameters matched the specified filtering criteria

Return type:

None

get_parameters()

Returns the set of parameters available to this model

The returned parameters have one additional key, “value”, reflecting any new values that have been set in this AdvancedTuningSession. When the session is run, “value” will be used, or if it is unset, “current_value”.

Returns:
parametersdict

“Parameters” dictionary, same as specified on Model.get_advanced_tuning_params.

An additional field is added per parameter to the ‘tuning_parameters’ list in the dictionary:
valueint, float, list, or str

The current value of the parameter. None if none has been specified.

Return type:

AdvancedTuningParamsType

run()

Submit this model for Advanced Tuning.

Returns:
datarobot.models.modeljob.ModelJob

The created job to build the model

Return type:

ModelJob