biomedical_data_generator.features.informative

Generation of standalone informative features and class separation.

This module builds numeric class labels from DatasetConfig.class_configs, samples base values for standalone informative features according to per-class distributions, and applies class-wise mean shifts controlled by the per-group class_sep on DatasetConfig.standalone_informative_groups.

Scope:

Only standalone informative features are produced here (i.e. informative features that are not cluster anchors). Correlated clusters, including their anchors and the attenuated proxy shifts, are handled in correlated.py. Independent noise features are sampled directly in generator.py via utils.sampling.sample_distribution.

The standalone-informative block is partitioned into contiguous groups, each carrying its own class_sep. The class-wise offsets are derived per group from class_sep by _class_offsets_from_sep and applied as pure mean shifts, so the per-class distribution shape is preserved.

Functions

generate_informative_features(cfg, rng)

Generate all standalone informative features (no anchors, no clusters).

resolve_standalone_groups(cfg)

Resolve the column layout and centered per-class offsets of each group.

biomedical_data_generator.features.informative.generate_informative_features(cfg, rng)[source]

Generate all standalone informative features (no anchors, no clusters).

The function performs:

  1. Build numeric labels y from cfg.class_configs.

  2. Allocate a matrix x_informative of shape (n_samples, n_standalone_informative).

  3. Base draw over the entire block: for each class in declaration order, sample a contiguous (n_class_samples, n_standalone_informative) block spanning all columns.

  4. Per-group offsets: partition the columns into the contiguous groups of cfg.standalone_informative_groups (declaration order, laid out at the front of the matrix), and for each group add the class-wise offsets derived from that group’s class_sep to its column range.

Draw/offset order (load-bearing for reproducibility):

The base draw is performed class-by-class over the full block width, identical to the pre-groups implementation. Because offsets are pure mean shifts that consume no randomness, the RNG draw count and order are a pure function of (config, seed) and are independent of how the block is partitioned into groups. For a single group spanning the whole block this reproduces the previous behavior byte-for-byte: the only difference from the old code is that the constant offset is added after the draw rather than inside the per-class loop, which cannot change RNG consumption.

Parameters:
  • cfg (DatasetConfig) – DatasetConfig with validated fields and derived quantities.

  • rng (Generator) – NumPy random Generator.

Returns:

x_informative: Array of shape (n_samples, n_standalone_informative) with

standalone informative features.

y: Array of shape (n_samples,) with class labels in {0, …, K-1}.

Return type:

tuple

biomedical_data_generator.features.informative.resolve_standalone_groups(cfg)[source]

Resolve the column layout and centered per-class offsets of each group.

Mirrors exactly the contiguous, declaration-order layout and the per-class mean shifts applied by generate_informative_features(): group g occupies the next n_features columns at the front of the matrix, and its offset vector (length n_classes) is derived from the group’s class_sep by the same _resolve_group_sep / _class_offsets_from_sep path. Because every value is read from the resolved config, the result is reproducible without the feature matrix.

Parameters:

cfg (DatasetConfig) – Resolved DatasetConfig.

Returns:

One (column_indices, per_class_offset) pair per group in cfg.standalone_informative_groups, in declaration order.

Return type:

list[tuple[tuple[int, …], tuple[float, …]]]