Preprocessing
Ver. 1.5.2 (2024-12-11)
This module provides pool of boundary detector object further used in the context of online adaptivity.
- class mlpro.oa.streams.tasks.boundarydetector.BoundaryDetector(p_name: str = None, p_range_max=1, p_ada: bool = True, p_duplicate_data: bool = False, p_visualize: bool = False, p_logging=True, **p_kwargs)
Bases:
OAStreamTaskThis class provides the functionality of boundary observation of incoming instances. It raises event C_EVENT_ADAPTED when a change in the current boundaries is detected.
- Parameters:
p_name (str, Optional.) – Name of the task.
p_range_max – Processing range of the task. Default is thread.
p_ada (bool) – True if the task has adaptivity. Default is True.
p_duplicate_data (bool) – If True, instances will be duplicated before processing. Default = False.
p_visualize (bool) – True to turn on the visualization.
p_logging – Logging level for the task, default is Log all.
- C_NAME = 'Boundary Detector'
- C_PLOT_ND_XLABEL_FEATURE = 'Features'
- C_PLOT_ND_YLABEL = 'Boundaries'
- C_PLOT_STANDALONE: bool = True
- C_PLOT_VALID_VIEWS: list = ['ND']
- C_PLOT_DEFAULT_VIEW: str = 'ND'
- _adapt(p_inst_new: Instance) bool
Method to check if the new instances exceed the current boundaries of the Set.
- Parameters:
p_inst_new (Instance) – New instance/s added to the workflow
- Returns:
adapted – Returns true if there is a change of boundaries, false otherwise.
- Return type:
bool
- _run(p_inst: Dict[int, Tuple[str, Instance]])
Method to run the boundary detector task
- Parameters:
p_inst (InstDict) – Instances to be processed.
- _adapt_on_event(p_event_id: str, p_event_object: Event)
Event handler for Boundary Detector that adapts if the related event is raised.
- Parameters:
p_event_id – The event id related to the adaptation.
p_event_obj (Event) – The event object related to the raised event.
- Returns:
Returns true if adapted, false otherwise.
- Return type:
bool
- _init_plot_nd(p_figure: Figure, p_settings: PlotSettings)
Custom method to initialize plot for Boundary Detectors tasks for N-dimensional plotting.
- Parameters:
p_figure (Figure) – Figure to host the plot
p_settings (PlotSettings) – PlotSettings objects with specific settings for the plot
- _update_plot_nd(p_settings: PlotSettings, p_inst: Dict[int, Tuple[str, Instance]], **p_kwargs)
Default N-dimensional plotting implementation for Boundary Detector tasks. See class mlpro.bf.plot.Plottable for more details.
- Parameters:
p_settings (PlotSettings) – Object with further plot settings.
p_inst (InstDict) – Stream instances to be plotted.
p_kwargs (dict) – Further optional plot parameters.
Ver. 1.4.0 (2024-12-16)
This module provides implementation for adaptive normalizers for MinMax Normalization.
- class mlpro.oa.streams.tasks.normalizers.minmax.NormalizerMinMax(p_name: str = None, p_range_max=1, p_ada: bool = True, p_duplicate_data: bool = False, p_visualize: bool = False, p_logging=True, **p_kwargs)
Bases:
OAStreamTask,NormalizerMinMaxClass with functionality for adaptive normalization of instances using MinMax Normalization.
- Parameters:
p_name (str, optional) – Name of the task.
p_range_max – Processing range of the task, default is a Thread.
p_ada – True if the task has adaptivity, default is true.
p_duplicate_data (bool) – If True, instances will be duplicated before processing. Default = False.
p_visualize – True for visualization, false by default.
p_logging – Logging level of the task. Default is Log.C_LOG_ALL
p_kwargs – Additional task parameters
- C_NAME = 'Normalizer MinMax'
- _run(p_inst: Dict[int, Tuple[str, Instance]])
Runs MinMax Normalizer task for normalizing stream instances.
- Parameters:
p_inst (InstDict) – Instances to be processed
- _adapt_on_event(p_event_id: str, p_event_object: Event) bool
Custom method to adapt the MinMax normalizer parameters based on event raised by Boundary object for changed boundaries.
- Parameters:
p_event_id (str) – Event id of the raised event
p_event_obj (Event) – Event object that raises the corresponding event
- Returns:
adapted – Returns True, if the task has adapted. False otherwise.
- Return type:
bool
- _update_plot_data_2d()
Updates the 2d plot for Normalizer. Extended to renormalize the obsolete data on change of parameters.
- Parameters:
p_settings (PlotSettings) – Object with further plot settings.
p_inst (InstDict) – Stream instances to be plotted.
p_kwargs (dict) – Further optional plot parameters.
- _update_plot_data_3d()
Method to update the 3d plot for Normalizer. Extended to renormalize the obsolete data on change of parameters.
- Parameters:
p_settings (PlotSettings) – Object with further plot settings.
p_inst (InstDict) – Stream instances to be plotted.
p_kwargs (dict) – Further optional plot parameters.
- _update_plot_data_nd()
Method to update the nd plot for Normalizer. Extended to renormalize the obsolete data on change of parameters.
- Parameters:
p_settings (PlotSettings) – Object with further plot settings.
p_inst (InstDict) – Stream instances to be plotted.
p_kwargs (dict) – Further optional plot parameters.
Ver. 1.3.6 (2024-12-06)
This module provides implementation for adaptive normalizers for ZTransformation
- class mlpro.oa.streams.tasks.normalizers.ztrans.NormalizerZTransform(p_name: str = None, p_range_max=1, p_ada: bool = True, p_duplicate_data: bool = False, p_visualize=False, p_logging=True, **p_kwargs)
Bases:
OAStreamTask,NormalizerZTransOnline adaptive normalization of instances with Z-Transformation
- Parameters:
p_name (str, optional) – Name of the task.
p_range_max – Processing range of the task, default is a Thread.
p_ada – True if the task has adaptivity, default is true.
p_duplicate_data (bool) – If True, instances will be duplicated before processing. Default = False.
p_visualize – True for visualization, false by default.
p_logging – Logging level of the task. Default is Log.C_LOG_ALL
p_kwargs – Additional task parameters
- C_NAME = 'Normalizer Z Transform'
- _run(p_inst: Dict[int, Tuple[str, Instance]])
Custom method to for run Z-transform task for normalizing new instances and denormalizing deleted instances.
- Parameters:
p_inst (InstDict) – Stream instances to be processed
- _adapt(p_inst_new: Instance) bool
Custom method to for adapting of Z-transform parameters on new instances.
- Parameters:
p_inst_new (Instance) – Instance to be adapted on.
- Returns:
adapted – Returns True, if task has adapted.
- Return type:
bool
- _adapt_reverse(p_inst_del: Instance) bool
Custom method to for adapting of Z-transform parameters on deleted instances.
- Parameters:
p_inst_del (Instance) – Instance to be adapted on.
- Returns:
adapted – Returns True, if task has adapted.
- Return type:
bool
- _update_plot_data_2d()
Renormalizing the plot data.
- _update_plot_2d(p_settings: PlotSettings, p_inst: Dict[int, Tuple[str, Instance]], **p_kwargs)
Updates the 2d plot for Normalizer. Extended to renormalize the obsolete data on change of parameters.
- Parameters:
p_settings (PlotSettings) – Object with further plot settings.
p_inst (InstDict) – Stream instances to be plotted.
p_kwargs (dict) – Further optional plot parameters.
- _update_plot_data_3d()
- _update_plot_3d(p_settings: PlotSettings, p_inst: Dict[int, Tuple[str, Instance]], **p_kwargs)
Method to update the 3d plot for Normalizer. Extended to renormalize the obsolete data on change of parameters.
- Parameters:
p_settings (PlotSettings) – Object with further plot settings.
p_inst (InstDict) – Stream instances to be plotted.
p_kwargs (dict) – Further optional plot parameters.
- _update_plot_data_nd()
- _update_plot_nd(p_settings: PlotSettings, p_inst: Dict[int, Tuple[str, Instance]], **p_kwargs)
Method to update the nd plot for Normalizer. Extended to renormalize the obsolete data on change of parameters.
- Parameters:
p_settings (PlotSettings) – Object with further plot settings.
p_inst (InstDict) – Stream instances to be plotted.
p_kwargs (dict) – Further optional plot parameters.
- update_plot_data()
Updates the plot data.