Talip7/scikit-learn-issues-multilabel huggingface dataset:
Build failure under Termux: can not execute sklearn/_build_utils/version.py

### Describe the bug

When attempting to install the newest (and older) versions of scikit-learn-1.6.dev0 using regular pip install, the installation fails due to a missing version.py file. This issue occurs on an Android system using Termux.
Environment details:
OS: Linux localhost 4.14.186+ (Android)
Architecture: aarch64
Python: 3.11
The error occurs during the Meson build process, which tries to execute a non-existent file:
/data/data/com.termux/files/home/downloads/scikit-learn/sklearn/_build_utils/version.py
A workaround patch has been developed to address this issue:
```
#!/bin/bash

# Navigate to the scikit-learn directory, e.g.:
cd ~/downloads/scikit-learn

# Extract version from pyproject.toml and remove "dev" suffix
VERSION=$(grep 'version =' pyproject.toml | sed 's/version = "\(.*\)"/\1/' | sed 's/\.dev0//')

# Create the directory if it doesn't exist
mkdir -p sklearn/_build_utils

# Create the version.py file with the correct content
cat << EOF > sklearn/_build_utils/version.py
#!/usr/bin/env python
print('${VERSION}')
EOF

# Make the file executable
chmod +x sklearn/_build_utils/version.py

echo "Created sklearn/_build_utils/version.py with version ${VERSION}"
```
This patch:
- Extracts the version number from pyproject.toml
- Removes the "dev" suffix
- Creates the missing version.py file with a generic Python shebang
- Makes the file executable

After applying this patch, the Meson build process completes successfully, and the installation can proceed: 
```
cpu family: aarch64
Host machine cpu: aarch64
Compiler for C supports arguments -Wno-unused-but-set-variable: YE
Compiler for C supports arguments -Wno-unused-function: YES
Compiler for C supports arguments -Wno-conversion: YES
Compiler for C supports arguments -Wno-misleading-indentation: YES
Library m found: YES
Program python3 found: YES (/data/data/com.termux/files/usr/bin/python3.11)
Run-time dependency OpenMP for c found: YES 5.1
Found pkg-config: YES (/data/data/com.termux/files/usr/bin/pkg-config) 0.29.2
Run-time dependency python found: YES 3.11    Build targets in project: 111
Found ninja-1.11.1.git.kitware.jobserver-1 ...
```
and:
```
Successfully installed scikit-learn-1.6.dev0  ~/downloads/scikit-learn $
```

### Steps/Code to Reproduce

pip install -U -v scikit-learn

### Expected Results

.

### Actual Results

.

### Versions

```shell
scikit-learn-1.6.dev0, and older
```

COMMENT:
Not crucial, but I would also be curious what your use case is for termux and scikit-learn :wink:. Is it for running small scikit-learn snippets on your phone? Do you do Python development on your phone?

Labels: Build / CI, Low Priority
Build failure under Termux: can not execute sklearn/_build_utils/version.py

### Describe the bug

When attempting to install the newest (and older) versions of scikit-learn-1.6.dev0 using regular pip install, the installation fails due to a missing version.py file. This issue occurs on an Android system using Termux.
Environment details:
OS: Linux localhost 4.14.186+ (Android)
Architecture: aarch64
Python: 3.11
The error occurs during the Meson build process, which tries to execute a non-existent file:
/data/data/com.termux/files/home/downloads/scikit-learn/sklearn/_build_utils/version.py
A workaround patch has been developed to address this issue:
```
#!/bin/bash

# Navigate to the scikit-learn directory, e.g.:
cd ~/downloads/scikit-learn

# Extract version from pyproject.toml and remove "dev" suffix
VERSION=$(grep 'version =' pyproject.toml | sed 's/version = "\(.*\)"/\1/' | sed 's/\.dev0//')

# Create the directory if it doesn't exist
mkdir -p sklearn/_build_utils

# Create the version.py file with the correct content
cat << EOF > sklearn/_build_utils/version.py
#!/usr/bin/env python
print('${VERSION}')
EOF

# Make the file executable
chmod +x sklearn/_build_utils/version.py

echo "Created sklearn/_build_utils/version.py with version ${VERSION}"
```
This patch:
- Extracts the version number from pyproject.toml
- Removes the "dev" suffix
- Creates the missing version.py file with a generic Python shebang
- Makes the file executable

After applying this patch, the Meson build process completes successfully, and the installation can proceed: 
```
cpu family: aarch64
Host machine cpu: aarch64
Compiler for C supports arguments -Wno-unused-but-set-variable: YE
Compiler for C supports arguments -Wno-unused-function: YES
Compiler for C supports arguments -Wno-conversion: YES
Compiler for C supports arguments -Wno-misleading-indentation: YES
Library m found: YES
Program python3 found: YES (/data/data/com.termux/files/usr/bin/python3.11)
Run-time dependency OpenMP for c found: YES 5.1
Found pkg-config: YES (/data/data/com.termux/files/usr/bin/pkg-config) 0.29.2
Run-time dependency python found: YES 3.11    Build targets in project: 111
Found ninja-1.11.1.git.kitware.jobserver-1 ...
```
and:
```
Successfully installed scikit-learn-1.6.dev0  ~/downloads/scikit-learn $
```

### Steps/Code to Reproduce

pip install -U -v scikit-learn

### Expected Results

.

### Actual Results

.

### Versions

```shell
scikit-learn-1.6.dev0, and older
```

COMMENT:
Thank you for trying so long to replicate it and closing it, @lesteve . My report was a FYI fix in fact, so that other scikit-learn & Termux🤳 or other non-standard👾 Linux users may stumble👁️ upon that patch, if needed. Ciao! 🐙

Labels: Build / CI, Low Priority
Build failure under Termux: can not execute sklearn/_build_utils/version.py

### Describe the bug

When attempting to install the newest (and older) versions of scikit-learn-1.6.dev0 using regular pip install, the installation fails due to a missing version.py file. This issue occurs on an Android system using Termux.
Environment details:
OS: Linux localhost 4.14.186+ (Android)
Architecture: aarch64
Python: 3.11
The error occurs during the Meson build process, which tries to execute a non-existent file:
/data/data/com.termux/files/home/downloads/scikit-learn/sklearn/_build_utils/version.py
A workaround patch has been developed to address this issue:
```
#!/bin/bash

# Navigate to the scikit-learn directory, e.g.:
cd ~/downloads/scikit-learn

# Extract version from pyproject.toml and remove "dev" suffix
VERSION=$(grep 'version =' pyproject.toml | sed 's/version = "\(.*\)"/\1/' | sed 's/\.dev0//')

# Create the directory if it doesn't exist
mkdir -p sklearn/_build_utils

# Create the version.py file with the correct content
cat << EOF > sklearn/_build_utils/version.py
#!/usr/bin/env python
print('${VERSION}')
EOF

# Make the file executable
chmod +x sklearn/_build_utils/version.py

echo "Created sklearn/_build_utils/version.py with version ${VERSION}"
```
This patch:
- Extracts the version number from pyproject.toml
- Removes the "dev" suffix
- Creates the missing version.py file with a generic Python shebang
- Makes the file executable

After applying this patch, the Meson build process completes successfully, and the installation can proceed: 
```
cpu family: aarch64
Host machine cpu: aarch64
Compiler for C supports arguments -Wno-unused-but-set-variable: YE
Compiler for C supports arguments -Wno-unused-function: YES
Compiler for C supports arguments -Wno-conversion: YES
Compiler for C supports arguments -Wno-misleading-indentation: YES
Library m found: YES
Program python3 found: YES (/data/data/com.termux/files/usr/bin/python3.11)
Run-time dependency OpenMP for c found: YES 5.1
Found pkg-config: YES (/data/data/com.termux/files/usr/bin/pkg-config) 0.29.2
Run-time dependency python found: YES 3.11    Build targets in project: 111
Found ninja-1.11.1.git.kitware.jobserver-1 ...
```
and:
```
Successfully installed scikit-learn-1.6.dev0  ~/downloads/scikit-learn $
```

### Steps/Code to Reproduce

pip install -U -v scikit-learn

### Expected Results

.

### Actual Results

.

### Versions

```shell
scikit-learn-1.6.dev0, and older
```

COMMENT:
I bumped into a similar build error when working on something completely unrelated. I believe #29415 should fix it.

In other words this patch should be good enough:

```diff
diff --git a/sklearn/_build_utils/version.py b/sklearn/_build_utils/version.py
index 49a3cfb82b..124c6cc3a0 100644
--- a/sklearn/_build_utils/version.py
+++ b/sklearn/_build_utils/version.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
 """Extract version number from __init__.py"""
 
 import os
```

Labels: Build / CI, Low Priority
received ImportError: cannot import name '_deprecate_Xt_in_inverse_transform' from 'sklearn.utils.deprecation'

### Describe the bug

When I'm importing KMeans from sklearn.cluster, I received this import error saying that cannot import name '_deprecate_Xt_in_inverse_transform' from 'sklearn.utils.deprecation'
Currently I'm using the latest version for sklearn and Python 3.10.

### Steps/Code to Reproduce

`from sklearn.cluster import KMeans`

### Expected Results

NO ERROR

### Actual Results

```
	"name": "ImportError",
	"message": "cannot import name '_deprecate_Xt_in_inverse_transform' from 'sklearn.utils.deprecation' (/.../lib/python3.10/site-packages/sklearn/utils/deprecation.py)",
	"stack": "---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
Cell In[251], line 3
      1 import numpy as np
      2 import matplotlib.pyplot as plt
----> 3 from sklearn.cluster import KMeans
      4 from sklearn.decomposition import PCA
      5 from mpl_toolkits.mplot3d import Axes3D

File ~/.../lib/python3.10/site-packages/sklearn/cluster/__init__.py:7
      1 \"\"\"
      2 The :mod:`sklearn.cluster` module gathers popular unsupervised clustering
      3 algorithms.
      4 \"\"\"
      6 from ._affinity_propagation import AffinityPropagation, affinity_propagation
----> 7 from ._agglomerative import (
      8     AgglomerativeClustering,
      9     FeatureAgglomeration,
     10     linkage_tree,
     11     ward_tree,
     12 )
     13 from ._bicluster import SpectralBiclustering, SpectralCoclustering
     14 from ._birch import Birch

File ~/.../lib/python3.10/site-packages/sklearn/cluster/_agglomerative.py:42
     40 # mypy error: Module 'sklearn.cluster' has no attribute '_hierarchical_fast'
     41 from . import _hierarchical_fast as _hierarchical  # type: ignore
---> 42 from ._feature_agglomeration import AgglomerationTransform
     44 ###############################################################################
     45 # For non fully-connected graphs
     48 def _fix_connectivity(X, connectivity, affinity):

File ~/ ... /lib/python3.10/site-packages/sklearn/cluster/_feature_agglomeration.py:15
     13 from ..base import TransformerMixin
     14 from ..utils import metadata_routing
---> 15 from ..utils.deprecation import _deprecate_Xt_in_inverse_transform
     16 from ..utils.validation import check_is_fitted
     18 ###############################################################################
     19 # Mixin class for feature agglomeration.

ImportError: cannot import name '_deprecate_Xt_in_inverse_transform' from 'sklearn.utils.deprecation' (/.../lib/python3.10/site-packages/sklearn/utils/deprecation.py)"
```

### Versions

```shell
Name: scikit-learn
Version: 1.5.0
```

COMMENT:
Did you ever get an answer to this?

Labels: Bug, Needs Triage
DOC missing User Guide for new unsupervised Clustering Validity metric (DBCV)

If #28244 gets merged, the new `dbcv_score` function will need a user guide. I'm just opening this so we don't lose track of that.

COMMENT:
Here are some old latex definitions I still had laying around back from when I wrote my thesis,
they should come in handy for the user guide:

(the section about a given metric in the guide usually contains its mathematical definition, e.g. https://scikit-learn.org/stable/modules/clustering.html#silhouette-coefficient)

`Validity Index of a Clustering` : (DBCV)

$$DBCV(C) = \sum_{ i=1 }^k{ \frac{ N_{ i } }{ N }V_{ C }(C_{ i }) }$$

`Validity Index of a Cluster C_i` :

$$V_{ C }(C_{ i }) = \frac
{ min_{ 1\leq j\leq k, j\neq i}  \left( DSPC(C_{ i }, C_{ j }) \right) - DSC(C_{ i })}
{ max\left( min_{ 1\leq j\leq k, j\neq i}(DSPC(C_{ i }, C_{ j })), DSC(C_{ i })\right) }$$

`all-points-core-distance` : inversed density of/at an object `x_i`

$$a_{ pts } coredist(x_{ i }) = 
\left(\frac{ \sum_{ z=2 }^{N_{ i }} { \left(\frac{ 1 }{ KNN(x_{ i }, z) }\right)^{ n } } }
{ N_{ i }-1 }\right)^{
 -\frac{ 1 }{ n } 
}$$

----

the Sigma in the coredist formula above isn't being rendered correctly by MathJax (it works on different display engines, idk why, I haven't been able to fix this until now ...)

EDIT: turns out there's nothing wrong with the formula itself nor is this an inherent flaw of MathJax; it's caused by a GitHub "quirk", not directly related to MathJax itself:
- https://github.com/mathjax/MathJax/issues/3260#issuecomment-2226258030
- https://github.com/orgs/community/discussions/17051#discussioncomment-4842791

**So this should render correctly once hosted among the other docs on the scikit learn documentation website.**

Labels: Documentation
TransformedTargetRegressor warns about set_output set to pandas

### Describe the bug

If `set_output` is set to `"pandas"`, `TransformedTargetRegressor` warns unnecessarily.

### Steps/Code to Reproduce

```python
import numpy as np
import pandas as pd
from sklearn import set_config
from sklearn.compose import TransformedTargetRegressor
from sklearn.datasets import make_regression
from sklearn.linear_model import LinearRegression

set_config(transform_output="pandas")
X, y = make_regression()
y = np.abs(y) + 1
TransformedTargetRegressor(
    regressor=LinearRegression(),
    func=np.log,
    inverse_func=np.exp,
).fit(X, y)
```

### Expected Results

No warning.

### Actual Results

3 times the same warning:
```
python3.11/site-packages/sklearn/preprocessing/_function_transformer.py:303: UserWarning: When `set_output` is configured to be 'pandas', `func` should return a pandas DataFrame to follow the `set_output` API  or `feature_names_out` should be defined.
  warnings.warn(warn_msg.format("pandas"))
```

### Versions

```shell
System:
    python: 3.11.7
Python dependencies:
      sklearn: 1.5.0
      pandas: 2.2.2
```

COMMENT:
Thanks for the reproducer, this seems like an issue indeed, I'll try to take a closer look soonish.

Labels: Bug
Sprints page

### Describe the issue linked to the documentation

The following sprints are listed: 
https://scikit-learn.org/stable/about.html#sprints

But, that is a small subset, given the list here: 
https://blog.scikit-learn.org/sprints/

Are the sprints posted on the "About Us" page of a certain criteria, such as Dev sprints only?

### Suggest a potential alternative/fix

_No response_

COMMENT:
> Are the sprints posted on the "About Us" page of a certain criteria, such as Dev sprints only?

They are old one before that we had the blog. We should remove this section or redirect the blog.

Labels: Documentation
Sprints page

### Describe the issue linked to the documentation

The following sprints are listed: 
https://scikit-learn.org/stable/about.html#sprints

But, that is a small subset, given the list here: 
https://blog.scikit-learn.org/sprints/

Are the sprints posted on the "About Us" page of a certain criteria, such as Dev sprints only?

### Suggest a potential alternative/fix

_No response_

COMMENT:
Since this is after Funding, this looks like a way to thank/credit companies that took part in funding for some sprints?

Labels: Documentation
Sprints page

### Describe the issue linked to the documentation

The following sprints are listed: 
https://scikit-learn.org/stable/about.html#sprints

But, that is a small subset, given the list here: 
https://blog.scikit-learn.org/sprints/

Are the sprints posted on the "About Us" page of a certain criteria, such as Dev sprints only?

### Suggest a potential alternative/fix

_No response_

COMMENT:
> Since this is after Funding, this looks like a way to thank/credit companies that took part in funding for some sprints?

If we intend to do that (which would be great), we could make more as a subsection in the funding and stated only the different companies that help us organize those without being specific regarding the sprint itself.

Labels: Documentation
Sprints page

### Describe the issue linked to the documentation

The following sprints are listed: 
https://scikit-learn.org/stable/about.html#sprints

But, that is a small subset, given the list here: 
https://blog.scikit-learn.org/sprints/

Are the sprints posted on the "About Us" page of a certain criteria, such as Dev sprints only?

### Suggest a potential alternative/fix

_No response_

COMMENT:
For the 9 sprints I have organized, I would have at least a dozen sponsors to list (venue, food, travel, books).

list here:
https://www.dataumbrella.org/open-source/sprint_list

Labels: Documentation
Sprints page

### Describe the issue linked to the documentation

The following sprints are listed: 
https://scikit-learn.org/stable/about.html#sprints

But, that is a small subset, given the list here: 
https://blog.scikit-learn.org/sprints/

Are the sprints posted on the "About Us" page of a certain criteria, such as Dev sprints only?

### Suggest a potential alternative/fix

_No response_

COMMENT:
Honestly this is the kind of issue that I find mentally taxing to deal with :sweat_smile: but I have opened #29418 that hopefully is a reasonable compromise.

I can see many different points of view, I am a bit torn between different point of view and I go in circles with many random thoughts in the middle, for example:
- the list is partial and a very small subset of the scikit-learn sprints that took place. I guess this grew organically when someone thought this is important to mention this particular sprint or this particular sponsor. By removing this information we kind of tell them, you know what that was not important actually
- some sprints are not listed: this does not recognise the work that other people have put in when organizing them or other sponsors. I can't help but wild-guess (I may be completely wrong of course) that this is what motivated @reshamas to open the issue ...
- what was the actual intent of this sprint section for example was the original intent to list sprints, was it to mention sponsors (but then why was it not under Funding/Sprints)?
- By the way, we say sprints but people coming to an about page, probably don't know what it even means, should we say "Coding sprints" instead now that they would know more what it means ...
- honestly we don't care right, is this really such a big issue that we need to do something about it?
- Why did I just spend one hour to think about this, gone in circle between all of these points, and made no progress whatsoever?

Labels: Documentation
Shape may mismatch in `IterativeImputer` if set `min_value` with array-like input and some features contain all missing values

### Describe the bug

In all Imputers, features with all missing values will be droped if `keep_empty_features` is set to `False`.

However, in `IterativeImputer`, if we set `min_value` and `max_value` with array-like input, it might raise an error indicate that the shape mismatch.

We can manually reduce the elements in `min_value` and `max_value` after we check if there is any features with all missing values, I wonder if this can be done automatically.

### Steps/Code to Reproduce

```python
import numpy as np
from sklearn.experimental import enable_iterative_imputer
from sklearn.impute import IterativeImputer

X = [[7, 2, np.nan], [4, np.nan, np.nan], [10, 5, np.nan]]
imp = IterativeImputer(min_value=[1,2,3])
imp.fit_transform(X)
```

### Expected Results

No error raised.

### Actual Results

```
/Users/xxf/code/scikit-learn/sklearn/impute/_base.py:597: UserWarning: Skipping features without any observed values: [2]. At least one non-missing value is needed for imputation with strategy='mean'.
  warnings.warn(
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/xxf/code/scikit-learn/sklearn/utils/_set_output.py", line 313, in wrapped
    data_to_wrap = f(self, X, *args, **kwargs)
  File "/Users/xxf/code/scikit-learn/sklearn/base.py", line 1514, in wrapper
    return fit_method(estimator, *args, **kwargs)
  File "/Users/xxf/code/scikit-learn/sklearn/impute/_iterative.py", line 759, in fit_transform
    self._min_value = self._validate_limit(self.min_value, "min", X.shape[1])
  File "/Users/xxf/code/scikit-learn/sklearn/impute/_iterative.py", line 682, in _validate_limit
    raise ValueError(
ValueError: 'min_value' should be of shape (2,) when an array-like is provided. Got (3,), instead.
```

### Versions

```shell
System:
    python: 3.9.16 | packaged by conda-forge | (main, Feb  1 2023, 21:38:11)  [Clang 14.0.6 ]
executable: /Users/xxf/miniconda3/envs/sklearn-env/bin/python
   machine: macOS-14.5-arm64-arm-64bit

Python dependencies:
      sklearn: 1.6.dev0
          pip: 23.2.1
   setuptools: 68.0.0
        numpy: 1.26.4
        scipy: 1.13.0
       Cython: 3.0.8
       pandas: 2.1.0
   matplotlib: 3.7.2
       joblib: 1.3.0
threadpoolctl: 3.5.0

Built with OpenMP: True

threadpoolctl info:
       user_api: blas
   internal_api: openblas
    num_threads: 8
         prefix: libopenblas
       filepath: /Users/xxf/miniconda3/envs/sklearn-env/lib/libopenblas.0.dylib
        version: 0.3.23
threading_layer: openmp
   architecture: VORTEX

       user_api: openmp
   internal_api: openmp
    num_threads: 8
         prefix: libomp
       filepath: /Users/xxf/miniconda3/envs/sklearn-env/lib/libomp.dylib
        version: None
```

COMMENT:
@lesteve Would love to take this issue.

Labels: Bug, Easy, help wanted, module:impute