extendedmosaicperm.experiments.adaptive_tiling module

class AdaptiveTilingExperiment(n_sims=50, nrand=100, seed=42, violation_strengths=None, sizes=None, exposures_update_interval=10)[source]

Bases: BaseExperiment

Compare default vs adaptive tiling across generators and sizes.

For each generator/size combination, the experiment runs the test with:

  • default tiling (baseline from mosaicperm),

  • adaptive tiling (data-driven grouping, using the same test statistic).

Parameters:
  • n_sims (int) – Number of Monte Carlo replications per configuration.

  • nrand (int) – Number of random draws for the test statistic per fit.

  • seed (int) – Base seed; seed + sim is used for the sim-th replication.

  • violation_strengths (Optional[list[float]]) – List of correlation strength values to iterate over.

  • sizes (Optional[Dict[str, Dict[str, int]]]) – Mapping from size key to a dict with keys "T", "p", "k".

  • exposures_update_interval (int) – If greater than zero, exposures are redrawn every given number of periods.

Examples

>>> from extendedmosaicperm.experiments.adaptive_tiling import AdaptiveTilingExperiment
>>> exp = AdaptiveTilingExperiment(n_sims=1, nrand=3, seed=0, violation_strengths=[0.0])
>>> exp.run()  
>>> df = exp.summarize()
>>> {"label", "method", "violation_strength"}.issubset(df.columns)
True

Initialize an empty experiment container.

extract_method(label)[source]

Return the tiling mode parsed from an experiment label.

Parameters:

label (str) – Label string of the form "<gen>_<size>_<sym|asym>_<default|adaptive>".

Returns:

"adaptive" if the label ends with "_adaptive", otherwise "default".

Return type:

str

run()[source]

Execute the full simulation grid and store p-values.

Populates self.results as a nested dictionary of the form:

{
    label: {
        violation_strength: np.ndarray of p-values
    }
}

where label encodes generator, size, symmetry, and tiling mode.

Return type:

None