Skip to content

statistic

Handle statistics.

Classes:

Name Description
Stat

Represents a statistic for the explainable model.

HistogramStat

Histogram statistics metric.

VarianceStat

Histogram statistics metric.

DistributionStat

Distribution statistics metric.

DictStats

Dictionary of statistics (torch eval etc...) used in training or explain.

Stat #

Represents a statistic for the explainable model.

HistogramStat #

Histogram statistics metric.

Parameters:

Name Type Description Default

on #

Literal['input', 'target', 'prediction', 'prediction_error']

Data type to compute the statistic on.

required

num_bins #

int

Number of bins linearly spaced to compute from the sampled items.

required

num_items #

int

Number total of items to sample from the data to approximate a histogram, as not all samples are used for memory efficiency.

required

on_raw_data #

bool

Whether to compute the statistic on the raw spce or on the preprocessed space.

required

feature_name #

str | None

In case of "input" data type, the statistic will be computed only for the feature named feature_name. If None, it will compute the statistic on the schema first feature.

None

Attributes:

Name Type Description
on Literal['input', 'target', 'prediction', 'prediction_error']
num_bins int
num_items int
on_raw_data bool
feature_name str | None

on: Literal['input', 'target', 'prediction', 'prediction_error'] #

num_bins: int #

num_items: int #

on_raw_data: bool #

feature_name: str | None = None #

VarianceStat #

Histogram statistics metric.

Parameters:

Name Type Description Default

on #

Literal['input', 'target', 'prediction', 'prediction_error']

Data type to compute the statistic on.

required

on_raw_data #

bool

Whether to compute the statistic on the raw spce or on the preprocessed space.

required

feature_name #

str | None

In case of "input" data type, the statistic will be computed only for the feature named feature_name. If None, it will compute the statistic on the schema first feature.

None

Attributes:

Name Type Description
on Literal['input', 'target', 'prediction', 'prediction_error']
on_raw_data bool
feature_name str | None

on: Literal['input', 'target', 'prediction', 'prediction_error'] #

on_raw_data: bool #

feature_name: str | None = None #

DistributionStat #

Distribution statistics metric.

The distribution is always computed on the preprocessed space as it requires one-hot vectors for the categorical feature.

Parameters:

Name Type Description Default

on #

Literal['input', 'target', 'prediction', 'prediction_error']

Data type to compute the statistic on.

required

feature_name #

str | None

In case of "input" data type, the statistic will be computed only for the feature named feature_name. If None, it will compute the statistic on the schema first feature.

None

Attributes:

Name Type Description
on Literal['input', 'target', 'prediction', 'prediction_error']
feature_name str | None

on: Literal['input', 'target', 'prediction', 'prediction_error'] #

feature_name: str | None = None #

DictStats #

Dictionary of statistics (torch eval etc...) used in training or explain.

Each stat will be computed globally (for the whole model) and per leaf.

Stats are displayed in XpViz along with explanations. Dictionary keys are will be used as metric names in XpViz.