generate_alternating_data#
- generate_alternating_data(n_segments: int, segment_length: int, p: int = 1, mean: float = 0.0, variance: float = 1.0, affected_proportion: float = 1.0, random_state: int = None) DataFrame [source]#
Generate multivariate normal data that is alternating between two states.
The data alternates between a state with mean 0 and variance 1 and a state with mean mean and variance variance. The length of the segments are all identical and equal to segment_length. The proportion of components that are affected by the change is determined by affected_proportion.
- Parameters:
- n_segmentsint
Number of segments to generate.
- segment_lengthint
Length of each segment.
- pint, optional (default=1)
Number of dimensions.
- meanfloat, optional (default=0.0)
Mean of every other segment.
- variancefloat, optional (default=1.0)
Variances of every other segment.
- affected_proportionfloat, optional (default=1.0)
Proportion of components {1, …, p} that are affected by each change in every other segment.
- random_stateint or RandomState, optional
Seed or random state for reproducible results. Defaults to None.
- Returns:
- pd.DataFrame
DataFrame with generated data.