direpack: a Python 3 library for state-of-the-art statistical dimension reduction techniquesThis package delivers a scikit-learn compatible Python 3 package for sundry state-of-the art multivariate statistical methods, with
a focus on dimension reduction.
The categories of methods delivered in this package, are:
- Projection pursuit dimension reduction (ppdire)
- Sufficient dimension reduction (sudire)
- Robust M-estimators for dimension reduction (sprm)
each of which are presented as scikit-learn compatible objects in the corresponding folders.
We hope that this package leads to scientific success. If it does so, we kindly ask to cite the official direpack publication [0], as well as the original publication of the corresponding method.
The package also contains a set of tools for pre- and postprocessing:
- The preprocessing folder provides classical and robust centring and scaling, as well as spatial sign transforms [4] and the robbustness inducing wrapping transformation [15].
- The dicomo folder contains a versatile class to access a wide variety of moment and co-moment statistics, and statistics derived from those. Check out the dicomo Documentation file and the dicomo Examples Notebook.
- Plotting utilities in the plot folder
- Cross-validation utilities in the cross-validation folder

sprm foldersprm.py) [1]snipls.py)rm.py)_m_support_functions.py)ppdire folderThe ppdire class will give access to a wide range of projection pursuit dimension reduction techniques.
These include slower approximate estimates for well-established methods such as PCA, PLS and continuum regression.
However, the class provides unique access to a set of robust options, such as robust continuum regression (RCR) [5], through its native grid optimization algorithm, first
published for RCR as well [6]. Moreover, ppdire is also a great gateway to calculate generalized betas, using the CAPI projection index [7].
The code is orghanized in
- ppdire.py - the main PP dimension reduction class
- capi.py - the co-moment analysis projection index.
sudire folderThe sudire folder gives access to an extensive set of methods that resort under the umbrella of sufficient dimension reduction.
These range from meanwhile long-standing, well-accepted approaches, such as sliced inverse regression (SIR) and the closely related SAVE [8,9],
through methods such as directional regression [10] and principal Hessian directions [11], and more. However, the package also contains some
of the most recently developed, state-of-the-art sufficient dimension reduction techniques, that require no distributional assumptions.
The options provided in this category are based on energy statistics (distance covariance [12] or martingale difference divergence [13]) and
ball statistics (ball covariance) [14]. All of these options can be called by setting the corresponding parameters in the sudire class, cf. the docs.
Note: the ball covariance option will require some lines to be uncommented as indicated. We decided not to make that option generally available,
since it depends on the Ball package that seems to be difficult to install on certain architectures.
The package is distributed through PyPI, so install through:
pip install direpack
Note that some of the key methods in the sudire subpackage rely on the IPOPT
optimization package, which according to their recommendation, can best be installed
directly as:
conda install -c conda-forge cyipopt
direpack publication. dicomo, ppdire, sprm and sudire classes are presented as Jupyter notebooks in the examples folderdirepack: A Python 3 package for state-of-the-art statistical dimensionality reduction methods, Emmanuel Jordy Menvouta, Sven Serneels, Tim Verdonck, SoftwareX, 21 (2023), 101282.Release Notes can be checked out in the repository.
A list of possible topics for further development is provided as well. Additions and comments are welcome!
$ claude mcp add direpack \
-- python -m otcore.mcp_server <graph>