Talip7/scikit-learn-issues-multilabel huggingface dataset:
FeatureHasher and HashingVectorizer does not expose requires_fit=False tag

While `FeatureHasher` and `HashingVectorizer` are stateless estimator (at least in their docstrings), they do not expose the `requires_fit` tag to `False` as other stateless estimator.

@adrinjalali Do you recall when changing the tags if there was a particular reason for those estimator to not behave the same way than others?

COMMENT:
Hello everyone!

I am new to contributing to scikit-learn and very enthusiastic on helping and contributing on it!

I wanted to provide an update on my progress with this issue.

I've opened a PR ([#31852](https://github.com/scikit-learn/scikit-learn/pull/31852)) which adds the requires_fit=False tag to both FeatureHasher and HashingVectorizer, as well as corresponding tests to verify the tag is set correctly.

Currently, the PR is encountering some linting issues, specifically with ruff check and ruff format. The CI is reporting failures related to code style and formatting. I am reviewing the linting output and plan to run ruff check --fix --output-format=full and ruff format locally as suggested by the CI to resolve these. Additionally, I am going through the [pre-commit hook instructions](https://scikit-learn.org/dev/developers/contributing.html#pre-commit-hooks) to help catch these issues before pushing in the future.

If anyone has extra guidance on resolving these linting issues efficiently, or if there are specific style conventions I should pay special attention to, I would appreciate your advice.

Thank you for your support and for maintaining such a welcoming community! I’ll continue working on the feedback and update the PR as soon as possible.

Labels: Enhancement, good first issue
⚠️ CI failed on Linux_Runs.pylatest_conda_forge_mkl (last failure: Jan 21, 2025) ⚠️

**CI failed on [Linux_Runs.pylatest_conda_forge_mkl](https://dev.azure.com/scikit-learn/scikit-learn/_build/results?buildId=73668&view=logs&j=dde5042c-7464-5d47-9507-31bdd2ee0a3a)** (Jan 21, 2025)
- test_linear_regression_sample_weights[95-True-csr_matrix]
- test_linear_regression_sample_weights[95-True-csr_array]

COMMENT:
Seems very similar to https://github.com/scikit-learn/scikit-learn/issues/29909#issuecomment-2601892840, and indeed I can reproduce locally ...

git bisect points at #30521, maybe @SuccessMoses, @ogrisel or @OmarManzoor have some insights into this? I guess it may be a matter of setting a smaller `tol` in the test or something similar?

To reproduce the test failure on my machine:
```bash
SKLEARN_TESTS_GLOBAL_RANDOM_SEED=all pytest sklearn/linear_model/tests/test_base.py \
    -k 'test_linear_regression_sample_weights and 95' -v -s
```

The difference seems quite big `~3e-3` compared to `rtol=1e-7`:
```
E       AssertionError: 
E       Not equal to tolerance rtol=1e-07, atol=0
E       
E       Mismatched elements: 5 / 5 (100%)
E       Max absolute difference among violations: 0.00075961
E       Max relative difference among violations: 0.00295252
E        ACTUAL: array([ 0.06997 ,  0.258036, -0.61785 ,  0.439414, -0.790052])
E        DESIRED: array([ 0.069826,  0.257276, -0.617861,  0.439693, -0.790149])
```

Labels: Bug
⚠️ CI failed on Linux_Runs.pylatest_conda_forge_mkl (last failure: Jan 21, 2025) ⚠️

**CI failed on [Linux_Runs.pylatest_conda_forge_mkl](https://dev.azure.com/scikit-learn/scikit-learn/_build/results?buildId=73668&view=logs&j=dde5042c-7464-5d47-9507-31bdd2ee0a3a)** (Jan 21, 2025)
- test_linear_regression_sample_weights[95-True-csr_matrix]
- test_linear_regression_sample_weights[95-True-csr_array]

COMMENT:
On my machine, setting `tol=1e-5` (rather than the default `1e-4`) makes the test pass. This does look like a behaviour change though, not sure whether this was intended or not 🤔 ...

Labels: Bug
⚠️ CI failed on Linux_Runs.pylatest_conda_forge_mkl (last failure: Jan 21, 2025) ⚠️

**CI failed on [Linux_Runs.pylatest_conda_forge_mkl](https://dev.azure.com/scikit-learn/scikit-learn/_build/results?buildId=73668&view=logs&j=dde5042c-7464-5d47-9507-31bdd2ee0a3a)** (Jan 21, 2025)
- test_linear_regression_sample_weights[95-True-csr_matrix]
- test_linear_regression_sample_weights[95-True-csr_array]

COMMENT:
I was looking into it, the issue is that we are comparing against the exact solution so we need a  good convergence. I opened https://github.com/scikit-learn/scikit-learn/pull/30688

Labels: Bug
⚠️ CI failed on Linux_Runs.pylatest_conda_forge_mkl (last failure: Jan 21, 2025) ⚠️

**CI failed on [Linux_Runs.pylatest_conda_forge_mkl](https://dev.azure.com/scikit-learn/scikit-learn/_build/results?buildId=73668&view=logs&j=dde5042c-7464-5d47-9507-31bdd2ee0a3a)** (Jan 21, 2025)
- test_linear_regression_sample_weights[95-True-csr_matrix]
- test_linear_regression_sample_weights[95-True-csr_array]

COMMENT:
## CI is no longer failing! ✅

[Successful run](https://dev.azure.com/scikit-learn/scikit-learn/_build/results?buildId=73743&view=logs&j=dde5042c-7464-5d47-9507-31bdd2ee0a3a) on Jan 23, 2025

Labels: Bug
power_transform() lacks lambda retrieval in the new version

### Describe the issue
In the latest version of scikit-learn, the `power_transform()` function does not provide a way to access the lambda values (\(\lambda\)) used during the transformation. This was possible in the older version using the `PowerTransformer` class with the `lambdas_` attribute.

### Steps
```python
from sklearn.preprocessing import power_transform
import pandas as pd
import numpy as np

np.random.seed(42)  
data = np.random.exponential(scale=2, size=1000)

transformed_data = power_transform(data, method='box-cox')
# No way to access lambda values
```
### Actual behavior
The `power_transform()` function does not expose lambda values, making it less informative for users who need them.

`transformed_data.lambdas_`
**AttributeError:**  `numpy.ndarray` object has no attribute `lambdas_`

### Expected behavior
There should be a way to retrieve the lambda values (𝜆) when using the `power_transform()` function.

### Environment
`scikit-learn version: 1.6.1`

COMMENT:
Hi @samer-oxy,

thanks for reporting. 

I think this bug was accidentally introduced with #26566, but I'm not 100 % sure yet.
I would like to take a look and give it a try in fixing that, if it's okay, @jeremiedbb?

Labels: Needs Triage
power_transform() lacks lambda retrieval in the new version

### Describe the issue
In the latest version of scikit-learn, the `power_transform()` function does not provide a way to access the lambda values (\(\lambda\)) used during the transformation. This was possible in the older version using the `PowerTransformer` class with the `lambdas_` attribute.

### Steps
```python
from sklearn.preprocessing import power_transform
import pandas as pd
import numpy as np

np.random.seed(42)  
data = np.random.exponential(scale=2, size=1000)

transformed_data = power_transform(data, method='box-cox')
# No way to access lambda values
```
### Actual behavior
The `power_transform()` function does not expose lambda values, making it less informative for users who need them.

`transformed_data.lambdas_`
**AttributeError:**  `numpy.ndarray` object has no attribute `lambdas_`

### Expected behavior
There should be a way to retrieve the lambda values (𝜆) when using the `power_transform()` function.

### Environment
`scikit-learn version: 1.6.1`

COMMENT:
I now understand it better and I don't think it is a bug, @samer-oxy.

`power_transform()` in contrast to the `PowerTransformer` class returns only `X` as an array and not attributes that were created while fitting.

I did some investigation to see if I could re-create the fact that you said it worked in previous versions, but not even with `scikit-learn==1.1.0` and `numpy==1.22.0` we would get an attribute for the lambdas on the numpy array (which makes sense, because scikit-learn doesn't manipulate other librarie's objects).

Please use `PowerTransformer` directly to obtain the `lambdas_`.

(And sorry for the confusion @jeremiedbb, just ignore that.)

Labels: Needs Triage
Update videos list with recent presentations

The [presentations.rst](https://github.com/scikit-learn/scikit-learn/blob/main/doc/presentations.rst) page has very old resources. The last video listed is from 2013, over 10 years ago.  

There are updated videos on the playlists here:
https://www.youtube.com/@scikit-learn/playlists

_Originally posted by @reshamas in https://github.com/scikit-learn/scikit-learn/issues/30469#issuecomment-2553764024_

COMMENT:
100% agree, this kind of list is rarely updated in our repo and I would be fine having a link to playlists curated on the YouTube channel, which seems a lot more lightweight to keep up-to-date ...

Having said this I am not sure who maintains the YouTube channel in practice, I guess @reshamas you involved in this?

Labels: Documentation
Update videos list with recent presentations

The [presentations.rst](https://github.com/scikit-learn/scikit-learn/blob/main/doc/presentations.rst) page has very old resources. The last video listed is from 2013, over 10 years ago.  

There are updated videos on the playlists here:
https://www.youtube.com/@scikit-learn/playlists

_Originally posted by @reshamas in https://github.com/scikit-learn/scikit-learn/issues/30469#issuecomment-2553764024_

COMMENT:
I guess this can be closed since this has been done in #30469. Full disclosure, because OpenML still has issue the dev doc won't reflect the change for now ...

Labels: Documentation
Unconsistent FutureWarning when using `force_int_remainder_cols=True` in `ColumnTransformer`

### Describe the bug

Calling fit on a pipeline that includes a `ColumnTransformer` step with `remainder="passthrough"` and `force_int_remainder_cols=True` (the default value as in v1.6) raises a
`FutureWarning: 
The format of the columns of the 'remainder' transformer in ColumnTransformer.transformers_ will change in version 1.7 to match the format of the other transformers.`

Calling a cross-validation doesn't.

### Steps/Code to Reproduce

```python
import pandas as pd
from sklearn.compose import make_column_selector as selector
from sklearn.model_selection import cross_validate
from sklearn.pipeline import make_pipeline
from sklearn.compose import ColumnTransformer
from sklearn.preprocessing import OrdinalEncoder
from sklearn.ensemble import HistGradientBoostingClassifier

data = pd.DataFrame({
"quarters": ["Q1", "Q2", "Q3", "Q1", "Q3"],
"profit": [4.20, 7.70, 9.20, 4.26, 1.84],
"expenses": [3.32, 3.32, 3.32, 2.21, 2.21],
}
)
target = pd.Series([0, 1, 0, 1, 0])

categorical_columns_selector = selector(dtype_include=object)
categorical_columns = categorical_columns_selector(data)

categorical_preprocessor = OrdinalEncoder(
    handle_unknown="use_encoded_value", unknown_value=-1
)
preprocessor = ColumnTransformer(
    [("categorical", categorical_preprocessor, categorical_columns)],
    remainder="passthrough",
)

model = make_pipeline(preprocessor, HistGradientBoostingClassifier())
model.fit(data, target)  # raises FutureWarning

cross_validate(model, data, target, cv=2)  # does not raise FutureWarning
```

### Expected Results

Warning should be raised when cross-validating as well.
At least for the first internal fit.

### Actual Results

Warning is not raised when cross-validating.

### Versions

```shell
Python dependencies:
      sklearn: 1.6.1
          pip: 24.3.1
   setuptools: 75.6.0
        numpy: 2.2.0
        scipy: 1.14.1
       Cython: None
       pandas: 2.2.3
   matplotlib: 3.10.0
       joblib: 1.4.2
threadpoolctl: 3.5.0
```

COMMENT:
Hi @ArturoAmorQ, the "inconsistency" comes from a notebook specific behavior. In a notebook, the repr of the last results of a cell is displayed automatically.
`model.fit(data, target)` returns the model so the repr of the model is displayed which triggers the warning.
`cross_validate(model, data, target, cv=2)` returns a dict of scores so the warning is not raised.

Labels: Bug
Unconsistent FutureWarning when using `force_int_remainder_cols=True` in `ColumnTransformer`

### Describe the bug

Calling fit on a pipeline that includes a `ColumnTransformer` step with `remainder="passthrough"` and `force_int_remainder_cols=True` (the default value as in v1.6) raises a
`FutureWarning: 
The format of the columns of the 'remainder' transformer in ColumnTransformer.transformers_ will change in version 1.7 to match the format of the other transformers.`

Calling a cross-validation doesn't.

### Steps/Code to Reproduce

```python
import pandas as pd
from sklearn.compose import make_column_selector as selector
from sklearn.model_selection import cross_validate
from sklearn.pipeline import make_pipeline
from sklearn.compose import ColumnTransformer
from sklearn.preprocessing import OrdinalEncoder
from sklearn.ensemble import HistGradientBoostingClassifier

data = pd.DataFrame({
"quarters": ["Q1", "Q2", "Q3", "Q1", "Q3"],
"profit": [4.20, 7.70, 9.20, 4.26, 1.84],
"expenses": [3.32, 3.32, 3.32, 2.21, 2.21],
}
)
target = pd.Series([0, 1, 0, 1, 0])

categorical_columns_selector = selector(dtype_include=object)
categorical_columns = categorical_columns_selector(data)

categorical_preprocessor = OrdinalEncoder(
    handle_unknown="use_encoded_value", unknown_value=-1
)
preprocessor = ColumnTransformer(
    [("categorical", categorical_preprocessor, categorical_columns)],
    remainder="passthrough",
)

model = make_pipeline(preprocessor, HistGradientBoostingClassifier())
model.fit(data, target)  # raises FutureWarning

cross_validate(model, data, target, cv=2)  # does not raise FutureWarning
```

### Expected Results

Warning should be raised when cross-validating as well.
At least for the first internal fit.

### Actual Results

Warning is not raised when cross-validating.

### Versions

```shell
Python dependencies:
      sklearn: 1.6.1
          pip: 24.3.1
   setuptools: 75.6.0
        numpy: 2.2.0
        scipy: 1.14.1
       Cython: None
       pandas: 2.2.3
   matplotlib: 3.10.0
       joblib: 1.4.2
threadpoolctl: 3.5.0
```

COMMENT:
I would have expected the warning to be raised during `fit` i.e. regardless of the output. In any case, given that this is just a `FutureWarning`, maybe there's no need to worry too much about it. I'm ok with closing the issue.

Labels: Bug
Unconsistent FutureWarning when using `force_int_remainder_cols=True` in `ColumnTransformer`

### Describe the bug

Calling fit on a pipeline that includes a `ColumnTransformer` step with `remainder="passthrough"` and `force_int_remainder_cols=True` (the default value as in v1.6) raises a
`FutureWarning: 
The format of the columns of the 'remainder' transformer in ColumnTransformer.transformers_ will change in version 1.7 to match the format of the other transformers.`

Calling a cross-validation doesn't.

### Steps/Code to Reproduce

```python
import pandas as pd
from sklearn.compose import make_column_selector as selector
from sklearn.model_selection import cross_validate
from sklearn.pipeline import make_pipeline
from sklearn.compose import ColumnTransformer
from sklearn.preprocessing import OrdinalEncoder
from sklearn.ensemble import HistGradientBoostingClassifier

data = pd.DataFrame({
"quarters": ["Q1", "Q2", "Q3", "Q1", "Q3"],
"profit": [4.20, 7.70, 9.20, 4.26, 1.84],
"expenses": [3.32, 3.32, 3.32, 2.21, 2.21],
}
)
target = pd.Series([0, 1, 0, 1, 0])

categorical_columns_selector = selector(dtype_include=object)
categorical_columns = categorical_columns_selector(data)

categorical_preprocessor = OrdinalEncoder(
    handle_unknown="use_encoded_value", unknown_value=-1
)
preprocessor = ColumnTransformer(
    [("categorical", categorical_preprocessor, categorical_columns)],
    remainder="passthrough",
)

model = make_pipeline(preprocessor, HistGradientBoostingClassifier())
model.fit(data, target)  # raises FutureWarning

cross_validate(model, data, target, cv=2)  # does not raise FutureWarning
```

### Expected Results

Warning should be raised when cross-validating as well.
At least for the first internal fit.

### Actual Results

Warning is not raised when cross-validating.

### Versions

```shell
Python dependencies:
      sklearn: 1.6.1
          pip: 24.3.1
   setuptools: 75.6.0
        numpy: 2.2.0
        scipy: 1.14.1
       Cython: None
       pandas: 2.2.3
   matplotlib: 3.10.0
       joblib: 1.4.2
threadpoolctl: 3.5.0
```

COMMENT:
> I would have expected the warning to be raised during fit

That was not done on purpose since it doesn't impact the fitting process at all. It just impacts the dtype of an attribute so we decided to warn only when trying to access the attribute.

Labels: Bug
sklearn.cluster KMeans creates a status heap memory corruption error 0xC0000374

I have Windows 11 Home 24.2 Python 3.12.8 PyCharm Community Edition 2024.3 venv with pip 24.3.1 Numpy 2.2.1 Scikit-learn 1.6.1 Scipy 1.15.1 threadpoolctl 3.5.0 joblib 1.4.2 and this code gives me the heap corruption error

Python installation is fresh and new and other files run well (except other python scripts that have the same problem made by KMeans). The error gets reproduced in other IDEs and in the cmd too. The venv is fresh new and minimal. The code is minimal.

CODE:
```py
import numpy as np
from sklearn.cluster import KMeans

X = np.array([[1, 2], [1, 4], [1, 0], [4, 2], [4, 4], [4, 0]])
kmeans = KMeans(n_clusters=2, random_state=0, init='random')
kmeans.fit(X)
```
Note: The error doesn't always show! sometimes it runs fine sometimes it gives the error, about 50% maybe, very random.

Changing init doesn't work. I've tried installing old versions of these libraries compatible between each other and still the error persists. By using faulthandler I've understood that kmeans.fit(x) is the line of code that creates the error. Is it a scikit-learn internal error that I can do nothing about?

I'have also succeded in building scikit-learn 1.7.dev0 from source to see if it would fix the problem. It didn't.

Its important to note that MiniBatchKMeans also gives the same problem while others like Agglomerative Clustering, DBSCAN and others from other libraries like HDBSCAN, Kmeans from faiss and kmeans, vq from scipy.cluster.vq all work just fine.

I've tried too many things to list them all but I've come to the conclusion that it might be an internal error of the library. Can you help me out?

COMMENT:
This is unexpected and likely to be some weird issue with your environment ... 

Just to be explicit, I can not reproduce on my Linux machine.

Could you add the following edit your top message and had this info:
- output of `python -c 'import sklearn; sklearn.show_versions()`?
- output of the stack-trace with faulthandler? Maybe this can help shed some light on the issue, although I would guess probably not that much
- can you give more details how you installed Python and how you create your Python environment (for creating the virtual environment, I am guessing with `python -m venv my-venv`?)

A few things that would be useful to try:
- if you are familiar with conda you could try to create a conda environment and see whether you can reproduce the issue
- in an ideal world you would be able to run with a debugger to have a more precise idea where the issue happens. On Linux you would use `gdb` but I don't know how to do this on Windows. Maybe PyCharm has a debugger that can do Python + C code and that can point to the generated C code that creates the issue?

Labels: Needs Reproducible Code, OS:Windows
sklearn.cluster KMeans creates a status heap memory corruption error 0xC0000374

I have Windows 11 Home 24.2 Python 3.12.8 PyCharm Community Edition 2024.3 venv with pip 24.3.1 Numpy 2.2.1 Scikit-learn 1.6.1 Scipy 1.15.1 threadpoolctl 3.5.0 joblib 1.4.2 and this code gives me the heap corruption error

Python installation is fresh and new and other files run well (except other python scripts that have the same problem made by KMeans). The error gets reproduced in other IDEs and in the cmd too. The venv is fresh new and minimal. The code is minimal.

CODE:
```py
import numpy as np
from sklearn.cluster import KMeans

X = np.array([[1, 2], [1, 4], [1, 0], [4, 2], [4, 4], [4, 0]])
kmeans = KMeans(n_clusters=2, random_state=0, init='random')
kmeans.fit(X)
```
Note: The error doesn't always show! sometimes it runs fine sometimes it gives the error, about 50% maybe, very random.

Changing init doesn't work. I've tried installing old versions of these libraries compatible between each other and still the error persists. By using faulthandler I've understood that kmeans.fit(x) is the line of code that creates the error. Is it a scikit-learn internal error that I can do nothing about?

I'have also succeded in building scikit-learn 1.7.dev0 from source to see if it would fix the problem. It didn't.

Its important to note that MiniBatchKMeans also gives the same problem while others like Agglomerative Clustering, DBSCAN and others from other libraries like HDBSCAN, Kmeans from faiss and kmeans, vq from scipy.cluster.vq all work just fine.

I've tried too many things to list them all but I've come to the conclusion that it might be an internal error of the library. Can you help me out?

COMMENT:
Closing as lack of response from the OP.

Labels: Needs Reproducible Code, OS:Windows
docs: TimeSeriesSplit

### Describe the issue linked to the documentation

In the [TSS](https://scikit-learn.org/1.6/modules/generated/sklearn.model_selection.TimeSeriesSplit.html) documentation, it states that it `Provides train/test indices to split time series data samples that are observed at fixed time intervals`. Why at fixed intervals?  I don't see anything in the documentation that would indicate where the time column is in the dataframe to enforce this. 

### Suggest a potential alternative/fix

remove "fixed time intervals", and replace it by "over time".

COMMENT:
The "fixed time interval" means that we are dealing with homogeneous time series as discussed originally in https://github.com/scikit-learn/scikit-learn/issues/6322

If we have the heterogeneous case, then each fold will not represent the same amount of time. and you will need to have a real timestamp to properly deal with having fold with the same duration. This case is not implemented in scikit-learn.

So I am unsure that we should remove the constraint and in the contrary, I think that we should explain the reason why we expect a user to pass "fixed time interval" if it is not enough explicit.

Labels: Documentation