fhswf / MLPro

MLPro - The Integrative Middleware Framework for Standardized Machine Learning in Python
https://mlpro.readthedocs.io/
Apache License 2.0
12 stars 3 forks source link

Bug: Deriver should take over feature and label space from the first instance #1031

Closed detlefarend closed 2 months ago

detlefarend commented 2 months ago

1 Describe the bug The class bf.streams.tasks.Deriver carries out an early definition of it's internal feature and label space in the constructor. Especially, class bf.math.Set is used as the underlying set (see lines 96,111). The problem with it occurs in stream tasks that carry out spatial distance computations using feature_data.get_related_set().distance() (e.g. oa.streams.tasks.clusteranalyzers.clusters.centroid.py, line 96). To do this, the instance should provide a metric space with an implementation of the mentioned method. The consequence is that the stream class needs to provide proper metric spaces. The processing tasks, in turn, should take over this space from the first instance. That was the reason for one of my recent refactorings in class Rearranger and all stream classes (exchanged Set() by ESpace()).

Long story short: the Deriver should set up the internal feature and label spaces based on the sets of the first instance (see Rearranger).

howto_bf_streams_131_stream_task_deriver.py can be used to fix this problem. The howto shows a further problem also: in lines 94 and 110, there is an illegal access to protected attributes. Since Rearrange has been refactored, protected attribute _feature_space is no longer initialized after creation of an object. An alternative specification of features to be derived is needed.

2 To Reproduce Steps to reproduce the behavior:

  1. Run howto_bf_streams_131_stream_task_deriver.py

3 Expected behavior A clear and concise description of what you expected to happen.

4 Screenshots If applicable, add screenshots to help explain your problem.

5 Additional Informations

5.1 Operating System

steveyuwono commented 2 months ago

Hi @detlefarend , I have updated the deriver in the branch "bf/oa/streams/refact." To review the changes, refer to the pull request "OA: Refactoring Streams #1032." This includes updates to the Deriver class, its related documentation, and its class diagram. If you have time, please review the changes and provide feedback on any areas that may need improvement. Thank you!

detlefarend commented 2 months ago

Hi @detlefarend , I have updated the deriver in the branch "bf/oa/streams/refact." To review the changes, refer to the pull request "OA: Refactoring Streams #1032." This includes updates to the Deriver class, its related documentation, and its class diagram. If you have time, please review the changes and provide feedback on any areas that may need improvement. Thank you!

Hi @steveyuwono, I'll take a look asap and let you know.