Talip7/scikit-learn-issues-multilabel huggingface dataset:
RFC: Add deflation process to PLSSVD

### Describe the workflow you want to enable

At the moment, `PLSSVD` performs SVD once on $X^TY$ and uses the singular vectors in the transform method. However, PLS-SVD in the literature often includes a deflation step.

The [reference paper](https://stat.uw.edu/sites/default/files/files/reports/2000/tr371.pdf) in the [User Guide](https://scikit-learn.org/stable/modules/cross_decomposition.html) mentions an additional deflation step. On page 15, the paper states that for the second component, the updated value in PLS-SVD is

$$X^TY-d_1u_1v_1^T.$$

Other sources like [this paper](https://hal.science/hal-00300204/document) also include deflation process for PLS-SVD.

### Describe your proposed solution

I propose two options for implementation.
1. Implement `deflation_mode='covariance'` in `_PLS` and have `PLSSVD` inherit from it.
2. Deprecate `PLSSVD` and implement `algorithm='pls_svd'` in `_PLS`. 

The first option would be easier to implement without disrupting the existing code.

### Describe alternatives you've considered, if relevant

If this is by design, we should add a note to the User Guide and the docstring to avoid confusion.

### Additional context

The User Guide and the docstring explicitly outline the current process, but I'm not sure if this implementation is different from the common conception of PLS-SVD dy design.

COMMENT:
>  The [reference paper](https://stat.uw.edu/sites/default/files/files/reports/2000/tr371.pdf) in the [User Guide](https://scikit-learn.org/stable/modules/cross_decomposition.html) mentions an additional deflation step. On page 15, the paper states that for the second component, the updated value in PLS-SVD is

> $$X^TY-d_1u_1v_1^T.$$

EDIT I am a bit confused by what deflation means (I am not a PLS expert). Here is the relevant snippet:

<img width="619" height="425" alt="Image" src="https://github.com/user-attachments/assets/75bd0cde-0ca7-43b0-9720-4caf56e9dfc9" />

What would the deflation step look like compared to the existing code?

@sotagg do you have a practical need for the deflation you ask for?

Labels: New Feature
RFC: Add deflation process to PLSSVD

### Describe the workflow you want to enable

At the moment, `PLSSVD` performs SVD once on $X^TY$ and uses the singular vectors in the transform method. However, PLS-SVD in the literature often includes a deflation step.

The [reference paper](https://stat.uw.edu/sites/default/files/files/reports/2000/tr371.pdf) in the [User Guide](https://scikit-learn.org/stable/modules/cross_decomposition.html) mentions an additional deflation step. On page 15, the paper states that for the second component, the updated value in PLS-SVD is

$$X^TY-d_1u_1v_1^T.$$

Other sources like [this paper](https://hal.science/hal-00300204/document) also include deflation process for PLS-SVD.

### Describe your proposed solution

I propose two options for implementation.
1. Implement `deflation_mode='covariance'` in `_PLS` and have `PLSSVD` inherit from it.
2. Deprecate `PLSSVD` and implement `algorithm='pls_svd'` in `_PLS`. 

The first option would be easier to implement without disrupting the existing code.

### Describe alternatives you've considered, if relevant

If this is by design, we should add a note to the User Guide and the docstring to avoid confusion.

### Additional context

The User Guide and the docstring explicitly outline the current process, but I'm not sure if this implementation is different from the common conception of PLS-SVD dy design.

COMMENT:
@ogrisel 
> What would the deflation step look like compared to the existing code?

Deflation is the process of subtracting one-rank approximation from a matrix iteratively. This process is implemented `_PLS`.

```python
# Deflation: subtract rank-one approx to obtain Xk+1 and yk+1
x_loadings = np.dot(x_scores, Xk) / np.dot(x_scores, x_scores)
Xk -= np.outer(x_scores, x_loadings)

if self.deflation_mode == "canonical":
    # regress yk on y_score
    y_loadings = np.dot(y_scores, yk) / np.dot(y_scores, y_scores)
    yk -= np.outer(y_scores, y_loadings)
if self.deflation_mode == "regression":
    # regress yk on x_score
    y_loadings = np.dot(x_scores, yk) / np.dot(x_scores, x_scores)
    yk -= np.outer(x_scores, y_loadings)
```

Currently, `PLSSVD` doesn't inherit from `_PLS`, so it doesn't perform any deflation at all. Note that PLS-SVD deflates $X^TY$ instead of $X$ and $Y$, and that's why I suggested adding a new `deflation_mode`.

>do you have a practical need for the deflation you ask for?

No. As @lesteve pointed out, it's a niche algorithm even in the PLS literature. My main motivation was to align the implementation more closely with the reference. I'm totally fine with just adding a note to the documentation.

Labels: New Feature
BUG: Test of BaseEstimator defined in test_multiclass.py instead of test_base.py

### Describe the bug

### Cause
Bug generated by PR #31928. 

Author misinterpreted the phrase "test_multiclass" in `sklearn/tests/test_multiclass.py` to mean that tests regarding multiple estimators should reside there. Based on this misunderstanding, a test checking behavior in `BaseEstimator` was defined in `sklearn/tests/test_multiclass.py` instead of `sklearn/tests/test_base.py`.

To clarify, multiclass actually refers to multiclass classification, which is how multiclass is generally defined in the Scikit-learn library.

### Source of Error 

https://github.com/j-hendricks/scikit-learn/blob/4756c87ffe71d44fce3501bc7f71164388fdfc0b/sklearn/tests/test_multiclass.py#L86-L99

### Proposed Fix
Move `test_conditional_attrs_not_in_dir` from `sklearn/tests/test_multiclass.py` to `sklearn/tests/test_base.py` as the behavior being tested is implemented in the `BaseEstimator` class (in base.py).

### Steps/Code to Reproduce

```
def test_conditional_attrs_not_in_dir():
    # Test that __dir__ includes only relevant attributes. #28558

    encoder = LabelEncoder()
    assert "set_output" not in dir(encoder)

    scalar = StandardScaler()
    assert "set_output" in dir(scalar)

    svc = SVC(probability=False)
    assert "predict_proba" not in dir(svc)

    svc.probability = True
    assert "predict_proba" in dir(svc)
```

### Expected Results

`test_conditional_attrs_not_in_dir` defined in `sklearn/tests/test_base.py`.

### Actual Results

`test_conditional_attrs_not_in_dir` defined in `sklearn/tests/test_multiclass.py`.

### Versions

```shell
main
```

COMMENT:
/assign

Labels: module:test-suite
BUG: Test of BaseEstimator defined in test_multiclass.py instead of test_base.py

### Describe the bug

### Cause
Bug generated by PR #31928. 

Author misinterpreted the phrase "test_multiclass" in `sklearn/tests/test_multiclass.py` to mean that tests regarding multiple estimators should reside there. Based on this misunderstanding, a test checking behavior in `BaseEstimator` was defined in `sklearn/tests/test_multiclass.py` instead of `sklearn/tests/test_base.py`.

To clarify, multiclass actually refers to multiclass classification, which is how multiclass is generally defined in the Scikit-learn library.

### Source of Error 

https://github.com/j-hendricks/scikit-learn/blob/4756c87ffe71d44fce3501bc7f71164388fdfc0b/sklearn/tests/test_multiclass.py#L86-L99

### Proposed Fix
Move `test_conditional_attrs_not_in_dir` from `sklearn/tests/test_multiclass.py` to `sklearn/tests/test_base.py` as the behavior being tested is implemented in the `BaseEstimator` class (in base.py).

### Steps/Code to Reproduce

```
def test_conditional_attrs_not_in_dir():
    # Test that __dir__ includes only relevant attributes. #28558

    encoder = LabelEncoder()
    assert "set_output" not in dir(encoder)

    scalar = StandardScaler()
    assert "set_output" in dir(scalar)

    svc = SVC(probability=False)
    assert "predict_proba" not in dir(svc)

    svc.probability = True
    assert "predict_proba" in dir(svc)
```

### Expected Results

`test_conditional_attrs_not_in_dir` defined in `sklearn/tests/test_base.py`.

### Actual Results

`test_conditional_attrs_not_in_dir` defined in `sklearn/tests/test_multiclass.py`.

### Versions

```shell
main
```

COMMENT:
Hey @Ansh13579, I created this issue as follow-up to #31928 which I authored. A few things to note:

- This issue is still in triage and hasn't been scoped by maintainers yet
- As the person who introduced the original misplacement, I have the context to fix this properly
- There's also a related functional issue in [#26941](https://github.com/scikit-learn/scikit-learn/issues/26941) that needs investigation

I'll be handling this as part of my follow-up work. For future reference, it's best to wait for triage completion and check with issue authors before self-assigning. Thanks for understanding!

Labels: module:test-suite
BUG: Test of BaseEstimator defined in test_multiclass.py instead of test_base.py

### Describe the bug

### Cause
Bug generated by PR #31928. 

Author misinterpreted the phrase "test_multiclass" in `sklearn/tests/test_multiclass.py` to mean that tests regarding multiple estimators should reside there. Based on this misunderstanding, a test checking behavior in `BaseEstimator` was defined in `sklearn/tests/test_multiclass.py` instead of `sklearn/tests/test_base.py`.

To clarify, multiclass actually refers to multiclass classification, which is how multiclass is generally defined in the Scikit-learn library.

### Source of Error 

https://github.com/j-hendricks/scikit-learn/blob/4756c87ffe71d44fce3501bc7f71164388fdfc0b/sklearn/tests/test_multiclass.py#L86-L99

### Proposed Fix
Move `test_conditional_attrs_not_in_dir` from `sklearn/tests/test_multiclass.py` to `sklearn/tests/test_base.py` as the behavior being tested is implemented in the `BaseEstimator` class (in base.py).

### Steps/Code to Reproduce

```
def test_conditional_attrs_not_in_dir():
    # Test that __dir__ includes only relevant attributes. #28558

    encoder = LabelEncoder()
    assert "set_output" not in dir(encoder)

    scalar = StandardScaler()
    assert "set_output" in dir(scalar)

    svc = SVC(probability=False)
    assert "predict_proba" not in dir(svc)

    svc.probability = True
    assert "predict_proba" in dir(svc)
```

### Expected Results

`test_conditional_attrs_not_in_dir` defined in `sklearn/tests/test_base.py`.

### Actual Results

`test_conditional_attrs_not_in_dir` defined in `sklearn/tests/test_multiclass.py`.

### Versions

```shell
main
```

COMMENT:
I agree that `test_conditional_attrs_not_in_dir` does not seem to belong there. @j-hendricks please go ahead with a PR.

Labels: module:test-suite
BUG: Test of BaseEstimator defined in test_multiclass.py instead of test_base.py

### Describe the bug

### Cause
Bug generated by PR #31928. 

Author misinterpreted the phrase "test_multiclass" in `sklearn/tests/test_multiclass.py` to mean that tests regarding multiple estimators should reside there. Based on this misunderstanding, a test checking behavior in `BaseEstimator` was defined in `sklearn/tests/test_multiclass.py` instead of `sklearn/tests/test_base.py`.

To clarify, multiclass actually refers to multiclass classification, which is how multiclass is generally defined in the Scikit-learn library.

### Source of Error 

https://github.com/j-hendricks/scikit-learn/blob/4756c87ffe71d44fce3501bc7f71164388fdfc0b/sklearn/tests/test_multiclass.py#L86-L99

### Proposed Fix
Move `test_conditional_attrs_not_in_dir` from `sklearn/tests/test_multiclass.py` to `sklearn/tests/test_base.py` as the behavior being tested is implemented in the `BaseEstimator` class (in base.py).

### Steps/Code to Reproduce

```
def test_conditional_attrs_not_in_dir():
    # Test that __dir__ includes only relevant attributes. #28558

    encoder = LabelEncoder()
    assert "set_output" not in dir(encoder)

    scalar = StandardScaler()
    assert "set_output" in dir(scalar)

    svc = SVC(probability=False)
    assert "predict_proba" not in dir(svc)

    svc.probability = True
    assert "predict_proba" in dir(svc)
```

### Expected Results

`test_conditional_attrs_not_in_dir` defined in `sklearn/tests/test_base.py`.

### Actual Results

`test_conditional_attrs_not_in_dir` defined in `sklearn/tests/test_multiclass.py`.

### Versions

```shell
main
```

COMMENT:
Thanks for the clarification @j-hendricks , and I appreciate the context you've shared. Since I'm still getting familiar with the contribution workflow, I understand now that it's best to wait for triage and check with issue authors before self-assigning. I'll keep that in mind going forward. Looking forward to learning more through this process!

Labels: module:test-suite
⚠️ CI failed on Wheel builder (last failure: Oct 04, 2025) ⚠️

**CI failed on [Wheel builder](https://github.com/scikit-learn/scikit-learn/actions/runs/18239153780)** (Oct 04, 2025)

COMMENT:
## CI is no longer failing! ✅

[Successful run](https://github.com/scikit-learn/scikit-learn/actions/runs/18253519266) on Oct 05, 2025

Labels: Needs Triage
Dark visual studio theme seems to mix fitted and unfitted colors on HTML

When using Dark Visual Studio theme and the pipeline is closed, the fonts and lines are yellow. But yellow is the color used when the estimators are not fitted. 

<img width="235" height="136" alt="Image" src="https://github.com/user-attachments/assets/dd4d7c17-5b3a-4c3f-a564-149b6475b4e8" />


It works well with Dark High Contrast:

<img width="249" height="139" alt="Image" src="https://github.com/user-attachments/assets/76796bdf-5755-4529-a46b-f62ae6aba36c" />

COMMENT:
I think this should be added to issue #32354 .

Labels: Bug
Dark visual studio theme seems to mix fitted and unfitted colors on HTML

When using Dark Visual Studio theme and the pipeline is closed, the fonts and lines are yellow. But yellow is the color used when the estimators are not fitted. 

<img width="235" height="136" alt="Image" src="https://github.com/user-attachments/assets/dd4d7c17-5b3a-4c3f-a564-149b6475b4e8" />


It works well with Dark High Contrast:

<img width="249" height="139" alt="Image" src="https://github.com/user-attachments/assets/76796bdf-5755-4529-a46b-f62ae6aba36c" />

COMMENT:
This issue - the mixing of yellow and blue - shows up earlier than the merge of the PR I mention in #32354. So, I don't think this should be added there.

Labels: Bug
Dark visual studio theme seems to mix fitted and unfitted colors on HTML

When using Dark Visual Studio theme and the pipeline is closed, the fonts and lines are yellow. But yellow is the color used when the estimators are not fitted. 

<img width="235" height="136" alt="Image" src="https://github.com/user-attachments/assets/dd4d7c17-5b3a-4c3f-a564-149b6475b4e8" />


It works well with Dark High Contrast:

<img width="249" height="139" alt="Image" src="https://github.com/user-attachments/assets/76796bdf-5755-4529-a46b-f62ae6aba36c" />

COMMENT:
I guess one for @rouk1 if you manage to find some spare bandwidth?

Labels: Bug
Dark visual studio theme seems to mix fitted and unfitted colors on HTML

When using Dark Visual Studio theme and the pipeline is closed, the fonts and lines are yellow. But yellow is the color used when the estimators are not fitted. 

<img width="235" height="136" alt="Image" src="https://github.com/user-attachments/assets/dd4d7c17-5b3a-4c3f-a564-149b6475b4e8" />


It works well with Dark High Contrast:

<img width="249" height="139" alt="Image" src="https://github.com/user-attachments/assets/76796bdf-5755-4529-a46b-f62ae6aba36c" />

COMMENT:
Hello, 

After a quick test I think that this issue has been fixed on main. Here is a video of a few different theme rendering.

https://github.com/user-attachments/assets/96381a2c-25d0-4f1a-9f97-82d448d88faf

Labels: Bug
Dark visual studio theme seems to mix fitted and unfitted colors on HTML

When using Dark Visual Studio theme and the pipeline is closed, the fonts and lines are yellow. But yellow is the color used when the estimators are not fitted. 

<img width="235" height="136" alt="Image" src="https://github.com/user-attachments/assets/dd4d7c17-5b3a-4c3f-a564-149b6475b4e8" />


It works well with Dark High Contrast:

<img width="249" height="139" alt="Image" src="https://github.com/user-attachments/assets/76796bdf-5755-4529-a46b-f62ae6aba36c" />

COMMENT:
Thanks a lot for the video. I thought I had checked on main because I was able to see the fix you did for the main titles for example. Maybe I just needed to reload again... ?

Labels: Bug
Dark mode on documentation may not work as intended

The dark mode on version 1.7.2, [this page](https://scikit-learn.org/stable/auto_examples/compose/plot_column_transformer_mixed_types.html) looks like this:

<img width="646" height="391" alt="Image" src="https://github.com/user-attachments/assets/9abf17d4-a4de-43d9-82c4-b13446de8386" />

With version 1.8dev0:

<img width="635" height="348" alt="Image" src="https://github.com/user-attachments/assets/34cbc8b3-4848-4028-8b35-2aeeb32aa439" />

Looking at the inspector, there is a bootstrap error: 

<img width="1069" height="121" alt="Image" src="https://github.com/user-attachments/assets/eb337087-66fe-4695-aced-dc2241b8a54b" />


The dev version also seem to change the fonts, and the pipeline is much wider. I don't know if it's on purpose.
Before:
<img width="460" height="329" alt="Image" src="https://github.com/user-attachments/assets/d4e0bc39-3243-4a00-9e8e-8781dfe700de" />
After:

<img width="580" height="325" alt="Image" src="https://github.com/user-attachments/assets/44ae7185-169c-4ec0-92b3-4a1bf471ec5c" />

This may be related to https://github.com/scikit-learn/scikit-learn/pull/32330

@glemaitre @jeremiedbb

COMMENT:
~~What do you think about this issue @rouk1?~~
It is possible that what I see as an "issue", is actually on purpose. Plus what I wrote above may need clarification. 

In short, the background of the **whole** estimator is always white when using dark mode in the [documentation](https://scikit-learn.org/stable/auto_examples/compose/plot_column_transformer_mixed_types.html). 

On the other hand, I noticed that on your [comment](https://github.com/scikit-learn/scikit-learn/issues/32355#issuecomment-3375624719), the background of the whole estimator stays always black no matter which theme is selected. 

Again, was this intended? 
Thanks in advance.

Labels: frontend
Dark mode on documentation may not work as intended

The dark mode on version 1.7.2, [this page](https://scikit-learn.org/stable/auto_examples/compose/plot_column_transformer_mixed_types.html) looks like this:

<img width="646" height="391" alt="Image" src="https://github.com/user-attachments/assets/9abf17d4-a4de-43d9-82c4-b13446de8386" />

With version 1.8dev0:

<img width="635" height="348" alt="Image" src="https://github.com/user-attachments/assets/34cbc8b3-4848-4028-8b35-2aeeb32aa439" />

Looking at the inspector, there is a bootstrap error: 

<img width="1069" height="121" alt="Image" src="https://github.com/user-attachments/assets/eb337087-66fe-4695-aced-dc2241b8a54b" />


The dev version also seem to change the fonts, and the pipeline is much wider. I don't know if it's on purpose.
Before:
<img width="460" height="329" alt="Image" src="https://github.com/user-attachments/assets/d4e0bc39-3243-4a00-9e8e-8781dfe700de" />
After:

<img width="580" height="325" alt="Image" src="https://github.com/user-attachments/assets/44ae7185-169c-4ec0-92b3-4a1bf471ec5c" />

This may be related to https://github.com/scikit-learn/scikit-learn/pull/32330

@glemaitre @jeremiedbb

COMMENT:
It is indeed an issue: when loading the page in dark theme, we expect the diagram to be in dark theme. I assume that the javascript error does make the background detection work.

I don't see this error in jupyter notebook and VS code so the issue is probably in the `sphinx-gallery` side. 

Regarding the font that change, it is on purpose where we use monospace for consistency. In the past, we were not properly inheriting in some IDE and the monospace was not imposed.

Labels: frontend
Dark mode on documentation may not work as intended

The dark mode on version 1.7.2, [this page](https://scikit-learn.org/stable/auto_examples/compose/plot_column_transformer_mixed_types.html) looks like this:

<img width="646" height="391" alt="Image" src="https://github.com/user-attachments/assets/9abf17d4-a4de-43d9-82c4-b13446de8386" />

With version 1.8dev0:

<img width="635" height="348" alt="Image" src="https://github.com/user-attachments/assets/34cbc8b3-4848-4028-8b35-2aeeb32aa439" />

Looking at the inspector, there is a bootstrap error: 

<img width="1069" height="121" alt="Image" src="https://github.com/user-attachments/assets/eb337087-66fe-4695-aced-dc2241b8a54b" />


The dev version also seem to change the fonts, and the pipeline is much wider. I don't know if it's on purpose.
Before:
<img width="460" height="329" alt="Image" src="https://github.com/user-attachments/assets/d4e0bc39-3243-4a00-9e8e-8781dfe700de" />
After:

<img width="580" height="325" alt="Image" src="https://github.com/user-attachments/assets/44ae7185-169c-4ec0-92b3-4a1bf471ec5c" />

This may be related to https://github.com/scikit-learn/scikit-learn/pull/32330

@glemaitre @jeremiedbb

COMMENT:
OK I think that we have two bugs here :)

The error that is mentioned before seems related to the documentation fragment that we implemented for the parameter. We have something like:

```python
    # Extract the whole line of the type information, up to the line break as
    # disambiguation suffix to build the fragment
    param_type = m.group(1)
    text_fragment = f"{quote(param_name)},-{quote(param_type)}"

    return f"{doc_link}#:~:text={text_fragment}"
```

which seems to be quite related to what we have here.

Then, regarding the fact that we default to light theme on dark theme, I think that the detection does not work as expected.

Labels: frontend
Dark mode on documentation may not work as intended

The dark mode on version 1.7.2, [this page](https://scikit-learn.org/stable/auto_examples/compose/plot_column_transformer_mixed_types.html) looks like this:

<img width="646" height="391" alt="Image" src="https://github.com/user-attachments/assets/9abf17d4-a4de-43d9-82c4-b13446de8386" />

With version 1.8dev0:

<img width="635" height="348" alt="Image" src="https://github.com/user-attachments/assets/34cbc8b3-4848-4028-8b35-2aeeb32aa439" />

Looking at the inspector, there is a bootstrap error: 

<img width="1069" height="121" alt="Image" src="https://github.com/user-attachments/assets/eb337087-66fe-4695-aced-dc2241b8a54b" />


The dev version also seem to change the fonts, and the pipeline is much wider. I don't know if it's on purpose.
Before:
<img width="460" height="329" alt="Image" src="https://github.com/user-attachments/assets/d4e0bc39-3243-4a00-9e8e-8781dfe700de" />
After:

<img width="580" height="325" alt="Image" src="https://github.com/user-attachments/assets/44ae7185-169c-4ec0-92b3-4a1bf471ec5c" />

This may be related to https://github.com/scikit-learn/scikit-learn/pull/32330

@glemaitre @jeremiedbb

COMMENT:
I think that we made some assumptions that are true with `skrub` table report but not scikit-learn estimator: we run

```js
const color = window.getComputedStyle(element, null).getPropertyValue('color');
```

to get the color of the `body` of the document where `element` is in. However, `element` with the diagram is wrapped into another div that has a style and we therefore don't access the `body.color`.

Labels: frontend