quantdata.dysanos.grid.rndysanos.local_tail#

Exact adaptive-neighbour diagnostics for conditional option-return tails.

The estimator uses a uniform k-nearest-neighbour kernel. Its weights are positive, so estimates of positive and negative return parts remain nonnegative. Training valuation is leave-one-out; validation queries always use the training split as their reference sample.

class quantdata.dysanos.grid.rndysanos.local_tail.LocalTailConfig(*, state_mode, neighbors=1024, instrument_candidate_neighbors=8192, tail_ranks=(1, 2, 10, 20, 50), signal_thresholds=(2.0, 3.0), query_batch_size=3584, instrument_batch_size=20, roundoff_multiplier=32.0, state_scale_floor=1e-06)[source]#

Bases: object

Configuration for an exact uniform adaptive-neighbour estimator.

neighbors: int = 1024#
instrument_candidate_neighbors: int = 8192#
tail_ranks: tuple[int, ...] = (1, 2, 10, 20, 50)#
signal_thresholds: tuple[float, ...] = (2.0, 3.0)#
query_batch_size: int = 3584#
instrument_batch_size: int = 20#
roundoff_multiplier: float = 32.0#
state_scale_floor: float = 1e-06#
property local_tail_probabilities: tuple[float, ...]#
property zero_event_upper_probability_95: float#

Exact iid binomial upper bound after zero events in neighbors draws.

class quantdata.dysanos.grid.rndysanos.local_tail.LocalTailProgress(*, split, processed_states, total_states, states_with_any_long_candidate, states_with_any_short_candidate, long_only_candidate_states, short_only_candidate_states, both_direction_candidate_states)[source]#

Bases: object

Cumulative one-sided-support counts for a valuation in progress.

quantdata.dysanos.grid.rndysanos.local_tail.local_neighbor_statistics(neighbor_returns, neighbor_roundoff, *, tail_ranks, neighbor_log_weights=None)[source]#

Return positive/negative parts and signed lower-tail order statistics.

Inputs have shape (queries, neighbours, instruments). Direction zero is the long return and direction one is the negated return.

quantdata.dysanos.grid.rndysanos.local_tail.normalize_state(state, *, mean, scale)[source]#

Normalize a state array without changing its shape or float32 dtype.

quantdata.dysanos.grid.rndysanos.local_tail.prepare_delta_hedged_local_data(universe, *, roundoff_multiplier=32.0)[source]#

Return delta-hedged option returns, roundoff bands, and state fields.

quantdata.dysanos.grid.rndysanos.local_tail.reduced_option_state(data, *, geometry, mode, instrument=0)[source]#

Return xstate or one option’s (xstate, log-strike, expiry).

quantdata.dysanos.grid.rndysanos.local_tail.shared_instrument_metric_diagnostics(data, *, training_paths, geometry, scale_floor, sample_states=4096)[source]#

Test whether every option produces the same standardized strike metric.

When log strikes differ only by instrument-specific constants, their standardized values are identical. Expiries are constant and therefore have zero distance. In that case one exact neighbour graph is valid for every separately estimated option.

quantdata.dysanos.grid.rndysanos.local_tail.state_normalization(training_state, *, scale_floor, path_weights=None)[source]#

Return training-only weighted population location and scale.

quantdata.dysanos.grid.rndysanos.local_tail.valuate_local_tail(*, reference_state, reference_returns, reference_roundoff, reference_log_weights=None, query_state, query_returns, query_roundoff, query_log_weights=None, reference_instrument_feature=None, query_instrument_feature=None, config, split, leave_one_out, leave_one_out_reference_indices=None, progress=None, progress_interval_seconds=30.0)[source]#

Value all query states with an exact adaptive-neighbour box kernel.