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.

Installation

To use the mcsi module, you can install it directly via pip:

pip install mcsi

Usage

Importing the Module

To use the mcsi function in your python code, import the module as follows:

import mcsi

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.1-cp313-cp313-win_amd64.whl (95.0 kB view details)

Uploaded CPython 3.13Windows x86-64

File details

Details for the file mcsi-2025.0.1-cp313-cp313-win_amd64.whl.

File metadata

  • Download URL: mcsi-2025.0.1-cp313-cp313-win_amd64.whl
  • Upload date:
  • Size: 95.0 kB
  • Tags: CPython 3.13, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.3

File hashes

Hashes for mcsi-2025.0.1-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 1a09e88933f4a976020eb5b2dde33b868224bce2c9a72752b370a0be2ebb2062
MD5 047baad419392e77276aa040962dcbfd
BLAKE2b-256 bfbcc3211ff78b5d5f4e7f3f880ed5f1229f7d33bba46d6267870f6765f4bf1d

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