PairwiseRanker#
- class scikitplot.corpus.PairwiseRanker(score_func, *, greater_is_better=True, use_normalized_text=True, score_cutoff=None, name=None, kwargs=None)[source]#
Ranker built from a pairwise relevance function.
- Parameters:
- score_funccallable
score_func(query, text, **kwargs) -> float; finite values only.- greater_is_betterbool, default=True
Falsefor a distance: hits are scored-score_func(...).- use_normalized_textbool, default=True
Compare with a document’s
normalized_textwhen it has one.- score_cutofffloat or None, default=None
Drop hits whose (signed) score is below it.
- namestr or None, default=None
Recorded as
native_metric; defaults to the function name.- kwargsmapping or None, default=None
Fixed keyword arguments of
score_func.
- Parameters:
Notes
Build it with
make_pairwise_ranker, which validates the arguments.- __call__(query, documents, config)[source]#
Return the best
config.top_kdocuments forquery.- Parameters:
- querystr
Query text.
- documentssequence of CorpusDocument
Candidates.
- configRetrievalConfig
Supplies
top_k.
- Returns:
- list of RetrievalHit
match_mode="pairwise",native_scorethe raw value,native_metricthe function name,rankfrom 0.
- Raises:
- TypeError
If
score_funcreturns something other than a real number.- ValueError
If it returns a non-finite value, naming the document position.
- Parameters:
- Return type: