utils¶
- class Classifier(*args, **kwargs)¶
Bases:
ProtocolProtocol for classifiers.
This protocol defines the methods that a classifier should implement.
See also
ClassifierMixinfor the classifier interface insklearn.- fit(*args, **kwargs)¶
- Return type:
Self
- fit_classifier(classifier, X, y, *, sample_weight=None, log=None)¶
Fit the given classifier to the given data.
- init_new_classifier(classifier, random_state)¶
Initialize a new classifier with the same parameters as the given classifier.
- Parameters:
classifier (
Classifier) – The classifier to copy the parameters from.random_state (
int|Generator|None) – The random state to use for the new classifier.
- Return type:
- to_predictions(y, y_proba, category_names, timestamps)¶
Convert the given predictions to a DataFrame.
- validate_predictions(predictions, annotations, *, on='predictions', key_columns=('group', 'actor', 'recipient'))¶
Validate the predictions or annotations.
This calculates the mean and maximum probabilities for each predicted interval and retrieves the corresponding ground truth category as the category of the annotated interval with the highest overlap (
on="predictions"), or correspondingly, the category of the predicted interval with the highest overlap (on="annotations").- Parameters:
- Return type:
- Returns:
The validated predictions or annotations.