seg1d.processing.Features.meaningful

static Features.meaningful(weights, limit=0.5, top=1000, include_keys=[])[source]

get a weight table of the most meaningful features

Parameters:
weightsDict{feature:score}
limitfloat, optional {0.5}

minimum threshold to include in weight table

topint, optional {1000}

after sorting by most relevant, return only the top number of features

include_keysList[str], optional

if provided, uses only the provided keys for the returned weight table. This is useful for ensuring the weight table only includes keys available in target and reference data.

Returns:
weight_tableDict{feature:score}

Notes

Considers negative correlation as ‘not important’.

Examples

>>> import seg1d.processing as process
>>> w = {'a': 0.1, 'b': 0.4, 'c': 0.2, 'd':0.8, 'e':0.9}
>>> r = process.Features.meaningful(w, limit=0.1)
>>> print(r)
{'e': 0.9, 'd': 0.8, 'b': 0.4, 'c': 0.2}
>>> r = process.Features.meaningful(w, limit=0.1, top=2)
>>> print(r)
{'e': 0.9, 'd': 0.8}
>>> r = process.Features.meaningful(w, limit=0.1, include_keys=['a','b','d'])
>>> print(r)
{'d': 0.8, 'b': 0.4}