Saltar al contenido principal

ClusteringScatterExplorer

Explorer
DashAI.back.exploration.explorers.ClusteringScatterExplorer

2-D scatter plot of clustering results coloured by cluster label.

Projects the selected numeric feature columns onto a 2-D plane using either PCA or t-SNE, then colours each point by its assigned cluster label.

When the converter report contains cluster centres (K-Means, Faiss K-Means, Gaussian Mixture), the centres are projected through the same PCA reducer and rendered as distinct × markers — only available with PCA because t-SNE does not support out-of-sample transforms.

Noise points produced by density-based algorithms (DBSCAN / HDBSCAN, label -1) receive the dedicated label "Noise" and a neutral colour.

Select at least two numeric columns that were used to fit the clustering algorithm. The cluster label column is added automatically from the converter report and must not be included in the selection.

Parameters​

reduction_method : string, default=pca
Dimensionality reduction method used to project the selected features onto two dimensions. 'pca' is fast and deterministic; 'tsne' can better reveal non-linear cluster structure but is slower and stochastic.

Methods​

get_results(self, exploration_path: str, options: Dict[str, Any]) -> Dict[str, Any]

Defined on ClusteringScatterExplorer

Load the saved scatter plot and return it for the frontend.

Parameters

exploration_path : str
Path to the JSON file saved by save_notebook.
options : Dict[str, Any]
Rendering options from the frontend (unused).

Returns

Dict[str, Any]
Dictionary with keys "data" (JSON-serialised Plotly figure), "type" ("plotly_json"), and "config" (empty dict).

launch_exploration(self, dataset: 'DashAIDataset', explorer_info: DashAI.back.dependencies.database.models.Explorer) -> Any

Defined on ClusteringScatterExplorer

Project features to 2D and build a scatter plot coloured by cluster.

Parameters

dataset : DashAIDataset
Dataset with the selected feature columns and the cluster label column (injected by prepare_dataset).
explorer_info : Explorer
Explorer record with column descriptors and optional custom title.

Returns

plotly.graph_objects.Figure
An interactive 2-D scatter plot figure.

prepare_dataset(self, loaded_dataset: 'DashAIDataset', columns: List[Dict[str, Any]]) -> 'DashAIDataset'

Defined on ClusteringScatterExplorer

Extend column selection to include the cluster label column.

Parameters

loaded_dataset : DashAIDataset
The full dataset.
columns : List[Dict[str, Any]]
Feature column descriptors selected by the user (a subset of the columns used during the last Clustering converter fit).

Returns

DashAIDataset
Dataset restricted to the selected feature columns plus the cluster label column.

save_notebook(self, notebook_info: DashAI.back.dependencies.database.models.Notebook, explorer_info: DashAI.back.dependencies.database.models.Explorer, save_path: 'Path', result: Any) -> str

Defined on ClusteringScatterExplorer

Save the scatter plot figure to disk as a JSON file.

Parameters

notebook_info : Notebook
The notebook database record (unused).
explorer_info : Explorer
The explorer record used for filename generation.
save_path : Path
Directory where the file will be saved.
result : Any
The Plotly figure returned by launch_exploration.

Returns

str
The path of the saved JSON file as a POSIX string.

get_credential(self, name: str)

Defined on ConfigObject

Resolve 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]

Defined on BaseExplorer

Get metadata for the explorer, used by the DashAI frontend.

Returns

Dict[str, Any]
Dictionary containing display name, description, image preview path, category, icon, color, allowed semantic types, allowed dtypes, input cardinality constraints, and any optional capability flags declared by the explorer.

get_schema(cls) -> dict

Defined on ConfigObject

Generates the component related Json Schema.

Returns

dict
Dictionary representing the Json Schema of the component.

set_context(self, context: Dict[str, Any]) -> None

Defined on BaseExplorer

Set optional runtime context for explorers that need extra inputs.

validate_and_transform(self, raw_data: dict) -> dict

Defined on ConfigObject

It 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.

validate_columns(cls, explorer_info: DashAI.back.dependencies.database.models.Explorer, column_spec: Dict[str, Dict[str, str]]) -> bool

Defined on BaseExplorer

Validate that the selected columns satisfy the explorer's constraints.

Parameters

explorer_info : Explorer
The database record for the explorer instance, including the selected columns.
column_spec : Dict[str, Dict[str, str]]
A mapping from column name to a dict with at least "type" (semantic type name) and "dtype" (dtype string).

Returns

bool
True if all column constraints are satisfied, False otherwise.

validate_parameters(cls, params: Dict[str, Any]) -> bool

Defined on BaseExplorer

Validate explorer parameters against the explorer's schema.

Parameters

params : Dict[str, Any]
The configuration parameters to validate.

Returns

BaseExplorerSchema
The validated and parsed schema instance. Subclasses that override this method may return a bool to indicate pass/fail without returning the model instance.