DummyOptimize#

class tpcp.optimize.DummyOptimize(pipeline: PipelineT, *, ignore_potential_user_error_warning: bool = False)[source]#

Provide API compatibility for SimplePipelines in optimize wrappers.

This is a simple dummy Optimizer that will not optimize anything, but just provide the correct API so that pipelines that do not have the possibility to be optimized can be passed to wrappers like tpcp.validate.cross_validate.

Parameters:
pipeline

The pipeline to wrap. It will not be optimized in any way, but simply copied to self.optimized_pipeline_ if optimize is called.

ignore_potential_user_error_warning

If True, the warning about using a pipeline that implements self_optimize with DummyOptimize will be ignored. Only use this, if you are sure about what you are doing.

Other Parameters:
dataset

The dataset used for optimization. As no optimization is performed, this will be ignored.

Attributes:
optimized_pipeline_

The optimized version of the pipeline. In case of this class, this is just an unmodified clone of the input pipeline.

Methods

clone()

Create a new instance of the class with all parameters copied over.

get_params([deep])

Get parameters for this algorithm.

optimize(dataset, **optimize_params)

Run the "dummy" optimization.

run(datapoint)

Run the optimized pipeline.

safe_run(datapoint)

Run the optimized pipeline.

set_params(**params)

Set the parameters of this Algorithm.

__init__(pipeline: PipelineT, *, ignore_potential_user_error_warning: bool = False) None[source]#
clone() Self[source]#

Create a new instance of the class with all parameters copied over.

This will create a new instance of the class itself and all nested objects

get_params(deep: bool = True) dict[str, Any][source]#

Get parameters for this algorithm.

Parameters:
deep

Only relevant if object contains nested algorithm objects. If this is the case and deep is True, the params of these nested objects are included in the output using a prefix like nested_object_name__ (Note the two “_” at the end)

Returns:
params

Parameter names mapped to their values.

optimize(dataset: DatasetT, **optimize_params: Any) Self[source]#

Run the “dummy” optimization.

Parameters:
dataset

The parameter is ignored, as no real optimization is performed

optimize_params

The parameter is ignored, as no real optimization is performed

Returns:
self

The class instance with all result attributes populated

run(datapoint: DatasetT) PipelineT[source]#

Run the optimized pipeline.

This is a wrapper to contain API compatibility with Pipeline.

safe_run(datapoint: DatasetT) PipelineT[source]#

Run the optimized pipeline.

This is a wrapper to contain API compatibility with Pipeline.

set_params(**params: Any) Self[source]#

Set the parameters of this Algorithm.

To set parameters of nested objects use nested_object_name__para_name=.

Examples using tpcp.optimize.DummyOptimize#

Advanced cross-validation

Advanced cross-validation