hfs.MR¶
- class hfs.MR(hierarchy=None)[source]¶
Select non-redundant features with the highest relevance on each path following the algorithm proposed by Wan and Freitas
- __init__(hierarchy=None)[source]¶
Initialize a LazyHierarchicalFeatureSelector with the required data.
- Parameters
- hierarchynp.ndarray
The hierarchy graph as an adjacency matrix.
- select_and_predict(predict=True, saveFeatures=False, estimator=BernoulliNB())[source]¶
Select features lazy for each test instance amd optionally predict target value of test instances. The features are selected such that for each path only the most relevant features are preserved following the relevance score defined in helpers.py.
- Parameters
- predictbool
true if predictions shall be obtained
- saveFeaturesbool
true if features selected for each test instance shall be saved.
- estimatorsklearn-compatible estimator
Estimator to use for predictions
- Returns
- predictions for test input samples, if predict = false, returns empty array