Skip to main content

An implementation of the most common partial least squares algorithms as multi-block methods

Project description

License Documentation Status JOSS Paper DOI

This is a newly maintained version of the MBPLS software originally developed by Andreas Baum and Laurent Vermue (homepage: https://github.com/DTUComputeStatisticsAndDataAnalysis/MBPLS/). This maintained version has been updated to be compatible with Python 3.8 and later. Lukas Kopecky, April 2026.

An easy to use Python package for (Multiblock) Partial Least Squares prediction modelling of univariate or multivariate outcomes. Four state of the art algorithms have been implemented and optimized for robust performance on large data matrices. The package has been designed to be able to handle missing data, such that application is straight forward using the commonly known Scikit-learn API and its model selection toolbox.

The documentation is available at https://mbpls.readthedocs.io and elaborate (real-world) Jupyter Notebook examples can be found at https://github.com/kopeckylukas/MB-PLS/tree/master/examples

This package can be cited using the following reference.

Baum et al., (2019). Multiblock PLS: Block dependent prediction modeling for Python. Journal of Open Source Software, 4(34), 1190

Installation

  • Install the package for Python3 using the following command. Some dependencies might require an upgrade (scikit-learn, numpy and scipy).
    $ pip install multiblock-pls
  • Now you can import the MBPLS class by typing
    from mbpls.mbpls import MBPLS

Quick Start

Use the mbpls package for Partial Least Squares (PLS) prediction modeling

import numpy as np
from mbpls.mbpls import MBPLS

num_samples = 40
num_features = 200

# Generate random data matrix X
x = np.random.rand(num_samples, num_features)

# Generate random reference vector y
y = np.random.rand(num_samples,1)

# Establish prediction model using 2 latent variables (components)
pls = MBPLS(n_components=2)
pls.fit(x,y)
y_pred = pls.predict(x)

The mbpls package for Multiblock Partial Least Squares (MB-PLS) prediction modeling

import numpy as np
from mbpls.mbpls import MBPLS

num_samples = 40
num_features_x1 = 200
num_features_x2 = 250

# Generate two random data matrices X1 and X2 (two blocks)
x1 = np.random.rand(num_samples, num_features_x1)
x2 = np.random.rand(num_samples, num_features_x2)

# Generate random reference vector y
y = np.random.rand(num_samples, 1)

# Establish prediction model using 3 latent variables (components)
mbpls = MBPLS(n_components=3)
mbpls.fit([x1, x2],y)
y_pred = mbpls.predict([x1, x2])

# Use built-in plot method for exploratory analysis of multiblock pls models
mbpls.plot(num_components=3)

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

multiblock_pls-1.1.0.tar.gz (23.4 kB view details)

Uploaded Source

Built Distribution

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

multiblock_pls-1.1.0-py3-none-any.whl (23.3 kB view details)

Uploaded Python 3

File details

Details for the file multiblock_pls-1.1.0.tar.gz.

File metadata

  • Download URL: multiblock_pls-1.1.0.tar.gz
  • Upload date:
  • Size: 23.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.12

File hashes

Hashes for multiblock_pls-1.1.0.tar.gz
Algorithm Hash digest
SHA256 ded64129da34d4e02062e9016e14243251ecbd5c2b64838eb05522a9101ba5f6
MD5 61b0a24332460006bc22943ff4d0b5fa
BLAKE2b-256 88c37336afca7d94fc4d941f48ebc6bfc0f9a0892959a1d787f3027d28042f01

See more details on using hashes here.

File details

Details for the file multiblock_pls-1.1.0-py3-none-any.whl.

File metadata

  • Download URL: multiblock_pls-1.1.0-py3-none-any.whl
  • Upload date:
  • Size: 23.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.12

File hashes

Hashes for multiblock_pls-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e77ec5a0169e851de7a4f1172713216302c90b9c8dfdfaf90b6a0548ce8a4cf0
MD5 8571ff17cde080805b29d1d96fc613ca
BLAKE2b-256 3538a2a75e313e3d3229100eda24c16f32303d4c567a23b1534504360cfdbe25

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