sorbetto.parameterization.abstract_parameterization module
- class sorbetto.parameterization.abstract_parameterization.AbstractParameterization[source]
Bases:
ABCThis is the base class for all possible ways of mapping ranking scores (or, equivalently, importance values, tha is some application-related preferences) onto Tiles. All ranking scores inducing the same performance ordering should be mapped to the same point. It is recommended that the subclasses implement continuous mappings between the four importance values and the two parameters. Also, it is recommended that (1) the ranking scores giving no importance at all to the true positives are mapped to points on the left border (minimal value for the first parameter), (2) the ranking scores giving no importance at all to the true negatives are mapped to points on the right border (maximal value for the first parameter), (3) the ranking scores giving no importance at all to the false positives are mapped to points on the lower border (minimal value for the second parameter), and (4) the ranking scores giving no importance at all to the false negatives are mapped to points on the upper border (minimal value for the second parameter).
- getCanonicalImportance(param1: float, param2: float) Importance[source]
Returns the canonical importance corresponding to the given parameters.
Default implementation calls the getCanonicalImportanceVectorized (abstract) method.
- Parameters:
param1 (float) – The first parameter.
param2 (float) – The second parameter.
- Returns:
The canonical importance.
- abstract getCanonicalImportanceVectorized(param1: ndarray, param2: ndarray) ndarray[source]
Computes a array of canonical importances values corresponding to the given parameters.
This needs to be implemented by subclasses.
- Parameters:
param1 (np.ndarray) – The first parameter array.
param2 (np.ndarray) – The second parameter array.
- Returns:
an array of shape (N, 4) where N is the number of elements in param1 and param2.
- getCanonicalRankingScore(param1: float, param2: float) RankingScore[source]
- locateBennettS() Point[source]
Bennett’s \(S\). This score is related to the accuracy \(A\) by \(S=2A-1\). Reference: Warrens [20].
- locateCohenCorrected(score: RankingScore) Point[source]
See Piérard et al. [16], Section 4.4.
- locateCohenKappa(priorPos) Point[source]
Cohen’s \(\scoreCohenKappa\) statistic. Defined in Cohen [5] References: Kaymak et al. [14] Synonyms: Heidke Skill Score Canbek et al. [4], Wilks [21]. See Piérard et al. [17], Section A.7.4, and Piérard et al. [16], Section A.3.3.
- locateDiceSorensenCoefficient() Point[source]
Dice-Sørensen coefficient. Synonym: F-one \(\scoreFOne\). \(\scoreFOne=\nicefrac{2\scoreJaccardPos}{\scoreJaccardPos+1}\)
- locateMarkedness(ratePos) Point[source]
Markedness. Defined in Powers [19] as \(\scoreNPV+\scorePPV-1\). Synonyms: Clayton Skill Score Canbek et al. [4], Wilks [21].
- locateNegativeLikelihoodRatioComplement(priorPos) Point[source]
Negative Likelihood Ratio. References: Brown and Davis [3], Gardner and Greiner [9], Glas et al. [10], Powers [19] See Piérard et al. [17], Section A.7.4, and Piérard et al. [16], Section A.3.5.
- locateNormalizedConfusionMatrixDeterminent(priorPos) Point[source]
The determinant of the normalized confusion matrix is \(\scoreConfusionMatrixDeterminant=\priorneg\priorpos\scoreYoudenJ\). Some works using this score: Wimmer et al. [22].
- locateOrderingsInvertedWithOpChangeGroundtruthClass() Conic[source]
- \[\left\{ R_I : I(tp) I(fn) = I(tn) I(fp) \right\} = \left\{ R_I : a(I) + b(I) = 1 \right\}\]
- locateOrderingsInvertedWithOpChangePredictedClass() Conic[source]
- \[\left\{ R_I : I(tp) I(fp) = I(tn) I(fn) \right\} = \left\{ R_I : a(I) = b(I) \right\}\]
- abstract locateOrderingsPuttingNoSkillPerformancesOnAnEqualFootingForFixedClassPriors(priorPos: float) AbstractGeometricObject2D[source]
The set of performance orderings induced by ranking scores that put all no-skill performances, for given class priors \((\pi_-, \pi_+)\), on an equal footing is given by
\[\left\{ \pi_+^2 I(tp) I(fn) = \pi_-^2 I(tn) I(fp) \right\}\]See Piérard et al. [16], Figure 6, left. # See Theorem 3 of future “paper 6”. # See Piérard et al. [16], Figure 8.
- Parameters:
priorPos (float) – the prior of the positive class, \(\pi_+\)
- Returns:
The locus (a curve).
- Return type:
- abstract locateOrderingsPuttingNoSkillPerformancesOnAnEqualFootingForFixedPredictionRates(ratePos: float) AbstractGeometricObject2D[source]
The set of performance orderings induced by ranking scores that put all no-skill performances, for given prediction rates \((\tau_-, \tau_+)\), on an equal footing is given by
\[\left\{ \tau_+^2 I(tp) I(fp) = \tau_-^2 I(tn) I(fn) \right\}\]See Piérard et al. [16], Figure 6, right. # See Theorem 4 of future “paper 6”.
- Parameters:
ratePos (float) – the prediction rate for the positive class, \(\tau_+\)
- Returns:
The locus (a curve).
- Return type:
- locatePositiveLikelihoodRatio(priorPos) Point[source]
Positive Likelihood Ratio. References: Altman and Bland [1], Brown and Davis [3], Glas et al. [10], Powers [19] See Piérard et al. [17], Section A.7.4, and Piérard et al. [16], Section A.3.5.
- locateSimilarityCoefficients() Conic[source]
Similarity coefficients, as defined in Batyrshin et al. [2]. See Batyrshin et al. [2] and Piérard et al. [16], Section 4.2.
- locateSimilarityCoefficientsS() Point[source]
Similarity coefficients of the family \(S_\theta\), as defined in Gower and Legendre [11]. See Gower and Legendre [11] and Piérard et al. [16], Section 4.2.
- locateSimilarityCoefficientsT() Point[source]
Similarity coefficients of the family \(T_\theta\), as defined in Gower and Legendre [11]. See Gower and Legendre [11] and Piérard et al. [16], Section 4.2.
- locateSkewInsensitiveVersionOfF(priorPos) Point[source]
The skew-insensitive version of \(\scoreFOne\). Defined in cite:t:Flach2003TheGeometry.
- locateStandardizedNegativePredictiveValue(priorPos) Point[source]
Standardized Negative Predictive Value (SNPV). Defined in Heston [13]. \(\scoreSNPV=\frac{\scoreTNR}{\scoreTNR+\scoreFNR}=\frac{\scoreNPV\priorpos}{\scoreNPV(\priorpos-\priorneg)+\priorneg}\) See Piérard et al. [16], Section A.3.5.
- locateStandardizedPositivePredictiveValue(priorPos) Point[source]
Standardized Positive Predictive Value (SPPV). Defined in Heston [13]. \(\scoreSPPV=\frac{\scoreTPR}{\scoreFPR+\scoreTPR}=\frac{\scorePPV\priorneg}{\scorePPV(\priorneg-\priorpos)+\priorpos}\) See Piérard et al. [16], Section A.3.5.
- locateYoudenJ(priorPos) Point[source]
Youden’s index or Youden’s \(\scoreYoudenJ\) statistic. Defined in Youden [23] References: Fluss et al. [8]. Related to the balanced accuracy by \(\scoreYoudenJ=\scoreTNR+\scoreTPR-1=2\scoreBalancedAccuracy-1\). Synonyms: informedness and Peirce Skill Score Canbek et al. [4], Wilks [21]. See Piérard et al. [16], Section A.3.5.