hfs.HNB

class hfs.HNB(hierarchy=None, k=0)[source]

Select the k non-redundant features with the highest relevance following the algorithm proposed by Wan and Freitas.

__init__(hierarchy=None, k=0)[source]

Initializes a HNB-Selector.

Parameters
hierarchynp.ndarray

The hierarchy graph as an adjacency matrix.

kint

The numbers of features to select.

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. It selects the top-k-ranked features, such that redundancy along each path is removed, in descending order of their individual predictive power measured by their relevance 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.

Examples using hfs.HNB

Lazy learning

Lazy learning