Scoring

PortfolioOptimisers.NearestQuantilePredictionType
struct NearestQuantilePrediction{__T_r, __T_q, __T_r_kwargs, __T_q_kwargs} <: PredictionScorer

Scoring strategy that selects a prediction by finding the element of a PopulationPredictionResult whose risk measure value is nearest to a target quantile across the population.

Fields

  • r: Risk measure or vector of risk measures.
  • q: Target quantile for scoring.
  • r_kwargs: Keyword arguments passed to the risk measure.
  • q_kwargs: Keyword arguments passed to quantile.

Constructors

NearestQuantilePrediction(;    r::BaseRM_VecBaseRM = ConditionalValueatRisk(),    q::Real = 0.5,    r_kwargs::NamedTuple = (;),    q_kwargs::NamedTuple = (;)) -> NearestQuantilePrediction

Multiplicity

r takes one risk measure or a vector of them, and the type gains no scalariser field. r_kwargs is already a general keyword channel forwarded straight into expected_risk, so a caller writes r_kwargs = (sca = MaxScalariser(),).

A mixed-polarity vector is admitted here, because quantile_by_measure takes an explicit sign rather than consulting bigger_is_better.

Validation

  • 0 <= q <= 1.

Functor

(s::NearestQuantilePrediction)(ppred::PopulationPredictionResult, sign::Integer = 1)

Evaluate the scorer on a population prediction result and return the selected prediction.

sign is the orientation of the risk scale, forwarded to quantile_by_measure. Use 1 when a larger risk is worse, -1 when it is better. It negates every risk value before the quantile is taken, so sign = -1 selects the same path that sign = 1 selects at 1 - q.

Related

source