Deriver

Ver. 1.0.1 (2024-05-10)

This module provides a stream task class Deriver to derive the data of instances.

class mlpro.bf.streams.tasks.deriver.Deriver(p_name: str = None, p_range_max=1, p_duplicate_data: bool = False, p_visualize: bool = False, p_logging=True, p_features: list = None, p_labels: list = None, p_derived_feature: Feature = None, p_derived_label: Label = None, p_order_derivative: int = 1, **p_kwargs)

Bases: StreamTask

This stream task extend the feature and label data of incoming instances with a derivation of a pre-selected feature.

Parameters:
  • p_name (str) – Optional name of the task. Default is None.

  • p_range_max (int) – Maximum range of asynchonicity. See class Range. Default is Range.C_RANGE_PROCESS.

  • p_duplicate_data (bool) – If True, instances will be duplicated before processing. Default = False.

  • p_visualize (bool) – Boolean switch for visualisation. Default = False.

  • p_logging – Log level (see constants of class Log). Default: Log.C_LOG_ALL

  • p_features (list) – The list of current features in the stream. Default = None.

  • p_labels (list) – The list of current labels in the stream. Default = None.

  • p_derived_feature (Feature) – A pre-selected feature that would like to be derived. Default = None.

  • p_derived_label (Feature) – A correspondig label of the derived feature. Default = None.

  • p_order_derivative (int) – The derivative of order n. Default = None.

  • p_kwargs (dict) – Further optional named parameters.

C_NAME = 'Deriver'
C_PLOT_STANDALONE: bool = True
_derive_data(p_inst: Instance)
_run(p_inst_new: set, p_inst_del: set)

Custom method that is called by method run().

Parameters:
  • p_inst_new (set) – Set of new stream instances to be processed.

  • p_inst_del (set) – Set of obsolete stream instances to be removed.

class mlpro.bf.streams.tasks.deriver.DerivativeFunction(p_name: str, p_id: int = None, p_type: int = None, p_unit_in: str = None, p_unit_out: str = None, p_dt: float = 0.01, p_logging=True, **p_args)

Bases: TransferFunction

_set_function_parameters(p_args) bool

This method provides a functionality to set the parameters of the transfer function.

Parameters:

p_args (dict) – set of parameters of the transfer function.

Returns:

true means no parameters are missing.

Return type:

bool

_custom_function(p_input, p_range)

This function represents the template to create a custom function and must be redefined.

Parameters:
  • p_input – input value.

  • p_range – range of the calculation. None means 0. Default: None.

Returns:

output value.

Return type:

float