Skip to main content

A feature attribution explainability method for dimensionality reduction algorithms.

Project description

FADEx

A feature attribution for dimensionality reduction algorithms.

FADEx is a feature attribution method designed for dimensionality reduction (DR) algorithms. It locally approximates the mapping function of the DR algorithm using a Taylor expansion and derives feature importance scores through a Singular Value Decomposition (SVD). The local approximation is constructed via Radial Basis Function (RBF) interpolation, while the Jacobian matrix is estimated using the finite difference method.

When the data is mapped to a two-dimensional space by the DR algorithm, the importance of each high-dimensional feature $j$ is given by:

$$ \phi_j = \left|v_{1j} x_j\right| + \frac{\lambda_2}{\lambda_1} \left|v_{2j} x_j\right| $$

where $v_{ij}$ denotes the $j$-th entry of the $i$-th right singular vector, $\lambda_i$ is the $i$-th singular value, and $x_j$ is the value of feature $j$.

Installation

Use the following command in your terminal to install the module without the GPU library dependencies:

pip install fadex-exp

If you want to enable GPU acceleration, you need to install the RAPIDS framework. Please follow the official instructions at https://rapids.ai/start.html.

FADEx Class

Class Constructor

The FADEx Class has the following signature:

def __init__(self, high_dim_data: np.ndarray, low_dim_data: np.ndarray, 
                n_neighbors: int = None, feature_names: list = None, 
                classes_names: list = None, RBF_kernel: str = 'cubic',
                pre_dr : int = None, RBF_epsilon : float = 0.001, 
                RBF_degree : float = 1, RBF_smoothing : float = 0, 
                use_GPU : bool = False, dist_sample : int = None):

Required Parameters

high_dim_data (n_samples, n_features) - High dimensional space
low_dim_data (n_samples, 2) - Low dimensional space
n_neighbors - Number of neighbors to consider in the local approximation. When it's None, the entire dataset will be used.

Optional Parameters

feature_names - A list with the feature names.
classes_names - A list with the class for each sample.
RBF_kernel, RBF_epsilon, RBF_degree, and RBF_smoothing - RBFInterpolator parameters.
pre_dr - If provided, a preliminary dimensionality reduction (PCA) is applied to the high-dimensional data, reducing it to pre_dr dimensions before computing the step size in the finite differences method. This is crucial to avoid the curse of dimensionality.
dist_sample - The number of samples to use for distance computation. If set to None, all data points are used. This parameter helps reduce memory consumption.
use_GPU - If True, uses GPU acceleration for computations.

Fit Method

def fit(self, explain_index : int, show : bool = True, width : int = 10, height : int = 8, batch_size : int = 200):

This method applies the FADEx algorithm to a single data instance. When show=True, it displays the feature importance ranking for that specific point, as illustrated below:

fit importance ranking

Importance Plot

def importance_plot(self, width : int = 10, height : int = 8, n_top : int = 10):

This method applies the FADEx algorithm to the entire dataset, sums the importance values for each feature, and plots a general feature importance ranking, as shown below:

importance plot

Interactive Plot

def interactive_plot(self, width : int = 10, height : int =8):

This method applies the FADEx algorithm to the entire dataset and displays the results for each individual point in an interactive plot. The points are colored according to their spectral norm's deviation from 1, with red indicating the most distorted points and green indicating the least distorted ones.

interactive plot

Project details


Download files

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

Source Distribution

fadex_exp-0.1.0.tar.gz (8.9 kB view details)

Uploaded Source

Built Distribution

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

fadex_exp-0.1.0-py3-none-any.whl (8.9 kB view details)

Uploaded Python 3

File details

Details for the file fadex_exp-0.1.0.tar.gz.

File metadata

  • Download URL: fadex_exp-0.1.0.tar.gz
  • Upload date:
  • Size: 8.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.8

File hashes

Hashes for fadex_exp-0.1.0.tar.gz
Algorithm Hash digest
SHA256 a3c40b16748fe005e0483edb1834aeaed879679b0e11dfdcc11a0cd9709d6abf
MD5 b1767675ed3df8b3a2a0f8e827dc3838
BLAKE2b-256 78f64aae17a4050ebc8b1f99ea3d07f5290256e2f274f9013e4663953fef18ad

See more details on using hashes here.

File details

Details for the file fadex_exp-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: fadex_exp-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 8.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.8

File hashes

Hashes for fadex_exp-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1659cf0177251bc1c486b4d478f0d336783d14c23c417cdc9aa290675ef257f7
MD5 d0018ff66aa03d729437213c8e4452b3
BLAKE2b-256 cac667b1ceaf657838fc06f796688e5f4ba15f7803c30f90a3a79dc280759364

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