KMeansClusteringRecommender

class baybe.recommenders.pure.nonpredictive.clustering.KMeansClusteringRecommender[source]

Bases: SKLearnClusteringRecommender

K-means clustering recommender.

Public methods

__init__([model_params, ...])

Method generated by attrs for class KMeansClusteringRecommender.

recommend(batch_size, searchspace[, ...])

Recommend a batch of points from the given search space.

Public attributes and properties

allow_recommending_already_measured

Allow to make recommendations that were measured previously.

allow_repeated_recommendations

Allow to make recommendations that were already recommended earlier.

compatibility

Class variable reflecting the search space compatibility.

model_cluster_num_parameter_name

Class variable describing the name of the clustering parameter.

model_params

Optional model parameter that will be passed to the surrogate constructor.

__init__(model_params: dict = NOTHING, *, allow_repeated_recommendations: bool = False, allow_recommending_already_measured: bool = True)

Method generated by attrs for class KMeansClusteringRecommender.

For details on the parameters, see Public attributes and properties.

recommend(batch_size: int, searchspace: SearchSpace, objective: Objective | None = None, measurements: DataFrame | None = None)

Recommend a batch of points from the given search space.

Parameters:
  • batch_size (int) – The number of points to be recommended.

  • searchspace (SearchSpace) – The search space from which to recommend the points.

  • objective (Optional[Objective]) – An optional objective to be optimized.

  • measurements (Optional[DataFrame]) – Optional experimentation data that can be used for model training. The data is to be provided in “experimental representation”: It needs to contain one column for each parameter spanning the search space (column name matching the parameter name) and one column for each target tracked by the objective (column name matching the target name). Each row corresponds to one conducted experiment, where the parameter columns define the experimental setting and the target columns report the measured outcomes.

Return type:

DataFrame

Returns:

A dataframe containing the recommendations in experimental representation as individual rows.

allow_recommending_already_measured: bool

Allow to make recommendations that were measured previously. This only has an influence in discrete search spaces.

allow_repeated_recommendations: bool

Allow to make recommendations that were already recommended earlier. This only has an influence in discrete search spaces.

compatibility: ClassVar[SearchSpaceType] = 'DISCRETE'

Class variable reflecting the search space compatibility.

model_cluster_num_parameter_name: ClassVar[str] = 'n_clusters'

Class variable describing the name of the clustering parameter.

model_params: dict

Optional model parameter that will be passed to the surrogate constructor. This is initialized with reasonable default values for the derived child classes.