Algorithm#

class tpcp.Algorithm[source]#

Base class for all algorithms.

All type-specific algorithm classes should inherit from this class and need to

  1. overwrite _action_method with the name of the actual action method of this class type

  2. implement a stub for the action method

If you want to create an optimizable algorithm, add a self_optimize or (self_optimize_with_info) method to your class. We do not provide a separate base class for that, as we can make no assumptions about the call signature of your custom self_optimize method. If you need an “optimizable” version for a group of algorithms you are working with, create a custom OptimizableAlgorithm class or OptimizableAlgorithmMixing that is specific to your algorithm.

Attributes:
_action_methods

The name(s) of the action method used by the child class

Methods

clone()

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

get_params([deep])

Get parameters for this algorithm.

set_params(**params)

Set the parameters of this Algorithm.

__init__(*args, **kwargs)#
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.

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.Algorithm#

Algorithms - A real world example: QRS-Detection

Algorithms - A real world example: QRS-Detection

The final QRS detection algorithms

The final QRS detection algorithms

Grid Search optimal Algorithm Parameter

Grid Search optimal Algorithm Parameter

Optimizable Pipelines

Optimizable Pipelines

GridSearchCV

GridSearchCV

Custom Optuna Optimizer

Custom Optuna Optimizer

Build-in Optuna Optimizers

Build-in Optuna Optimizers

Validation

Validation

Cross Validation

Cross Validation

Custom Scorer

Custom Scorer

Tensorflow/Keras

Tensorflow/Keras

Caching

Caching

Dataclass and Attrs support

Dataclass and Attrs support

Composite-Algorithms and Pipelines

Composite-Algorithms and Pipelines

TypedIterator

TypedIterator

Optimization Info

Optimization Info