CorrelationMatrixExplorer
Explorer that computes and visualises pairwise correlation coefficients.
A correlation matrix contains one coefficient for every pair of selected columns. Each coefficient ranges from -1 to +1: values near +1 indicate a strong positive relationship, values near -1 indicate a strong negative relationship, and values near 0 indicate little or no linear (or monotonic) association.
By default the result is rendered as an annotated heatmap where warm colours
represent high positive correlation and cool colours represent high negative
correlation, making it easy to scan for strongly related feature pairs at a
glance. Setting plot=False returns the raw correlation DataFrame instead,
which is useful for downstream numerical analysis.
Use this explorer to detect multicollinearity between features before modelling, to identify the features most correlated with a target variable, or to understand the overall dependency structure of a dataset.
Parameters
- method : string, default=
pearson - Correlation method to use: 'pearson', 'kendall', or 'spearman'.
- min_periods : integer, default=
1 - Minimum observations required per column pair to have a valid result. Used only with 'pearson' or 'spearman'.
- numeric_only : boolean, default=
True - If True, include only numeric columns when calculating correlation; otherwise include all columns.
- plot : boolean, default=
True - If True, the result will be plotted.
Methods
get_results(self, exploration_path: str, options: Dict[str, Any]) -> Dict[str, Any]
CorrelationMatrixExplorerLoad and return the saved correlation result 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"(Plotly JSON string when plotting, or nested dict of the correlation matrix otherwise),"type"("plotly_json"when plotting, or"tabular"otherwise), and"config"(empty dict when plotting, or{"orient": "dict"}otherwise).
launch_exploration(self, dataset: 'DashAIDataset', explorer_info: DashAI.back.dependencies.database.models.Explorer) -> Any
CorrelationMatrixExplorerCompute a correlation matrix and optionally render it as a Plotly heatmap.
Parameters
- dataset : DashAIDataset
- The dataset whose columns will be correlated.
- explorer_info : Explorer
- The explorer database record used for the plot title and column count.
Returns
- Any
- A
plotly.graph_objs.Figureheatmap whenself.plotisTrue, or apandas.DataFramecontaining the correlation matrix whenself.plotisFalse.
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
CorrelationMatrixExplorerSave the correlation result to a JSON file on disk.
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 result returned by
launch_exploration— either aplotly.graph_objs.Figureor apandas.DataFrame.
Returns
- str
- The path of the saved JSON file as a POSIX string.
get_metadata(cls) -> Dict[str, Any]
BaseExplorerGet 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 dtypes, restricted dtypes, and input cardinality constraints.
get_schema(cls) -> dict
ConfigObjectGenerates the component related Json Schema.
Returns
- dict
- Dictionary representing the Json Schema of the component.
prepare_dataset(self, loaded_dataset: 'DashAIDataset', columns: List[Dict[str, Any]]) -> 'DashAIDataset'
BaseExplorerPrepare the dataset by selecting only the columns needed for this exploration.
Parameters
- loaded_dataset : DashAIDataset
- The full dataset loaded from storage.
- columns : List[Dict[str, Any]]
- List of column descriptor dicts, each containing at least
"columnName". Optional keys:"id","valueType","dataType".
Returns
- DashAIDataset
- Dataset restricted to the requested columns.
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.
validate_columns(cls, explorer_info: DashAI.back.dependencies.database.models.Explorer, column_spec: Dict[str, Dict[str, str]]) -> bool
BaseExplorerValidate 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 a
"type"key describing the column's data type.
Returns
- bool
- True if all column constraints are satisfied, False otherwise.
validate_parameters(cls, params: Dict[str, Any]) -> bool
BaseExplorerValidate 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.