Clustering
Apply a clustering algorithm to numeric columns and append a cluster label.
Numeric columns in scope are passed to the selected algorithm, which assigns each row to a cluster without requiring a target column. The resulting label is stored in a new column appended to the original dataset.
After fitting, a JSON-serializable report is available via get_report()
with per-cluster metrics, sizes, feature profiles, and algorithm-specific
attributes (e.g. centroids for K-Means, linkage data for Agglomerative).
Parameters
- algorithm : string, default=
KMeansClustering - Clustering algorithm to apply.
- algorithm_params : object
- Parameters for the selected clustering algorithm.
- output_column_name : string, default=
cluster - Name of the output column to store the cluster labels.
Methods
fit(self, x: "'DashAIDataset'", y: "Union['DashAIDataset', None]" = None) -> "'Clustering'"
ClusteringFit the selected clustering algorithm and store execution metadata.
Parameters
- x : DashAIDataset
- Input dataset containing the scoped feature columns.
- y : DashAIDataset, optional
- Ignored. Present for API compatibility. Defaults to None.
Returns
- Clustering
- The fitted converter instance (self).
get_output_type(self, column_name: 'str' = None) -> 'DashAIDataType'
ClusteringReturn the DashAI type produced by the cluster label column.
Parameters
- column_name : str, optional
- Not used. Defaults to None.
Returns
- DashAIDataType
- An Integer type backed by
pyarrow.int64().
get_report(self) -> 'Dict[str, object] | None'
ClusteringReturn the report produced after the last fit, or None.
get_schema(cls) -> 'dict'
Clusteringtransform(self, x: "'DashAIDataset'", y: "Union['DashAIDataset', None]" = None) -> "'DashAIDataset'"
ClusteringAppend the cluster labels computed during fit to the dataset.
Parameters
- x : DashAIDataset
- Input dataset to transform. Must have the same number of rows as the dataset used in
fit. - y : DashAIDataset, optional
- Ignored. Present for API compatibility. Defaults to None.
Returns
- DashAIDataset
- The original dataset with a new cluster label column appended.
build_report(self, data: 'Dict[str, Any]') -> 'Dict[str, Any]'
BaseConverterWrap converter-specific data with the producer converter name.
get_credential(self, name: str)
ConfigObjectResolve a registered credential component by name.
Parameters
- name : str
- Credential component class name (e.g. "HuggingFaceCredential").
Returns
- BaseCredential
- An instance of the requested credential component.
get_metadata(cls) -> 'Dict[str, Any]'
BaseConverterGet metadata for the converter, used by the DashAI frontend.
Parameters
- cls : type
- The converter class (injected automatically by Python for classmethods).
Returns
- Dict[str, Any]
- Dictionary containing display name, short description, image preview path, category, icon, color, and whether the converter is supervised.
infer_output_columns(self, inputs: 'List[StateItem]') -> 'StructureDelta'
BaseConverterEstimate what this converter does to its scope, without any data.
Parameters
- inputs : list of ColumnItem | BlockItem
- The dataset state items in this converter's scope.
Returns
- StructureDelta
- The scope items that survive (maybe retyped) and the new items.
rows_to_keep(self, x: "'DashAIDataset'") -> 'List[int]'
BaseConverterPositions of the rows of x that survive this converter.
Parameters
- x : DashAIDataset
- The converter's scope columns of one split.
Returns
- list of int
- 0-based positions of the kept rows, in order.
validate_and_transform(self, raw_data: dict) -> dict
ConfigObjectIt takes the data given by the user to initialize the model and returns it with all the objects that the model needs to work.
Parameters
- raw_data : dict
- A dictionary with the data provided by the user to initialize the model.
Returns
- dict
- A validated dictionary with the necessary objects.