ogboost.generate_heterogeneous_learners¶
- ogboost.generate_heterogeneous_learners(templates, overrides, total_samples, template_probs=None, random_state=None)[source]¶
Generate a flat list of heterogeneous base learner instances by applying independent hyperparameter sampling to each template.
Each generated learner is created by cloning a template (using scikit-learn’s clone) and then updating its hyperparameters based on independently sampled values provided via the overrides dictionaries.
- Parameters:
templates (list) – A list of pre-initialized scikit-learn estimator instances that serve as templates.
overrides (list of dict) – A list of dictionaries (one per template). Each dictionary maps hyperparameter names (as strings) to callables that accept a random state (rng) and return a sampled value. All override values must be callable.
total_samples (int) – The total number of new base learner instances to generate.
template_probs (array-like or str or None, optional) – If array-like, a probability distribution over the templates. Must sum to 1 and have the same length as templates. If the string “round_robin” (case-insensitive) is provided, then round-robin selection is used. If None, a uniform random distribution is used.
random_state (int, np.random.RandomState, or None, optional) – A seed or RandomState instance for reproducibility in sampling hyperparameters.
- Returns:
list – A flat list of newly generated base learner instances with updated hyperparameters.
- Raises:
ValueError – If an override value is not callable, or if the lengths of templates and overrides do not match, or if template_probs is provided with the wrong length.