diff --git a/src/mlpro/bf/math/properties.py b/src/mlpro/bf/math/properties.py index 683f86fc3..6e808737d 100644 --- a/src/mlpro/bf/math/properties.py +++ b/src/mlpro/bf/math/properties.py @@ -32,10 +32,11 @@ ## -- 2024-06-03 1.0.1 DA Method Properties.update_plot(): changed order of plotting ## -- 2024-06-05 1.1.0 DA New method Properties.replace_property() ## -- 2024-06-06 1.2.0 DA New custom method Properties._update_property_links() +## -- 2024-06-16 1.3.0 DA New method Properties.get_property_definitions() ## ------------------------------------------------------------------------------------------------- """ -Ver. 1.2.0 (2024-06-06) +Ver. 1.3.0 (2024-06-16) This module provides a systematics for enriched managed properties. MLPro's enriched properties store any data like class attributes and they can be used like class attributes. They extend the @@ -272,6 +273,7 @@ def __init__( self, p_visualize : bool = False ): self._properties = {} + self._property_definitions = {} self.add_properties( p_property_definitions = self.C_PROPERTIES, p_visualize = p_visualize ) self.add_properties( p_property_definitions = p_properties, p_visualize = p_visualize ) self._update_property_links() @@ -310,6 +312,7 @@ def add_property( self, p_value_prev = p_value_prev, p_visualize = p_visualize ) self._properties[p_name] = (prop_obj, False) + self._property_definitions[p_name] = ( p_name, p_derivative_order_max, p_value_prev, p_cls ) setattr(self, p_name, prop_obj ) @@ -348,6 +351,20 @@ def get_properties(self): """ return self._properties + + +## ------------------------------------------------------------------------------------------------- + def get_property_definitions(self) -> PropertyDefinitions: + """ + Returns a list of currently stored property definitions. + + Returns + ------- + PropertyDefinitions + List of property definitions + """ + + return list(self._property_definitions.values()) ## ------------------------------------------------------------------------------------------------- diff --git a/src/mlpro/oa/streams/tasks/clusteranalyzers/basics.py b/src/mlpro/oa/streams/tasks/clusteranalyzers/basics.py index c3267e120..1fda8b9a5 100644 --- a/src/mlpro/oa/streams/tasks/clusteranalyzers/basics.py +++ b/src/mlpro/oa/streams/tasks/clusteranalyzers/basics.py @@ -35,10 +35,11 @@ ## -- - renamed attributes C_MS_SCOPE_* to C_RESULT_SCOPE_* ## -- - new method _get_cluster_relations() ## -- - new method get_cluster_influences() +## -- 2024-06-16 1.2.1 DA Bugfix in ClusterAnalyzer.align_cluster_properties() ## ------------------------------------------------------------------------------------------------- """ -Ver. 1.2.0 (2024-06-08) +Ver. 1.2.1 (2024-06-16) This module provides a template class for online cluster analysis. """ @@ -72,7 +73,7 @@ class ClusterAnalyzer (OATask): - Specify all cluster properties provided/maintained by your algorithm in C_CLUSTER_PROPERTIES. - Implement method self._adapt() to update your cluster list on new instances - Implement method self._adapt_reverse() to update your cluster list on obsolete instances - - New cluster: hand over self._cluster_properties on instantiation + - New cluster: hand over self._cluster_properties.values() on instantiation Parameters ---------- @@ -149,10 +150,9 @@ def __init__( self, self._cluster_limit = p_cluster_limit self._next_cluster_id : ClusterId = -1 - self._cluster_properties : PropertyDefinitions = self.C_CLUSTER_PROPERTIES.copy() - self._cluster_properties_dict = {} - for prop in self._cluster_properties: - self._cluster_properties_dict[prop[0]] = prop + self._cluster_properties = {} + for prop in self.C_CLUSTER_PROPERTIES: + self._cluster_properties[prop[0]] = prop ## ------------------------------------------------------------------------------------------------- @@ -175,9 +175,10 @@ def align_cluster_properties( self, p_properties : PropertyDefinitions ) -> list for p_ext in p_properties: try: - p_int = self._cluster_properties_dict[p_ext[0]] + p_int = self._cluster_properties[p_ext[0]] p_int[1] = p_ext[1] # alignment of maximum order of derivatives - p_int[2] = p_ext[2] # alignment of property class + p_int[2] = p_ext[2] # alignment of storage of previous values + p_int[3] = p_ext[3] # alignment of property class except: # Property not supported by cluster algorithm unknown_properties.append(p_ext[0]) @@ -316,6 +317,7 @@ def _get_cluster_relations( self, if cluster_max_results is not None: list_results_abs.append( cluster_max_results ) + sum_results = cluster_max_results[1] # 2 Determination of relative result values according to the required scope