CutPolicy#
- class scikitplot.corpus.CutPolicy(mode, threshold=None, min_k=1, max_k=None)[source]#
A rule for how many ranked hits to keep.
- Parameters:
- mode{“fixed”, “threshold”, “max_gap”}
- thresholdfloat or None, default=None
Required for
"threshold", in[0, 1]; refused otherwise.- min_kint, default=1
Fewest hits kept (when there are that many).
- max_kint or None, default=None
Most hits kept; required for
"fixed".
- Raises:
- ValueError
For an unknown mode, a missing or out-of-range threshold, a threshold given to another mode,
min_k < 0,max_k < min_k, or"fixed"withoutmax_k.
- Parameters:
Examples
>>> CutPolicy("max_gap").cut([0.9, 0.85, 0.8, 0.3, 0.25]).k 3 >>> CutPolicy("threshold", threshold=0.5).cut([0.9, 0.6, 0.4]).k 2
- apply(hits)[source]#
Keep the hits this policy keeps, scored by their
scoreattribute.- Parameters:
- hitssequence
Ranked hits with a
scoreattribute (RetrievalHit).
- Returns:
- list
The first
CutResult.khits.
- Parameters:
- Return type: