pyls: Partial Least Squares in Python

This package provides a Python interface for performing partial least squares (PLS) analyses.

Installation requirements

Currently, pyls works with Python 3.5+ and requires a few dependencies:

  • h5py

  • numpy

  • scikit-learn

  • scipy, and

  • tqdm

Assuming you have the correct version of Python installed, you can install pyls by opening a terminal and running the following:

git clone
cd pyls
python install

All relevant dependencies will be installed alongside the pyls module.


There are a number of ways to use pyls, depending on the type of analysis you would like to perform. Assuming you have two matrices X and Y representing different observations from a set of samples (i.e., subjects, neurons, brain regions), you can run a simple analysis with:

>>> import pyls
>>> results = pyls.behavioral_pls(X, Y)

For detailed information on the different methods available and how to interpret the results object, please refer to our user guide.

Development and getting involved

If you’ve found a bug, are experiencing a problem, or have a question about using the package, please head on over to our GitHub issues and make a new issue with some information about it! Someone will try and get back to you as quickly as possible, though please note that the primary developer for pyls (@rmarkello) is a graduate student so responses make take some time!

If you’re interested in getting involved in the project: welcome ✨! We’re thrilled to welcome new contributors. You should start by reading our code of conduct; all activity on pyls should adhere to the CoC. After that, take a look at our contributing guidelines so you’re familiar with the processes we (generally) try to follow when making changes to the repository! Once you’re ready to jump in head on over to our issues to see if there’s anything you might like to work on.

License Information

This codebase is licensed under the GNU General Public License, version 2. The full license can be found in the LICENSE file in the pyls distribution.

All trademarks referenced herein are property of their respective holders.