simplex_uniform_kraemer#
- mlquantify.utils.simplex_uniform_kraemer(n_dim: int, n_prev: int, n_iter: int, min_val: float = 0.0, max_val: float = 1.0, max_tries: int = 1000, random_state: int | None = None) ndarray[source]#
Generates n_prev prevalence vectors of n_dim classes uniformly distributed on the simplex, with optional lower and upper bounds.
Based on the algorithm of Kramer et al. for uniform sampling on a simplex.
- Parameters:
- n_dimint
Number of dimensions (classes).
- n_prevint
Number of prevalence vectors to generate.
- min_valfloat, optional
Minimum allowed prevalence for each class (default=0.0).
- max_valfloat, optional
Maximum allowed prevalence for each class (default=1.0).
- max_triesint, optional
Maximum number of sampling iterations to reach the target n_prev.
- Returns:
- np.ndarray
Array of shape (n_prev, n_dim) with valid prevalence vectors.