QDpy
Loading...
Searching...
No Matches
qdpy.containers.grids.CVTGrid Class Reference
Inheritance diagram for qdpy.containers.grids.CVTGrid:
qdpy.containers.grids.Grid qdpy.containers.base.Container qdpy.containers.base.ContainerLike qdpy.base.Summarisable qdpy.base.Copyable qdpy.base.CreatableFromConfig

Public Member Functions

ShapeLike grid_shape (self)
int nb_sampled_points (self)
Public Member Functions inherited from qdpy.containers.grids.Grid
ShapeLike shape (self)
int max_items_per_bin (self)
int filled_bins (self)
GridSolutionsLike solutions (self)
GridItemsPerBinLike nb_items_per_bin (self)
GridFitnessLike fitness (self)
GridFeaturesLike features (self)
GridQualityLike quality (self)
np.ndarray quality_array (self)
Optional[GridIndexLike] best_index (self)
str filled_str (self)
 index_grid (self, param)
None discard (self, IndividualLike individual, bool also_from_parents=False)
float qd_score (self, bool normalized=True)
Public Member Functions inherited from qdpy.containers.base.Container
float capacity (self)
float free (self)
int size (self)
Any best (self)
Optional[FitnessLike] best_fitness (self)
Optional[FeaturesLike] best_features (self)
int nb_discarded (self)
int nb_added (self)
int nb_rejected (self)
int nb_operations (self)
Optional[Sequence[DomainLike]] fitness_extrema (self)
Optional[Sequence[DomainLike]] features_extrema (self)
Sequence[IndividualLike] all_parents_inds (self)
str size_str (self)
bool in_bounds (self, Any val, Any domain)
FeaturesLike get_ind_features (self, IndividualLike individual, *args, **kwargs)
FitnessLike get_ind_fitness (self, IndividualLike individual, *args, **kwargs)
 set_ind_fitness (self, IndividualLike individual, FitnessLike fitness, *args, **kwargs)
Optional[int] add (self, IndividualLike individual, bool raise_if_not_added_to_parents=False)
int update (self, Iterable iterable, bool ignore_exceptions=True, bool issue_warning=False)
None clear (self, bool also_from_parents=False)
None clear_all (self)
 novelty (self, IndividualLike individual, **kwargs)
 novelty_local_competition (self, IndividualLike individual, **kwargs)
Any to_grid (self, Union[ShapeLike, int] shape, int max_items_per_bin=1, Optional[float] capacity=None, **Any kwargs)
Public Member Functions inherited from qdpy.base.Summarisable
Mapping[str, Any] __get_summary_state__ (self)
str summary (self, Optional[int] max_depth=None, Optional[int] max_entry_length=250)
Public Member Functions inherited from qdpy.base.CreatableFromConfig
Any from_config (cls, Mapping[str, Any] config, **Any kwargs)

Protected Member Functions

None _init_clusters (self)
GridIndexLike _index_grid_features (self, FeaturesLike features)
Protected Member Functions inherited from qdpy.containers.grids.Grid
None _init_grid (self)
Generator[GridIndexLike, None, None] _index_grid_iterator (self)
None _update_quality (self, GridIndexLike ig)
Optional[int] _add_internal (self, IndividualLike individual, bool raise_if_not_added_to_parents, bool only_to_parents)
 Choose a cell and apply its admission policy.
Optional[int] _add_to_grid (self, IndividualLike individual, GridIndexLike ig, bool raise_if_not_added_to_parents, Optional[int] replacement=None)
 Apply a successful storage update to per-cell bookkeeping.
GridIndexLike _stored_cell (self, IndividualLike individual)
 Find the admitted cell by object identity.
Protected Member Functions inherited from qdpy.containers.base.Container
Optional[Sequence[DomainLike]] _float_feature_extrema (self)
Tuple[bool, int] _add_to_collection (self, BackendLike[IndividualLike] collection, IndividualLike individual)
None _check_if_can_be_added (self, IndividualLike individual)
None _add_to_parents (self, IndividualLike individual, bool require_admission)
 Forward a candidate to each immediate parent in order.
 _can_undo_parent_appends (self, individual)
 _add_to_append_only_parents (self, individual)
 Take a short pre-admission record and rebuild a snapshot only after rejection.
 _snapshot_parents (self)
None _discard_by_index (self, IndividualLike individual, Optional[int] idx=None, bool also_from_parents=False)

Detailed Description

Assign descriptors to the nearest fitted centroid.

Sample a uniform set of points inside the specified feature domain,
then fit one k-means centroid per cell. Retain individuals with the
same admission policy as Grid. Centroid fitting uses NumPy's random
state, so seed it before constructing the grid for a repeatable setup.

:param shape: Number of centroid cells as an integer or a one-item
    sequence.
:param grid_shape: Optional legacy shape with one entry per descriptor.
    The descriptor domain determines dimensionality when omitted.
:param nb_sampled_points: Number of samples used to fit the centroids.
:param centroids: Optional precomputed matrix with one row per cell and
    one column per descriptor. Omit to fit centroids by sampling.
:param kwargs: Grid options including the descriptor domain.

Definition at line 533 of file grids.py.

Member Function Documentation

◆ _index_grid_features()

GridIndexLike qdpy.containers.grids.CVTGrid._index_grid_features ( self,
FeaturesLike features )
protected
Return the first nearest centroid for descriptors within the CVT domain.

Reimplemented from qdpy.containers.grids.Grid.

Definition at line 602 of file grids.py.

◆ _init_clusters()

None qdpy.containers.grids.CVTGrid._init_clusters ( self)
protected
Initialise the clusters and tessellate the grid.

Definition at line 583 of file grids.py.

◆ grid_shape()

ShapeLike qdpy.containers.grids.CVTGrid.grid_shape ( self)
Return the shape of the grid.

Definition at line 593 of file grids.py.

◆ nb_sampled_points()

int qdpy.containers.grids.CVTGrid.nb_sampled_points ( self)
Return the number of sampled points to identify cluster centers.

Definition at line 598 of file grids.py.


The documentation for this class was generated from the following file: