Skip to main content

ConfusionMatrix

Report
DashAI.back.reports.classification.ConfusionMatrix

K x K grid of true class against predicted class.

Reading the grid tells you which classes a model confuses, which the scalar accuracy summarising it cannot: two models with identical accuracy can fail in completely different places. Off diagonal mass concentrated in one cell means a systematic confusion between that pair of classes; mass spread evenly across a row means the model has no signal for that class.

References

Parameters

normalize : string, default=none
How to normalise the counts. 'none' shows raw counts, 'true' divides each row by its true class total (recall per class), 'pred' divides each column by its predicted total (precision per class).

Methods

compute(self, y_true, y_pred, class_names: Optional[List[str]] = None) -> List[DashAI.back.core.artifacts.Artifact]

Defined on ConfusionMatrix

Build the confusion matrix heatmap.

Parameters

y_true : ndarray
Encoded true class indexes.
y_pred : ndarray
Model predictions, probabilities or hard labels.
class_names : Optional[List[str]]
Class labels in encoded order.

Returns

List[Artifact]
A single heatmap artifact.

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 BaseReport

Get metadata values for the current report.

Returns

Dict[str, Any]
UI metadata, including whether the report needs a model that outputs class probabilities.

get_schema(cls) -> dict

Defined on ConfigObject

Generates the component related Json Schema.

Returns

dict
Dictionary representing the Json Schema of the component.

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.

Compatible with