You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Computes the distances thresholds that the classification must match to
meet a fixed target.
Args
target_labels
Sequence of expected labels for the lookups.
lookup
Sequence of lookup results as produced by the
Index.batch_lookup() method.
thresholds_targets
classification metrics thresholds that are
targeted. The function will find the closed distance value.
calibration_metric
Classification metric used for calibration.
matcher
'match_nearest', 'match_majority_vote' or
ClassificationMatch object. Defines the classification matching,
e.g., match_nearest will count a True Positive if the query_label
is equal to the label of the nearest neighbor and the distance is
less than or equal to the distance threshold.
extra_metrics
Additional classification metrics that should be
computed and reported as part of the calibration. Defaults to [].
distance_rounding
How many digit to consider to
decide if the distance changed. Defaults to 8.
metric_rounding
How many digit to consider to decide if
the metric changed. Defaults to 6.
verbose
Be verbose. Defaults to 1.
Returns
CalibrationResults containing the thresholds and cutpoints Dicts.
Compute the classification metrics given a set of queries, lookups, and
distance thresholds.
Args
query_labels
Sequence of expected labels for the lookups.
lookup_labels
A 2D tensor where the jth row is the labels
associated with the set of k neighbors for the jth query.
lookup_distances
A 2D tensor where the jth row is the distances
between the jth query and the set of k neighbors.
distance_thresholds
A 1D tensor denoting the distances points at
which we compute the metrics.
metrics
The set of classification metrics.
matcher
'match_nearest', 'match_majority_vote' or
ClassificationMatch object. Defines the classification matching,
e.g., match_nearest will count a True Positive if the query_label
is equal to the label of the nearest neighbor and the distance is
less than or equal to the distance threshold.
distance_rounding
How many digit to consider to
decide if the distance changed. Defaults to 8.
verbose
Be verbose. Defaults to 1.
Returns
A Mapping from metric name to the list of values computed for each
distance threshold.