OpenQuant Docs banner
OpenQuant icon openquant-rs / documentation terminal

sample_weights

Event-Driven Data and Labeling

Sample weighting utilities for overlapping event structure.

Why This Module Exists

Adjusts training influence to avoid overcounting dense overlapping labels.

Key Public APIs

  • get_weights_by_return
  • get_weights_by_time_decay

Core Math

Uniqueness Weight

\[w_i=\sum_t\frac{I_{t,i}}{\sum_j I_{t,j}}\]

Time Decay

\[w_i=(\frac{i}{T})^\delta\]

Code Examples

Compute event weights

use openquant::sample_weights::get_weights_by_time_decay;

let w = get_weights_by_time_decay(&returns, 0.5);

Implementation Notes

  • Pair with sequential bootstrap for robust label sampling.
  • Time-decay controls recency bias explicitly.