Remove legacy event and mixed distribution paths

This commit is contained in:
2026-08-01 14:23:18 +08:00
parent dfb22adf2d
commit de6f9b75b9
22 changed files with 370 additions and 463 deletions

View File

@@ -43,7 +43,7 @@ class ContinuousRobustScalerStats:
def fit_continuous_robust_scaler(
dataset: AllFutureHealthDataset,
dataset: HealthDataset | AllFutureHealthDataset,
subset: Subset,
*,
quantile_range: tuple[float, float] = (25.0, 75.0),
@@ -90,13 +90,22 @@ def fit_continuous_robust_scaler(
)
type_to_column[type_id] = column
if hasattr(dataset, "patients"):
records = dataset.patients
elif hasattr(dataset, "samples"):
records = dataset.samples
else:
raise TypeError(
"dataset must expose patient records through .patients or .samples"
)
values = np.full(
(int(subset_indices.size), n_cont_types),
np.nan,
dtype=np.float32,
)
for row, patient_index in enumerate(subset_indices.tolist()):
patient = dataset.patients[int(patient_index)]
patient = records[int(patient_index)]
other_type = np.asarray(patient["other_type"], dtype=np.int64)
other_value = np.asarray(patient["other_value"], dtype=np.float32)
other_kind = np.asarray(patient["other_value_kind"], dtype=np.int64)