quantdata.dysanos.grid.rndysanos.conditional_tail#
Conditional extreme-quantile and lower-CVaR estimation.
For a signed instrument return Y and lower-tail probability alpha, the
model estimates
Q_alpha(Y | z) = inf {q: P[Y <= q | z] >= alpha}.
Both Y=dC (long) and Y=-dC (short) are fitted explicitly. The
associated lower-CVaR functional is represented by the Rockafellar–Uryasev
score
q - relu(q - Y) / alpha.
At the population optimum its conditional expectation is the lower expected
shortfall. A finite empirical distribution has no resolution below one
observation. Requested levels below 1 / training_paths are consequently
reported but tied to the effective empirical level 1 / training_paths.
- class quantdata.dysanos.grid.rndysanos.conditional_tail.ConditionalTailConfig(*, label, state_features, instruments, training_paths, group='', user_version='1.0', seed=83771, tail_path_counts=(0.1, 1.0, 2.0, 10.0), network_config=FeedForwardConfig(activation='LeakyReLU', num_depth=2, num_width=200, use_bias=True))[source]#
Bases:
objectLogical geometry and tail levels for the conditional quantile model.
tail_path_countsspecifies tail masses in units of independent paths. For example, with 50,000 training paths,10means a lower-tail probability of10 / 50_000. Values below one path are retained as requested metadata but use one path as their effective empirical level.- network_config: FeedForwardConfig = FeedForwardConfig(activation='LeakyReLU', num_depth=2, num_width=200, use_bias=True)#
- class quantdata.dysanos.grid.rndysanos.conditional_tail.ConditionalTailQuantileModel(env, *, config, state_mean, state_scale)[source]#
Bases:
BaseModelState-only monotone lower quantiles for long and short returns.
- quantdata.dysanos.grid.rndysanos.conditional_tail.empirical_lower_cvar(values, *, tail_probability, dim=0)[source]#
Return exact lower expected shortfall of an empirical distribution.
Fractional probability mass at the boundary order statistic is included. Therefore every level at or below
1 / observationsis exactly the sample minimum; a fractional observation cannot reveal a lower value.
- quantdata.dysanos.grid.rndysanos.conditional_tail.lower_cvar_score(*, quantiles, returns, tail_probabilities)[source]#
Return the lower-CVaR variational score per observation and output.
Conditional expectation of this score is maximized by a lower quantile; at that optimum it equals lower expected shortfall.
- quantdata.dysanos.grid.rndysanos.conditional_tail.lower_quantile_pinball(*, quantiles, returns, tail_probabilities, normalize_levels=True)[source]#
Return normalized pinball loss and its direction/level/instrument means.
- Parameters:
quantiles (
Tensor) – Shape(..., 2, L, J)with long/short as the direction axis.returns (
Tensor) – Shape(..., J). Long and short targets are constructed internally.tail_probabilities (
Tensor) – One-dimensional tensor of theLeffective lower-tail levels.normalize_levels (
bool) – Divide each level by its tail probability. This does not change any population minimizer, but prevents the least-extreme level from mechanically dominating all rarer levels in a joint model.
- quantdata.dysanos.grid.rndysanos.conditional_tail.moment_signal_statistics(drift, second_moment, *, g=3.0)[source]#
Measure sampled states satisfying
abs(mu) > g * sigma.The variance is the population conditional variance
max(E[Y**2|z] - E[Y|z]**2, 0). Zero predicted variance is reported separately because an infinite signal ratio can indicate inconsistent moment-network outputs rather than an economic opportunity.