OPE-means / benchmarks /get_heldout_data.py
Nabidnur's picture
OPE-means v5: code, results, technical report, figures, notebooks, tests
f640c46 verified
Raw History Blame Contribute Delete
1.56 kB
"""Held-out datasets for ARIES #2 (OPE-means), never used during development. Built with the same recipe as
the paper's SKIN/SUSY sets (Jiang & Zhou 2026, `get_robust_data.py`): z-score every feature, append
int(0.01 n) uniform outliers from np.random.default_rng(42).uniform(-xi, xi), xi in {5, 10}; k = 10;
z = number of appended rows.
* COVTYPE-5/10: UCI Covertype (581,012 rows), the 10 continuous features (columns 0-9), read through
scikit-learn's cached copy (fetch_covtype).
* DEEP-5/10: DEEP* 1M (the PISCES training rows, 1,000,000 x 96), from benchmarks/get_deep1m.py.
Usage: python benchmarks/get_heldout_data.py OUT_DIR --covtype-home SKLEARN_DATA_HOME --deep DEEP_DIR
"""
import argparse, os, sys
import numpy as np
sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))
from get_robust_data import inject, save, znorm # noqa: E402
def main():
ap = argparse.ArgumentParser()
ap.add_argument("out"); ap.add_argument("--covtype-home"); ap.add_argument("--deep")
a = ap.parse_args(); os.makedirs(a.out, exist_ok=True)
if a.covtype_home:
from sklearn.datasets import fetch_covtype
X = znorm(fetch_covtype(data_home=a.covtype_home, download_if_missing=True).data[:, :10].astype(np.float64))
for xi in (5, 10):
save(a.out, f"COVTYPE-{xi}", *inject(X, xi), 10)
if a.deep:
X = znorm(np.load(os.path.join(a.deep, "train_1M.npy")).astype(np.float64))
for xi in (5, 10):
save(a.out, f"DEEP-{xi}", *inject(X, xi), 10)
if __name__ == "__main__":
main()