Skip to main content

Calculates skewness of a distribution based on the mean, Mean-Centered Skewness Index (MCSI)

Project description

Mean-Centered Skewness Index (MCSI)

The Mean-Centered Skewness Index (MCSI) is a statistical operator for analyzing the skewness of tensor data. Built with PyTorch and C++, the mcsi function efficiently quantifies the directional imbalance of tensor values relative to their mean across one or more dimensions.


Key Features

  • Compatible with PyTorch tensors.
  • Configurable reduction dimensions (dim) and shape preservation (keepdim).
  • Efficient implementation as a PyTorch extension using C++ and Pybind11.
  • Provides meaningful insights into the asymmetry of data distributions.

Mathematical Representation

Let $\mathbf{X} \in \mathbb{R}^{n_1 \times n_2 \times \dots \times n_k}$ represent an input tensor. The Mean-Centered Skewness Index for dimension(s) $d$ is defined as:

$$ \text{MCSI}(\mathbf{X}, d) = \frac{N_-(\mathbf{X}, d) - N_+(\mathbf{X}, d)}{N(\mathbf{X}, d)} $$

Where:

  • $N_-(\mathbf{X}, d)$: Number of elements in $\mathbf{X}$ less than the mean along the specified dimensions $d$.
  • $N_+(\mathbf{X}, d)$: Number of elements in $\mathbf{X}$ greater than the mean along $d$.
  • $N(\mathbf{X}, d)$: Total number of elements in $\mathbf{X}$ along $d$.

The mean along dimension(s) $d$ is given by: $$ \mu(\mathbf{X}, d) = \frac{1}{N(\mathbf{X}, d)} \sum_{i \in d} X_i $$

MCSI effectively measures the imbalance in the count of values above and below the mean, normalized by the total number of elements.


Function Signature

mcsi(input: torch.Tensor, dim: Optional[Union[int, List[int]]] = None, keepdim: bool = False) -> torch.Tensor

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mcsi-2025.0.0-cp312-cp312-win_amd64.whl (94.8 kB view details)

Uploaded CPython 3.12Windows x86-64

File details

Details for the file mcsi-2025.0.0-cp312-cp312-win_amd64.whl.

File metadata

  • Download URL: mcsi-2025.0.0-cp312-cp312-win_amd64.whl
  • Upload date:
  • Size: 94.8 kB
  • Tags: CPython 3.12, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.12.2

File hashes

Hashes for mcsi-2025.0.0-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 64525ddba9ed5343ffc93fa3dcdbe867ae2a13a9bb69daa86605d67e5db1114d
MD5 3a5d94b42415a718e9d1b27bdc0060b2
BLAKE2b-256 4bc3184864921129033f29a190bfbda54864a7af65d786ac3ef1347873a9f4f4

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page