sorbetto.performance package

class sorbetto.performance.AbstractPerformance(name: str)[source]

Bases: ABC

abstract getMassFunction() ndarray[source]
property name: str
class sorbetto.performance.AbstractScore(default_name: str, default_abbreviation: str | None, default_symbol: str | None, name: str | None = None, abbreviation: str | None = None, symbol: str | None = None)[source]

Bases: ABC

property abbreviation: str | None
property longLabel: str
property name: str
rename(name: str | None = None, abbreviation: str | None = None, symbol: str | None = None) None[source]

Set the name, abbreviation, and symbol of the score. It is not allowed to set the abbreviation or symbol without giving a name too.

Parameters:
  • name (str | None, optional) – the new name. Defaults to None.

  • abbreviation (str | None, optional) – the new abbreviation. Defaults to None.

  • symbol (str | None, optional) – the new symbol. Defaults to None.

Raises:

ValueError – if name is None and abbreviation or symbol are not None.

property shortLabel: str
property symbol: str | None
class sorbetto.performance.ConstraintFixedClassPriors(priorPos: float)[source]

Bases: object

getPriorNeg()[source]
getPriorPos()[source]
class sorbetto.performance.ConstraintFixedPredictionRates(ratePos: float)[source]

Bases: object

getRateNeg()[source]
getRatePos()[source]
class sorbetto.performance.FiniteSetOfTwoClassClassificationPerformances(performance_list: list[TwoClassClassificationPerformance] | ndarray, name: str = 'finite set')[source]

Bases: object

drawInROC(fig: Figure, ax: Axes)[source]
static from_array(array_tn_fp_fn_tp)[source]
getMean() TwoClassClassificationPerformance[source]

The mean is know as the summarized performance Piérard and Van Droogenbroeck [18] as well as Fawcett’s interpolated performance Fawcett [7].

getRange(score) tuple[float, float][source]
property name: str
property performance_list: list[TwoClassClassificationPerformance]
property pfn: ndarray
property pfp: ndarray
property ptn: ndarray
property ptp: ndarray
update_probabilities()[source]
class sorbetto.performance.TwoClassClassificationPerformance(ptn: float, pfp: float, pfn: float, ptp: float, name: str | None = None)[source]

Bases: AbstractPerformance

A two-class (crisp) classification performance \(P\) is a probability measure over the measurable space \((\Omega,\Sigma)\) where the sample (a.k.a. universe) is \(\Omega=\{tn,fp,fn,tp\}\) and the event space is \(\Sigma=2^\Omega\). By convention, \(tn\), \(fp\), \(fn\), and \(tp\) represent the four cases that can arise: a true negative, a false positive, a false negative, and a true positive, respectively. The four elementary probability measures \(P(\{tn\})\), \(P(\{fp\})\), \(P(\{fn\})\), and \(P(\{tp\})\) are the elements of the normalized confusion matrix.

See Piérard et al. [17] for more information on this topic.

static buildFromRankingScoreValues(name, *pairsOfRankingScoresAndValues) TwoClassClassificationPerformance[source]
drawInROC(fig: Figure, ax: Axes) None[source]

See https://en.wikipedia.org/wiki/Receiver_operating_characteristic

Parameters:
  • fig (Figure) – _description_

  • ax (Axes) – _description_

getMassFunction() ndarray[source]
static getNoSkill(*, priorNeg: float | None = None, priorPos: float | None = None, rateNeg: float | None = None, ratePos: float | None = None, name: str | None = None) Self[source]
isAboveNoSkills() bool[source]
isBelowNoSkills() bool[source]
isNoSkill() bool[source]
property pfn: float

The probability of a false negative, \(P( \{ fn \} )\).

Returns:

The probability of a false negative, \(P( \{ fn \} )\).

Return type:

float

property pfp: float

The probability of a false positive, \(P( \{ fp \} )\).

Returns:

The probability of a false positive, \(P( \{ fp \} )\).

Return type:

float

property ptn: float

The probability of a true negative, \(P( \{ tn \} )\).

Returns:

The probability of a true negative, \(P( \{ tn \} )\).

Return type:

float

property ptp: float

The probability of a true positive, \(P( \{ tp \} )\).

Returns:

The probability of a true positive, \(P( \{ tp \} )\).

Return type:

float

tol = 1e-10

Subpackages

Submodules