Python implementation of partial least squares correlation (PLSC)
Background
PLSC is a multivariate statistical technique used in neuroscience (McIntosh et al., 1994; McIntosh & Lobaugh, 2004; Krishnan et al., 2011), among other fields. It uses compact singular value decomposition (SVD) to analyze relationships between a multivariate data array and a design matrix. When the object of study is brain-behaviour correlations or functional connectivity, this method is referred to as "behaviour PLSC" or "seed PLSC". In pyplsc, these are implemented by the PLSC model class.
Multivariate categorical differences across experimental conditions can also be analyzed by applying SVD to matrices of condition-wise averages. This approach is called "mean-centred PLSC" or "barycentric discriminant analysis" (BDA; Abdi et al., 2018) and is implemented in pyplsc by the BDA model class.
Finally, associations between continuous variables within participants (e.g., trial-by-trial ratings versus brain data) can be analyzed using within-participants PLSC (Roberts et al., 2016) as implemented in the WPLSC model class.
Installation
pyplsc can be installed from PyPI with:
pip install pyplsc
pyplsc is tested with Python 3.10 and above but may also work with earlier versions.
Usage
pyplsc replicates the statistical functionality of the PLS Matlab package, much like the pyls library. A major difference is that pyplsc uses a scikit-learn-style model-fitting syntax and accepts tabular (pandas.DataFrame) input:
from pyplsc import PLSC, BDA
mod = PLSC(random_state=123)
mod.fit(data=data_array, covariates=cov_table)
Permutation testing and bootstrap resampling are then run as separate steps (possibly in parallel using the n_jobs parameter):
perm_dist = mod.permute(n_perm=1000, n_jobs=3)
boot_dist = mod.bootstrap(n_boot=1000)
In contrast to other PLS implementations, pyplsc does not require data to be pre-sorted by (between-participant) group and (within-participant) condition:
mod = BDA()
mod.fit(data=data_array,
labels=design_matrix_dataframe)
See the documentation for more details and examples.
Metadata
Release files for pyplsc 0.0.41
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| pyplsc-0.0.41.tar.gz | 24.6 kB | Without provenance | Details for pyplsc-0.0.41.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pyplsc-0.0.41-py3-none-any.whl | Python 3 | none | any | Details for pyplsc-0.0.41-py3-none-any.whl |
Total release size: 46.6 kB
Release files / pyplsc-0.0.41.tar.gz
| Download URL | pyplsc-0.0.41.tar.gz |
|---|---|
| Size | 24.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
82a11b47472553df233688f826d3c116a3904006cbd76a578f7f0e59e1147dc4
|
|
BLAKE2b-256 checksum How to use checksums |
ab5f464762bb0983241561fb817825f28640cf4cbcf4a5bb62dde4d23dc9de06
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Release files / pyplsc-0.0.41-py3-none-any.whl
| Download URL | pyplsc-0.0.41-py3-none-any.whl |
|---|---|
| Size | 22.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
2206c86745025ef308d712bb1e9db2c161b1ae26efd2fcac58dee826da5c1b6c
|
|
BLAKE2b-256 checksum How to use checksums |
22eef85d82f37d602e84ab20904998d9d62e32089c8ecd06017e7e9e469af908
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Security for pyplsc 0.0.41
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.