make_synthetic_feature_table
Note
This page is a reference documentation. It only explains the function signature, and not how to use it. Please refer to the Habitat Guide and Python API guide (v2.0) for usage.
- make_synthetic_feature_table(n_rows: int = 60, n_features: int = 12, task: Literal['binary', 'survival'] = 'binary', rng: int | Generator | SeedSequence = 0) FeatureTable[source]
Build a deterministic tabular dataset for fast ML golden tests.
A single
signalfeature separates the endpoint classes or correlates with survival; the remaining columns are pure noise so selectors and classifiers have a stable correct answer to recover.- Parameters:
n_rows – Number of subjects / rows.
n_features – Total number of model-input columns including
signal.1. (n_features must be at least)
task –
"binary"for a single label column or"survival"for follow-up time plus an event indicator.rng – Seed controlling feature noise and endpoint draws.
- Returns:
A
FeatureTablewith explicit outcome semantics.
Examples
>>> from habit.datasets import make_synthetic_feature_table >>> table = make_synthetic_feature_table(n_rows=10, n_features=4, rng=42) >>> table.frame.shape (10, 6) >>> list(table.feature_columns) ['signal', 'noise0', 'noise1', 'noise2'] >>> table.outcome.task 'binary'