Skip to content

Feature implementation sst#274

Merged
paucablop merged 18 commits into
mainfrom
feature-implementation-sst
May 25, 2026
Merged

Feature implementation sst#274
paucablop merged 18 commits into
mainfrom
feature-implementation-sst

Conversation

@inarteroger
Copy link
Copy Markdown
Collaborator

Why is this change needed?

Adds the Spectral Space Transform (SST) transformer to the chemotools.adaptation
module. SST is a linear domain adaptation method that aligns target spectral data
to a source (reference) domain via SVD of the concatenated source-target matrix.
This extends the adaptation module alongside the existing DS and PDS transformers.

Type of change

  • New feature

Description

Implementation of SpectralSpaceTransform following the method described in:

Du et al. (2011). Maintaining the predictive abilities of multivariate calibration models by spectral space transformation.
Analytica Chimica Acta, 690(1), 64–70.
https://doi.org/10.1016/j.aca.2011.02.014

What was added

  • SpectralSpaceTransform transformer in chemotools/adaptation/_spectral_space_transform.py
  • Full sklearn API compliance (fit, transform, fit_transform)
  • Identity fallback when X_source=None

Tests added

  • sklearn estimator compliance
  • fit attributes and shape checks
  • boundary and edge case validation for n_components
  • Pipeline + GridSearchCV + metadata routing integration

@inarteroger inarteroger requested a review from paucablop May 22, 2026 08:19
@inarteroger inarteroger self-assigned this May 22, 2026
@inarteroger inarteroger added the enhancement New feature or request label May 22, 2026
@paucablop paucablop requested a review from Copilot May 23, 2026 05:23
@paucablop paucablop moved this to Review in CHEMOTOOLS May 23, 2026
@paucablop paucablop added this to the v0.5.0 milestone May 23, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a new domain-adaptation transformer, Spectral Space Transform (SST), to align target spectra to a source/reference domain using an SVD-based shared latent space approach, plus a comprehensive test suite to validate sklearn compatibility and expected behavior.

Changes:

  • Implement SpectralSpaceTransform (fit/transform) with optional identity behavior when X_source=None.
  • Add extensive tests covering sklearn compliance, correctness snapshots, edge cases for n_components, and Pipeline/GridSearchCV metadata routing.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 6 comments.

File Description
chemotools/adaptation/_spectral_space_transform.py Introduces the SST transformer implementation, including parameter constraints, fitting logic, and the transformation formula.
tests/adaptation/test_spectral_space_transform.py Adds sklearn compliance checks, numerical regression tests, edge-case validation, and metadata-routing integration tests for SST.
Comments suppressed due to low confidence (1)

tests/adaptation/test_spectral_space_transform.py:258

  • Typo in docstring: "rises ValueError" should be "raises ValueError".
        """Verifies n_components > 2*n_features rises ValueError."""

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread chemotools/adaptation/_spectral_space_transform.py
Comment thread chemotools/adaptation/_spectral_space_transform.py Outdated
Comment thread chemotools/adaptation/_spectral_space_transform.py Outdated
Comment thread chemotools/adaptation/_spectral_space_transform.py Outdated
Comment thread chemotools/adaptation/_spectral_space_transform.py
Comment thread tests/adaptation/test_spectral_space_transform.py Outdated
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 13 out of 13 changed files in this pull request and generated 3 comments.

Comment thread chemotools/adaptation/_x_axis_interpolator.py
Comment thread chemotools/adaptation/_piecewise_direct_standardization.py
Comment thread chemotools/adaptation/_spectral_space_transform.py Outdated
@paucablop paucablop merged commit 2c2a57c into main May 25, 2026
23 checks passed
@github-project-automation github-project-automation Bot moved this from Review to Testing in CHEMOTOOLS May 25, 2026
@paucablop paucablop deleted the feature-implementation-sst branch May 25, 2026 15:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

Status: Testing

Development

Successfully merging this pull request may close these issues.

3 participants