AxoBench API
IRon relevance
Signatures, parameters, return values, and source for iRon relevance.
Overview
The relevance function and squared error-relevance area of the IRon R package (Ribeiro and Moniz, 2020) with its default settings: adjusted-boxplot fences (Hubert and Vandervieren, 2008) with an exact medcouple, relevance 1 at the fences and 0 at the median, and a trapezoidal area over thresholds with step 0.001.
Source revision: 496e0c1a2dfd. Export index.
iron_relevance
axobench.relevance.iron_relevance(target: np.ndarray, *, reference: np.ndarray | None=None) -> np.ndarray
IRon default relevance phi of each value, with control points from the reference values: 1 at the lower adjusted-boxplot fence, 0 at the median, 1 at the upper fence, monotone cubic in between and constant beyond.
Parameters
targetnp.ndarray- required. Values to score.
referencenp.ndarray | None- keyword-only, default=None. Values that define the control points; None uses target.
Returns
relevancenp.ndarray- Relevance in [0, 1] with the shape of target.
iron_threshold_weights
axobench.relevance.iron_threshold_weights(relevance: np.ndarray, *, step: float=0.001) -> np.ndarray
Per-sample weights A(phi) such that iron_sera(e, phi) equals the sum of e**2 * A(phi): the trapezoidal area of the thresholds a sample passes, and 1 for phi >= 1.
Parameters
relevancenp.ndarray- required. Relevance values.
stepfloat- keyword-only, default=0.001. Threshold grid step.
Returns
weightsnp.ndarray- Weights in [0, 1].
iron_sera
axobench.relevance.iron_sera(error: np.ndarray, relevance: np.ndarray, *, step: float=0.001) -> float
IRon sera: the trapezoidal area over thresholds t of SER(t), the summed squared error of samples with relevance at least t.
Parameters
errornp.ndarray- required. Prediction errors.
relevancenp.ndarray- required. Relevance of each sample.
stepfloat- keyword-only, default=0.001. Threshold grid step.
Returns
serafloat- Squared error-relevance area, not normalized.
adjusted_box_fences
axobench.relevance.adjusted_box_fences(values: np.ndarray, *, coef: float=1.5, a: float=-4.0, b: float=3.0) -> tuple[float, float, float]
Lower fence, median, and upper fence of the adjusted boxplot, as robustbase::adjboxStats: Q1 - coef exp(a mc) IQR and Q3 + coef exp(b mc) IQR for mc >= 0, mirrored for mc < 0.
Parameters
valuesnp.ndarray- required. Sample values; flattened.
coeffloat- keyword-only, default=1.5. Whisker coefficient.
afloat- keyword-only, default=-4.0. Lower exponent coefficient.
bfloat- keyword-only, default=3.0. Upper exponent coefficient.
Returns
fencestuple[float, float, float]- (lower fence, median, upper fence).
medcouple
axobench.relevance.medcouple(values: np.ndarray) -> float
Exact medcouple, a robust skewness measure (Brys, Hubert and Struyf, 2004), computed in O(n log n).
Parameters
valuesnp.ndarray- required. Sample values; flattened.
Returns
mcfloat- Medcouple in [-1, 1]; 0 for fewer than three values or zero spread.
fivenum
axobench.relevance.fivenum(values: np.ndarray) -> np.ndarray
Tukey’s five-number summary, as R’s fivenum.
Parameters
valuesnp.ndarray- required. Sample values; flattened. At least one is required.
Returns
summarynp.ndarray- Minimum, lower hinge, median, upper hinge, and maximum.