eli5.sklearn_crfsuite

explain_weights_sklearn_crfsuite(crf, top=20, target_names=None, targets=None, feature_re=None, feature_filter=None)[source]

Explain sklearn_crfsuite.CRF weights.

See eli5.explain_weights() for description of top, target_names, targets, feature_re and feature_filter parameters.

filter_transition_coefs(transition_coef, indices)[source]
>>> coef = np.array([[0, 1, 2], [3, 4, 5], [6, 7, 8]])
>>> filter_transition_coefs(coef, [0])
array([[0]])
>>> filter_transition_coefs(coef, [1, 2])
array([[4, 5],
       [7, 8]])
>>> filter_transition_coefs(coef, [2, 0])
array([[8, 6],
       [2, 0]])
>>> filter_transition_coefs(coef, [0, 1, 2])
array([[0, 1, 2],
       [3, 4, 5],
       [6, 7, 8]])
sorted_for_ner(crf_classes)[source]

Return labels sorted in a default order suitable for NER tasks:

>>> sorted_for_ner(['B-ORG', 'B-PER', 'O', 'I-PER'])
['O', 'B-ORG', 'B-PER', 'I-PER']