MCPcopy Create free account

hub / github.com/Forgis-Labs/HEPA / functions

Functions97 in github.com/Forgis-Labs/HEPA

↓ 8 callersFunctionget_horizons
Return the canonical horizon grid for a dataset name.
hepa/utils/config.py:112
↓ 5 callersFunctionchronological_split
Split a single-stream (test, labels) chronologically with a gap. Args: test: (T, C) features. labels: (T,) binary labels.
hepa/data/_common.py:10
↓ 4 callersFunctionbuild_label_surface
Binary label surface y(t, Delta_t) from time-to-event values. y(t, Delta_t_k) = 1 iff the next event arrives within Delta_t_k steps. Args:
hepa/evaluation/surface.py:12
↓ 4 callersMethodfinetune_forward
Compute the discrete-hazard CDF probability surface. Discrete-hazard parameterization (monotone in Delta_t by construction): lamb
hepa/model/hepa.py:157
↓ 3 callersMethod__init__
(self, eps: float = 1e-5)
hepa/model/encoder.py:41
↓ 3 callersFunction_build_event_loader
( entities, batch_size: int, max_context: int, max_future: int, stride: int, shuffle:
scripts/train.py:35
↓ 3 callersFunction_engines_to_entities
Build event-prediction entities: label the last timestep as positive.
hepa/data/cmapss.py:83
↓ 3 callersFunction_make_perfect_surface
(n: int = 200, k: int = 5, seed: int = 0)
tests/test_metrics.py:15
↓ 3 callersFunctionevaluate_probability_surface
Pool all (t, Delta_t) cells; report AUPRC, AUROC, best-F1. Args: p_surface: (N, K) predicted probabilities in [0, 1]. y_surface:
hepa/evaluation/metrics.py:24
↓ 3 callersMethodmaybe_sync_target
Hard-copy encoder -> target_encoder every ``sync_interval_steps``. Only fires under ``target_mode == 'periodic_sync'``. Call once per
hepa/model/hepa.py:105
↓ 3 callersFunctionmonotonicity_violation_rate
Fraction of consecutive (k, k+1) pairs where p decreased.
hepa/evaluation/metrics.py:182
↓ 3 callersFunctionper_horizon_auroc
Per-horizon AUROC + AUPRC + prevalence.
hepa/evaluation/metrics.py:96
↓ 3 callersMethodpretrain_forward
Self-supervised forward pass. Returns the **raw** (unnormalized) predictor output and target embedding. The regularizer requires raw
hepa/model/hepa.py:119
↓ 3 callersFunctionvicreg_loss
Pretraining loss: L1 alignment plus a variance-covariance regularizer. L = (1 - alpha) * ||normalize(h_pred) - normalize(h_target)||_1
hepa/training/losses.py:36
↓ 3 callersFunctionzscore
Fit mean/std on ``train`` and apply to all arrays.
hepa/data/_common.py:43
↓ 2 callersMethod_init_target_encoder
Copy matching weights from encoder into target encoder.
hepa/model/hepa.py:95
↓ 2 callersFunction_minmax
(data: np.ndarray, mn=None, mx=None)
hepa/data/mba.py:19
↓ 2 callersFunction_read
(path)
hepa/data/batadal.py:34
↓ 2 callersFunctionh_auroc
Mean per-horizon AUROC across horizons with 0 < prevalence < 1. The paper's primary metric. Robust to drifting horizon base rates that can ma
hepa/evaluation/metrics.py:128
↓ 2 callersFunctionsinusoidal_pe
Sinusoidal positional encoding for arbitrary positions. Args: positions: 1D tensor of position indices, shape (N,). d: embedding
hepa/model/encoder.py:17
↓ 2 callersFunctionweighted_bce_loss
Positive-weighted BCE on probabilities (post-sigmoid). Args: p: (B, K) probabilities in (0, 1) - typically the discrete-hazard CDF.
hepa/training/losses.py:74
↓ 1 callersMethod_compute_tte
(labels: np.ndarray, max_future: int)
hepa/training/finetune.py:52
↓ 1 callersFunction_engines_to_dict
(df: pd.DataFrame)
hepa/data/cmapss.py:74
↓ 1 callersFunction_estimate_pos_weight
( loader: DataLoader, horizons: torch.Tensor, clamp_max: float = 1000.0 )
hepa/training/finetune.py:205
↓ 1 callersFunction_eval_ft_loss
( model: HEPA, loader: DataLoader, h_tensor: torch.Tensor, pw_tensor: torch.Tensor, mode:
hepa/training/finetune.py:186
↓ 1 callersFunction_eval_pretrain_loss
( model: HEPA, loader: DataLoader, alpha: float, device: str )
hepa/training/pretrain.py:197
↓ 1 callersFunction_load_raw
(subset: str)
hepa/data/cmapss.py:54
↓ 1 callersFunction_load_station
(csv_path)
hepa/data/beijing_aq.py:50
↓ 1 callersMethod_patch_mask
( self, mask: torch.Tensor, T: int, N: int, device: torch.device )
hepa/model/encoder.py:200
↓ 1 callersFunction_resolve_dir
Locate the C-MAPSS directory using ``HEPA_DATA_DIR``.
hepa/data/cmapss.py:39
↓ 1 callersFunction_station_csvs
()
hepa/data/beijing_aq.py:36
↓ 1 callersMethodencode
Return h_t for analysis/probing.
hepa/model/hepa.py:207
↓ 1 callersFunctionevaluate
Generate the probability surface on a test loader.
hepa/training/finetune.py:223
↓ 1 callersFunctionfinetune
Finetune the predictor and event head with positive-weighted BCE. ``early_stop=True`` (default) stops on the validation loss and restores the
hepa/training/finetune.py:96
↓ 1 callersFunctionget_context
Return the per-dataset context window length (Table L).
hepa/utils/config.py:117
↓ 1 callersFunctionget_norm_mode
Return the normalization mode for a dataset ('none' for C-MAPSS, else 'revin').
hepa/utils/config.py:139
↓ 1 callersFunctionglobal_zscore_bundle
Global per-channel z-score for a dataset bundle (norm_mode='none' path). Fits a single per-channel mean/std on the concatenated pretrain sequence
hepa/data/_common.py:50
↓ 1 callersFunctionload_batadal
(split_ratios: tuple = (0.6, 0.1, 0.3), gap: int = 48)
hepa/data/batadal.py:42
↓ 1 callersFunctionload_beijing_aq
(gap: int = 24)
hepa/data/beijing_aq.py:67
↓ 1 callersFunctionload_cmapss
Load a C-MAPSS subset, id-splitting the run-to-failure TRAIN engines. The event-prediction framing requires run-to-failure streams so that the
hepa/data/cmapss.py:93
↓ 1 callersFunctionload_dataset
Dispatch a dataset name to its loader.
hepa/data/__init__.py:26
↓ 1 callersFunctionload_ettm1
( threshold_sigma: float = 2.0, window_steps: int = 7 * 96, # 7 days at 15-min resolution gap: in
hepa/data/ettm1.py:30
↓ 1 callersFunctionload_gecco
( csv_name: str = "gecco2018.csv", split_ratios: tuple = (0.5, 0.25, 0.25), gap: int = 200, )
hepa/data/gecco.py:25
↓ 1 callersFunctionload_mba
(normalize: bool = True, label_window: int = 20)
hepa/data/mba.py:27
↓ 1 callersFunctionload_psm
Load PSM (CSV or NPY) and split chronologically.
hepa/data/psm.py:24
↓ 1 callersFunctionload_smap
Load SMAP as a single concatenated stream + chronological split.
hepa/data/smap.py:32
↓ 1 callersFunctionload_tep
()
hepa/data/tep.py:22
↓ 1 callersFunctionload_vix
(spike_percentile: float = 90.0)
hepa/data/vix.py:23
↓ 1 callersFunctionload_weather
( threshold_sigma: float = 3.0, window_steps: int = 7 * 144, # 7 days at 10-min resolution gap: i
hepa/data/weather.py:28
↓ 1 callersFunctionmain
()
scripts/train.py:67
↓ 1 callersFunctionmain
()
scripts/download_data.py:76
↓ 1 callersFunctionpretrain
Pretrain HEPA with L1 alignment plus a variance-covariance regularizer. Loss: ``(1 - alpha) * L1(normalize(h_pred), normalize(h_target)) + al
hepa/training/pretrain.py:110
↓ 1 callersFunctionsave_surface
Persist a probability surface plus aligned labels to .npz.
hepa/evaluation/surface.py:32
↓ 1 callersFunctionset_seed
Seed Python, NumPy, and PyTorch (CPU + CUDA) RNGs.
hepa/utils/seed.py:11
↓ 1 callersFunctionvicreg_var_cov
VICReg variance + covariance terms on a (B, D) batch. Variance hinge encourages each feature's standard deviation to be at least 1; covarianc
hepa/training/losses.py:16
Method__getitem__
(self, i: int)
hepa/training/finetune.py:66
Method__getitem__
(self, idx: int)
hepa/training/pretrain.py:72
Method__init__
(self, d_model: int = 256, hidden: int = 256)
hepa/model/predictor.py:12
Method__init__
( self, n_channels: int, patch_size: int = 16, d_model: int = 256, n_h
hepa/model/hepa.py:51
Method__init__
(self, n_channels: int, patch_size: int = 16, d_model: int = 256)
hepa/model/encoder.py:74
Method__init__
(self, d_model: int, n_heads: int, d_ff: int, dropout: float = 0.1)
hepa/model/encoder.py:94
Method__init__
( self, n_channels: int, patch_size: int = 16, d_model: int = 256, n_h
hepa/model/encoder.py:131
Method__init__
( self, n_channels: int, patch_size: int = 16, d_model: int = 256, n_h
hepa/model/target_encoder.py:32
Method__init__
(self, d_model: int = 256)
hepa/model/event_head.py:12
Method__init__
( self, x: np.ndarray, labels: np.ndarray, max_context: int = 512, str
hepa/training/finetune.py:29
Method__init__
( self, sequences: Dict[int, np.ndarray], n_cuts: int = 40, max_context: int =
hepa/training/pretrain.py:41
Method__len__
(self)
hepa/training/finetune.py:63
Method__len__
(self)
hepa/training/pretrain.py:69
Functionbrier_score
Mean squared error between predicted probability and binary label.
hepa/evaluation/metrics.py:170
Functioncollate_event
(batch)
hepa/training/finetune.py:76
Functioncollate_pretrain
Right-pad context and target to batch max lengths, build masks.
hepa/training/pretrain.py:81
Functionexpected_calibration_error
Expected Calibration Error (ECE) over equal-width probability bins.
hepa/evaluation/metrics.py:148
Methodforward
Predict future embedding conditioned on horizon Delta_t. Args: h: (B, d_model) context embedding. delta_t: (B,) float
hepa/model/predictor.py:22
Methodforward
Normalize each (batch, channel) timeseries; return stats for denorm. Args: x: (B, T, C) input. mask: optional (B, T)
hepa/model/encoder.py:45
Methodforward
Map (B, T, C) -> (B, N_tokens, d). Pads time dim if not divisible.
hepa/model/encoder.py:79
Methodforward
( self, x: torch.Tensor, key_padding_mask: Optional[torch.Tensor] = None, attn
hepa/model/encoder.py:110
Methodforward
Encode context to h_t. Args: x: (B, T, C) raw observations. mask: optional (B, T) bool, True = padding. Retu
hepa/model/encoder.py:161
Methodforward
Encode target interval to a single pooled embedding. Args: x: (B, T, C) target observations x(t : t+Delta_t]. mask: o
hepa/model/target_encoder.py:63
Methodforward
Return logits with the trailing feature dim collapsed. Accepts (B, d) -> (B,) or (B, K, d) -> (B, K).
hepa/model/event_head.py:17
Functionget_context
Return the per-dataset context window length (Table L).
papers/hepa-2026/config_snapshot.py:115
Functionget_dataset_dir
Resolve the directory for a dataset, creating parents as needed.
hepa/data/config.py:18
Functionget_horizons
Return the canonical horizon grid for a dataset name.
papers/hepa-2026/config_snapshot.py:110
Functionload_surface
Load a surface saved by `save_surface`. Returns (p_surface, y_surface, horizons, t_index).
hepa/evaluation/surface.py:53
Functiontest_h_auroc_perfect
()
tests/test_metrics.py:29
Functiontest_hepa_finetune_forward_shapes_and_monotonicity
()
tests/test_model.py:73
Functiontest_hepa_handles_mask
()
tests/test_model.py:95
Functiontest_hepa_joint_train_mode_target_has_grads
()
tests/test_model.py:48
Functiontest_hepa_maybe_sync_target_copies_weights
After sync_interval_steps, encoder weights are copied to target.
tests/test_model.py:32
Functiontest_hepa_param_count_close_to_paper
Sanity check: the default architecture is roughly the paper's 2.16M.
tests/test_model.py:88
Functiontest_hepa_pretrain_forward_shapes
()
tests/test_model.py:10
Functiontest_hepa_target_mode_is_joint_train_by_default
()
tests/test_model.py:25
Functiontest_monotonicity_violation_rate_nonzero_for_decreasing
()
tests/test_metrics.py:49
Functiontest_monotonicity_violation_rate_zero_for_increasing
()
tests/test_metrics.py:44
Functiontest_per_horizon_auroc_keys
()
tests/test_metrics.py:35
Functiontest_perfect_surface_yields_auroc_one
()
tests/test_metrics.py:22
Functiontest_random_surface_auroc_near_chance
()
tests/test_metrics.py:54
Functiontest_vicreg_loss_runs_and_is_finite
()
tests/test_model.py:62