eonu / sequentia

Scikit-Learn compatible HMM and DTW based sequence machine learning algorithms in Python.

Home Page:https://pypi.org/project/sequentia/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Return class scores for KNNClassifier

eonu opened this issue · comments

Similarly to HMMClassifier, the predict() function should accept a return_scores argument and return the normalized score for each class in the k neighborhood of the sequence being predicted.

Suppose we have classes c_1, ..., c_n. When classifying a new input sequence, some subset of these classes will occur as labels of sequences in the k DTW-neighborhood of the new sequence.

For classes present in the neighborhood, we should calculate the scores/weightings and calculate the total per class (this is already done), then normalize so that the sum of these scores per class adds to one. For classes not present, the score should be zero.

Note: These scores should not be considered as true calibrated probabilities.

Implemented in #213.