Skip to content

Commit

Permalink
fix: Merge branch 'develop' of github.com:flamapy/fm_metamodel into d…
Browse files Browse the repository at this point in the history
…evelop
  • Loading branch information
jagalindo committed Jul 24, 2024
2 parents 774f2c5 + 8eaa1f8 commit 8769f51
Showing 1 changed file with 71 additions and 1 deletion.
72 changes: 71 additions & 1 deletion flamapy/metamodels/fm_metamodel/operations/fm_metrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,8 @@ def abstract_features(self) -> dict[str, Any]:
result=_abstract_features,
size=len(_abstract_features),
ratio=self.get_ratio(_abstract_features, self._features),
parent="Features",
level=1
)
return result

Expand All @@ -137,6 +139,8 @@ def concrete_features(self) -> dict[str, Any]:
result=_concrete_features,
size=len(_concrete_features),
ratio=self.get_ratio(_concrete_features, self._features),
parent="Features",
level=1
)
return result

Expand All @@ -151,6 +155,8 @@ def leaf_features(self) -> dict[str, Any]:
result=_leaf_features,
size=len(_leaf_features),
ratio=self.get_ratio(_leaf_features, self._features),
parent="Features",
level=1
)
return result

Expand All @@ -167,6 +173,8 @@ def compound_features(self) -> dict[str, Any]:
result=_compound_features,
size=len(_compound_features),
ratio=self.get_ratio(_compound_features, self._features),
parent="Features",
level=1
)
return result

Expand All @@ -187,6 +195,8 @@ def concrete_compound_features(self) -> dict[str, Any]:
ratio=self.get_ratio(
_concrete_compound_features, self.concrete_features()["result"]
),
parent="Concrete features",
level=2
)
return result

Expand All @@ -207,6 +217,8 @@ def concrete_leaf_features(self) -> dict[str, Any]:
ratio=self.get_ratio(
_concrete_leaf_features, self.concrete_features()["result"]
),
parent="Concrete features",
level=2
)
return result

Expand All @@ -227,6 +239,8 @@ def abstract_compound_features(self) -> dict[str, Any]:
ratio=self.get_ratio(
_abstract_compound_features, self._abstract_features.keys()
),
parent="Abstract features",
level=2
)
return result

Expand All @@ -247,6 +261,8 @@ def abstract_leaf_features(self) -> dict[str, Any]:
ratio=self.get_ratio(
_abstract_leaf_features, self._abstract_features.keys()
),
parent="Abstract features",
level=2
)
return result

Expand Down Expand Up @@ -280,6 +296,8 @@ def root_feature(self) -> dict[str, Any]:
result=_root_feature,
size=1,
ratio=self.get_ratio([_root_feature], self._features),
parent="Features",
level=1
)
return result

Expand All @@ -299,6 +317,8 @@ def top_features(self) -> dict[str, Any]:
result=_top_features,
size=len(_top_features),
ratio=self.get_ratio(_top_features, self._features),
parent="Root feature",
level=2
)
return result

Expand All @@ -320,6 +340,8 @@ def solitary_features(self) -> dict[str, Any]:
result=_solitary_features,
size=len(_solitary_features),
ratio=self.get_ratio(_solitary_features, self._features),
parent="Features",
level=1
)
return result

Expand All @@ -338,6 +360,8 @@ def grouped_features(self) -> dict[str, Any]:
result=_grouped_features,
size=len(_grouped_features),
ratio=self.get_ratio(_grouped_features, self._features),
parent="Features",
level=1
)
return result

Expand All @@ -357,6 +381,8 @@ def mandatory_features(self) -> dict[str, Any]:
ratio=self.get_ratio(
_mandatory_features, self.solitary_features()["result"]
),
parent="Tree relationships",
level=1
)
return result

Expand All @@ -376,6 +402,8 @@ def optional_features(self) -> dict[str, Any]:
ratio=self.get_ratio(
_optional_features, self.solitary_features()["result"]
),
parent="Tree relationships",
level=1
)
return result

Expand All @@ -394,6 +422,8 @@ def feature_groups(self) -> dict[str, Any]:
result=_feature_groups,
size=len(_feature_groups),
ratio=self.get_ratio(_feature_groups, _tree_relationships),
parent="Tree relationships",
level=1
)
return result

Expand All @@ -415,6 +445,8 @@ def alternative_groups(self) -> dict[str, Any]:
result=_alternative_groups,
size=len(_alternative_groups),
ratio=self.get_ratio(_alternative_groups, _group_features),
parent="Feature groups",
level=2
)
return result

Expand All @@ -434,6 +466,8 @@ def or_groups(self) -> dict[str, Any]:
result=_or_groups,
size=len(_or_groups),
ratio=self.get_ratio(_or_groups, _group_features),
parent="Feature groups",
level=2
)
return result

Expand All @@ -450,6 +484,8 @@ def mutex_groups(self) -> dict[str, Any]:
result=_mutex_groups,
size=len(_mutex_groups),
ratio=self.get_ratio(_mutex_groups, _group_features),
parent="Feature groups",
level=2
)
return result

Expand All @@ -468,6 +504,8 @@ def cardinality_groups(self) -> dict[str, Any]:
result=_cardinality_groups,
size=len(_cardinality_groups),
ratio=self.get_ratio(_cardinality_groups, _group_features),
parent="Feature groups",
level=2
)
return result

Expand Down Expand Up @@ -497,6 +535,8 @@ def min_children_per_feature(self) -> dict[str, Any]:
name=name,
doc=self.min_children_per_feature.__doc__,
result=_min_children_per_feature,
parent="Branching factor",
level=1
)
return result

Expand All @@ -512,6 +552,8 @@ def max_children_per_feature(self) -> dict[str, Any]:
name=name,
doc=self.max_children_per_feature.__doc__,
result=_max_children_per_feature,
parent="Branching factor",
level=1
)
return result

Expand All @@ -529,6 +571,8 @@ def avg_children_per_feature(self) -> dict[str, Any]:
name=name,
doc=self.avg_children_per_feature.__doc__,
result=_avg_children_per_feature,
parent="Branching factor",
level=1
)
return result

Expand All @@ -548,7 +592,9 @@ def max_depth_tree(self) -> dict[str, Any]:
name = "Max depth of tree"
_max_depth_tree = max(self._feature_ancestors)
result = self.construct_result(
name=name, doc=self.max_depth_tree.__doc__, result=_max_depth_tree
name=name, doc=self.max_depth_tree.__doc__, result=_max_depth_tree,
parent="Depth of tree",
level=1
)
return result

Expand All @@ -561,6 +607,8 @@ def mean_depth_tree(self) -> dict[str, Any]:
name=name,
doc=self.mean_depth_tree.__doc__,
result=round(_mean_depth_tree, 2),
parent="Depth of tree",
level=1
)
return result

Expand All @@ -573,6 +621,8 @@ def median_depth_tree(self) -> dict[str, Any]:
name=name,
doc=self.median_depth_tree.__doc__,
result=round(_median_depth_tree, 2),
parent="Depth of tree",
level=1
)
return result

Expand Down Expand Up @@ -606,6 +656,8 @@ def simple_constraints(self) -> dict[str, Any]:
result=_simple_constraints,
size=len(_simple_constraints),
ratio=self.get_ratio(_simple_constraints, self.model.get_constraints()),
parent="Cross-tree constraints",
level=1
)
return result

Expand All @@ -628,6 +680,8 @@ def requires_constraints(self) -> dict[str, Any]:
ratio=self.get_ratio(
_requires_constraints, self.model.get_simple_constraints()
),
parent="Simple constraints",
level=2
)
return result

Expand All @@ -650,6 +704,8 @@ def excludes_constraints(self) -> dict[str, Any]:
ratio=self.get_ratio(
_excludes_constraints, self.model.get_simple_constraints()
),
parent="Simple constraints",
level=2
)
return result

Expand All @@ -669,6 +725,8 @@ def complex_constraints(self) -> dict[str, Any]:
result=_complex_constraints,
size=len(_complex_constraints),
ratio=self.get_ratio(_complex_constraints, self.model.get_constraints()),
parent="Cross-tree constraints",
level=1
)
return result

Expand All @@ -690,6 +748,8 @@ def pseudo_complex_constraints(self) -> dict[str, Any]:
ratio=self.get_ratio(
_pseudocomplex_constraints, self.model.get_complex_constraints()
),
parent="Complex constraints",
level=2
)
return result

Expand All @@ -711,6 +771,8 @@ def strict_complex_constraints(self) -> dict[str, Any]:
ratio=self.get_ratio(
_strictcomplex_constraints, self.model.get_complex_constraints()
),
parent="Complex constraints",
level=2
)
return result

Expand All @@ -723,6 +785,8 @@ def min_constraints_per_feature(self) -> dict[str, Any]:
name=name,
doc=self.min_constraints_per_feature.__doc__,
result=min(_constraints_per_feature),
parent="Cross-tree constraints",
level=1
)
return result

Expand All @@ -735,6 +799,8 @@ def max_constraints_per_feature(self) -> dict[str, Any]:
name=name,
doc=self.max_constraints_per_feature.__doc__,
result=max(_constraints_per_feature),
parent="Cross-tree constraints",
level=1
)
return result

Expand All @@ -747,6 +813,8 @@ def avg_constraints_per_feature(self) -> dict[str, Any]:
name=name,
doc=self.avg_constraints_per_feature.__doc__,
result=round(statistics.mean(_constraints_per_feature), 2),
parent="Cross-tree constraints",
level=1
)
return result

Expand All @@ -767,5 +835,7 @@ def extra_constraint_representativeness(self) -> dict[str, Any]:
result=_features_in_constraints,
size=len(_features_in_constraints),
ratio=self.get_ratio(_features_in_constraints, self._features, 2),
parent="Cross-tree constraints",
level=1
)
return result

0 comments on commit 8769f51

Please sign in to comment.