Talip7/scikit-learn-issues-multilabel huggingface dataset:
Circular import of numpy error

### Describe the bug

![numpy error](https://user-images.githubusercontent.com/43936231/173898634-e2ca0b4e-a996-4d63-b63f-e2ab9113e3f3.PNG)

When i tried to run python file which import numpy, it's throwing an circular import(while i run the python file in utils folder of sklearn), while outside it's running fine.

Even during the build of the sklearn, at the end it showing a message like  Partial import of sklearn during the build process, though it's successfully installed the scikit-learn

![sklearn partial import](https://user-images.githubusercontent.com/43936231/173899618-b42e2f25-db27-48ec-a40d-781a70fa6546.PNG)
.

### Steps/Code to Reproduce

import numpy as np

### Expected Results

successfully imported


### Actual Results

ImportError: cannot import name '__version__' from partially initialized module 'numpy' (most likely due to a circular import) (F:\open_source\scikit-learn\sklearn-env\lib\site-packages\numpy\__init__.py)

### Versions

```shell
System:
    python: 3.8.6 (tags/v3.8.6:db45529, Sep 23 2020, 15:52:53) [MSC v.1927 64 bit (AMD64)]
executable: D:\sk\sklearn-env\Scripts\python.exe
   machine: Windows-10-10.0.19041-SP0

Python dependencies:
      sklearn: 1.2.dev0
          pip: 20.2.1
   setuptools: 49.2.1
        numpy: 1.22.4
        scipy: 1.8.1
       Cython: 0.29.30
       pandas: None
   matplotlib: None
       joblib: 1.1.0
threadpoolctl: 3.1.0

Built with OpenMP: True

threadpoolctl info:
       user_api: blas
   internal_api: openblas
         prefix: libopenblas
       filepath: D:\sk\sklearn-env\Lib\site-packages\numpy\.libs\libopenblas.EL2C6PLE4ZYW3ECEVIV3OXXGRN2NRFM2.gfortran-win_amd64.dll
        version: 0.3.18
threading_layer: pthreads
   architecture: Haswell
    num_threads: 8

       user_api: blas
   internal_api: openblas
         prefix: libopenblas
       filepath: D:\sk\sklearn-env\Lib\site-packages\scipy\.libs\libopenblas.XWYDX2IKJW2NMTWSFYNGFUWKQU3LYTCZ.gfortran-win_amd64.dll
        version: 0.3.17
threading_layer: pthreads
   architecture: Haswell
    num_threads: 8

       user_api: openmp
   internal_api: openmp
         prefix: vcomp
       filepath: C:\Windows\System32\vcomp140.dll
        version: None
    num_threads: 8
```

COMMENT:
> This is not a problem in scikit-learn but more likely due to how you installed numpy ... I don't really know what could be causing this, if I were you I would try to recreate your virtualenv (or conda environment) from scratch and see whether the problem persists.
> 
> Please try your best to use our github issue for what seem like likely bugs in scikit-learn. I know this is often not that easy to tell ...
> 
> If you don't manage to figure it out, or can't find someone around you that can help, coming to the [office hours](https://github.com/scikit-learn/scikit-learn/issues/23070) could be one way of getting help for getting set-up and contribute to scikit-learn.

i also tried to create a new pip env but went in vain :(

Labels: Question
Circular import of numpy error

### Describe the bug

![numpy error](https://user-images.githubusercontent.com/43936231/173898634-e2ca0b4e-a996-4d63-b63f-e2ab9113e3f3.PNG)

When i tried to run python file which import numpy, it's throwing an circular import(while i run the python file in utils folder of sklearn), while outside it's running fine.

Even during the build of the sklearn, at the end it showing a message like  Partial import of sklearn during the build process, though it's successfully installed the scikit-learn

![sklearn partial import](https://user-images.githubusercontent.com/43936231/173899618-b42e2f25-db27-48ec-a40d-781a70fa6546.PNG)
.

### Steps/Code to Reproduce

import numpy as np

### Expected Results

successfully imported


### Actual Results

ImportError: cannot import name '__version__' from partially initialized module 'numpy' (most likely due to a circular import) (F:\open_source\scikit-learn\sklearn-env\lib\site-packages\numpy\__init__.py)

### Versions

```shell
System:
    python: 3.8.6 (tags/v3.8.6:db45529, Sep 23 2020, 15:52:53) [MSC v.1927 64 bit (AMD64)]
executable: D:\sk\sklearn-env\Scripts\python.exe
   machine: Windows-10-10.0.19041-SP0

Python dependencies:
      sklearn: 1.2.dev0
          pip: 20.2.1
   setuptools: 49.2.1
        numpy: 1.22.4
        scipy: 1.8.1
       Cython: 0.29.30
       pandas: None
   matplotlib: None
       joblib: 1.1.0
threadpoolctl: 3.1.0

Built with OpenMP: True

threadpoolctl info:
       user_api: blas
   internal_api: openblas
         prefix: libopenblas
       filepath: D:\sk\sklearn-env\Lib\site-packages\numpy\.libs\libopenblas.EL2C6PLE4ZYW3ECEVIV3OXXGRN2NRFM2.gfortran-win_amd64.dll
        version: 0.3.18
threading_layer: pthreads
   architecture: Haswell
    num_threads: 8

       user_api: blas
   internal_api: openblas
         prefix: libopenblas
       filepath: D:\sk\sklearn-env\Lib\site-packages\scipy\.libs\libopenblas.XWYDX2IKJW2NMTWSFYNGFUWKQU3LYTCZ.gfortran-win_amd64.dll
        version: 0.3.17
threading_layer: pthreads
   architecture: Haswell
    num_threads: 8

       user_api: openmp
   internal_api: openmp
         prefix: vcomp
       filepath: C:\Windows\System32\vcomp140.dll
        version: None
    num_threads: 8
```

COMMENT:
I had the same problem, and i finally solved it by reinstall the whole environment. The reason for me seems to be different sources of numpy ,scipy and scikit-learn(some are from pip while others are from conda)

Labels: Question
DOC Logo 3 link to image should be one without "machine learning" text

### Describe the issue linked to the documentation

https://raw.githubusercontent.com/scikit-learn/scikit-learn/main/doc/logos/README.md


cc:  @thomasjpfan 

### Suggest a potential alternative/fix

Update link for logo 3 so it's this one:
https://github.com/scikit-learn/scikit-learn/blob/main/doc/logos/scikit-learn-logo-without-subtitle.svg

COMMENT:
This link needs to be updated:
```
<img src="scikit-learn-logo.svg" width="250px">
```

Labels: Easy, Documentation, good first issue
DOC Logo 3 link to image should be one without "machine learning" text

### Describe the issue linked to the documentation

https://raw.githubusercontent.com/scikit-learn/scikit-learn/main/doc/logos/README.md


cc:  @thomasjpfan 

### Suggest a potential alternative/fix

Update link for logo 3 so it's this one:
https://github.com/scikit-learn/scikit-learn/blob/main/doc/logos/scikit-learn-logo-without-subtitle.svg

COMMENT:
I made the fix requested to the readme file @reshamas 

PR ready: #23634

Labels: Easy, Documentation, good first issue
Running pipeline.fit automatically runs pipeline.transform

### Describe the bug

Currently, when I run:
`pipeline.fit(X, y)`
all of pipeline transformers transform functions are being executed. 
I wanted to know if there is a way to run `pipeline.fit(X, y)` and only the fit functions, then later run `pipeline.transform(X)`.

### Steps/Code to Reproduce

pipeline.fit

### Expected Results

Only the fit functions would be executed when I run `pipeline.fit`

### Actual Results

when I run `pipeline.fit` transform functions are being executed as well.

### Versions

```shell
Python dependencies:
          pip: 20.3.3
   setuptools: 51.0.0
      sklearn: 1.0.2
        numpy: 1.21.5
        scipy: 1.7.3
       Cython: None
       pandas: 1.3.5
   matplotlib: 3.5.1
       joblib: 1.0.0
threadpoolctl: 2.1.0
```

COMMENT:
This is the way `Pipeline` is supposed to work.

![image](https://user-images.githubusercontent.com/1680079/173789587-1489b2d0-f801-4916-aeb7-194adb4730d9.png)

You can read more about it [here](https://inria.github.io/scikit-learn-mooc/python_scripts/02_numerical_pipeline_scaling.html) where the diagram above is taken from.

Maybe you should explain what you are trying to do in more details and why you don't want your transformers `transform` to be called ...

Labels: Question
Running pipeline.fit automatically runs pipeline.transform

### Describe the bug

Currently, when I run:
`pipeline.fit(X, y)`
all of pipeline transformers transform functions are being executed. 
I wanted to know if there is a way to run `pipeline.fit(X, y)` and only the fit functions, then later run `pipeline.transform(X)`.

### Steps/Code to Reproduce

pipeline.fit

### Expected Results

Only the fit functions would be executed when I run `pipeline.fit`

### Actual Results

when I run `pipeline.fit` transform functions are being executed as well.

### Versions

```shell
Python dependencies:
          pip: 20.3.3
   setuptools: 51.0.0
      sklearn: 1.0.2
        numpy: 1.21.5
        scipy: 1.7.3
       Cython: None
       pandas: 1.3.5
   matplotlib: 3.5.1
       joblib: 1.0.0
threadpoolctl: 2.1.0
```

COMMENT:
Thanks for the quick response!

I'm passing a parameter to a specific step of the pipeline before the transform stage.
This parameter is slightly based on the result of some steps at the fit stage. So I wanted to separate them.
As I understood from your answer, its not the case, so I'll think of a different solution

Labels: Question
Running pipeline.fit automatically runs pipeline.transform

### Describe the bug

Currently, when I run:
`pipeline.fit(X, y)`
all of pipeline transformers transform functions are being executed. 
I wanted to know if there is a way to run `pipeline.fit(X, y)` and only the fit functions, then later run `pipeline.transform(X)`.

### Steps/Code to Reproduce

pipeline.fit

### Expected Results

Only the fit functions would be executed when I run `pipeline.fit`

### Actual Results

when I run `pipeline.fit` transform functions are being executed as well.

### Versions

```shell
Python dependencies:
          pip: 20.3.3
   setuptools: 51.0.0
      sklearn: 1.0.2
        numpy: 1.21.5
        scipy: 1.7.3
       Cython: None
       pandas: 1.3.5
   matplotlib: 3.5.1
       joblib: 1.0.0
threadpoolctl: 2.1.0
```

COMMENT:
I am moving this issue as a Q&A discussion

Labels: Question
⚠️ CI failed on Linux_Nightly.pylatest_pip_scipy_dev ⚠️

**CI is still failing on [Linux_Nightly.pylatest_pip_scipy_dev](https://dev.azure.com/scikit-learn/scikit-learn/_build/results?buildId=45637&view=logs&j=dfe99b15-50db-5d7b-b1e9-4105c42527cf)** (Aug 16, 2022)
- test_grid_search_failing_classifier
- test_searchcv_raise_warning_with_non_finite_score[GridSearchCV-specialized_params0-False]
- test_searchcv_raise_warning_with_non_finite_score[GridSearchCV-specialized_params0-True]
- test_searchcv_raise_warning_with_non_finite_score[RandomizedSearchCV-specialized_params1-False]
- test_searchcv_raise_warning_with_non_finite_score[RandomizedSearchCV-specialized_params1-True]
- test_multi_output_predict_proba

COMMENT:
This will also require a change to `utisl.tests.test_extmath::test_uniform_weights`

Labels: Build / CI
⚠️ CI failed on Linux_Nightly.pylatest_pip_scipy_dev ⚠️

**CI is still failing on [Linux_Nightly.pylatest_pip_scipy_dev](https://dev.azure.com/scikit-learn/scikit-learn/_build/results?buildId=45637&view=logs&j=dfe99b15-50db-5d7b-b1e9-4105c42527cf)** (Aug 16, 2022)
- test_grid_search_failing_classifier
- test_searchcv_raise_warning_with_non_finite_score[GridSearchCV-specialized_params0-False]
- test_searchcv_raise_warning_with_non_finite_score[GridSearchCV-specialized_params0-True]
- test_searchcv_raise_warning_with_non_finite_score[RandomizedSearchCV-specialized_params1-False]
- test_searchcv_raise_warning_with_non_finite_score[RandomizedSearchCV-specialized_params1-True]
- test_multi_output_predict_proba

COMMENT:
Hmmm for some reason we are stuck with an old version of the Scipy development wheel uploaded one month ago: https://anaconda.org/scipy-wheels-nightly/scipy/files?version=1.10.0.dev0%2B0.df3fe4e&page=1 (you can see it in one of the [log](https://dev.azure.com/scikit-learn/scikit-learn/_build/results?buildId=45014&view=logs&j=dfe99b15-50db-5d7b-b1e9-4105c42527cf&t=eb5122d5-ab7e-5479-a8ce-245b4d64938b&l=713) "Successfully installed numpy-1.24.0.dev0+569.gf1e50253a pandas-1.5.0.dev0+1172.ga7c5773d19 scipy-1.10.0.dev0+0.df3fe4e")

There have been plenty of more recent scipy wheels uploaded recently:
https://anaconda.org/scipy-wheels-nightly/scipy/files?version=&page=1

My guess is that the naming conventions is always `scipy-1.10.0.dev0+0.<something>.whl` instead of being `scipy-1.10.0.dev0+<increasing-number>.<something>.whl` (for OSX wheels the increasing number is there).

Compare this to numpy for example: https://anaconda.org/scipy-wheels-nightly/numpy/files?version=&page=1

I'll open a scipy issue about this. Edit: done in https://github.com/scipy/scipy/issues/16702

Labels: Build / CI
⚠️ CI failed on Linux_Nightly.pylatest_pip_scipy_dev ⚠️

**CI is still failing on [Linux_Nightly.pylatest_pip_scipy_dev](https://dev.azure.com/scikit-learn/scikit-learn/_build/results?buildId=45637&view=logs&j=dfe99b15-50db-5d7b-b1e9-4105c42527cf)** (Aug 16, 2022)
- test_grid_search_failing_classifier
- test_searchcv_raise_warning_with_non_finite_score[GridSearchCV-specialized_params0-False]
- test_searchcv_raise_warning_with_non_finite_score[GridSearchCV-specialized_params0-True]
- test_searchcv_raise_warning_with_non_finite_score[RandomizedSearchCV-specialized_params1-False]
- test_searchcv_raise_warning_with_non_finite_score[RandomizedSearchCV-specialized_params1-True]
- test_multi_output_predict_proba

COMMENT:
## CI is no longer failing! ✅

[Successful run](https://dev.azure.com/scikit-learn/scikit-learn/_build/results?buildId=45665&view=logs&j=dfe99b15-50db-5d7b-b1e9-4105c42527cf) on Aug 17, 2022

Labels: Build / CI
⚠️ CI failed on Linux_Nightly.pylatest_pip_scipy_dev ⚠️

**CI is still failing on [Linux_Nightly.pylatest_pip_scipy_dev](https://dev.azure.com/scikit-learn/scikit-learn/_build/results?buildId=45637&view=logs&j=dfe99b15-50db-5d7b-b1e9-4105c42527cf)** (Aug 16, 2022)
- test_grid_search_failing_classifier
- test_searchcv_raise_warning_with_non_finite_score[GridSearchCV-specialized_params0-False]
- test_searchcv_raise_warning_with_non_finite_score[GridSearchCV-specialized_params0-True]
- test_searchcv_raise_warning_with_non_finite_score[RandomizedSearchCV-specialized_params1-False]
- test_searchcv_raise_warning_with_non_finite_score[RandomizedSearchCV-specialized_params1-True]
- test_multi_output_predict_proba

COMMENT:
Thank you @lesteve for the final push!

Labels: Build / CI
⚠️ CI failed on Linux_Nightly.pylatest_pip_scipy_dev ⚠️

**CI is still failing on [Linux_Nightly.pylatest_pip_scipy_dev](https://dev.azure.com/scikit-learn/scikit-learn/_build/results?buildId=45637&view=logs&j=dfe99b15-50db-5d7b-b1e9-4105c42527cf)** (Aug 16, 2022)
- test_grid_search_failing_classifier
- test_searchcv_raise_warning_with_non_finite_score[GridSearchCV-specialized_params0-False]
- test_searchcv_raise_warning_with_non_finite_score[GridSearchCV-specialized_params0-True]
- test_searchcv_raise_warning_with_non_finite_score[RandomizedSearchCV-specialized_params1-False]
- test_searchcv_raise_warning_with_non_finite_score[RandomizedSearchCV-specialized_params1-True]
- test_multi_output_predict_proba

COMMENT:
Nice to see this one green!

Labels: Build / CI
800+ test failures in scipy-dev build

https://dev.azure.com/scikit-learn/scikit-learn/_build/results?buildId=43215&view=logs&j=dfe99b15-50db-5d7b-b1e9-4105c42527cf&t=ef785ae2-496b-5b02-9f0e-07a6c3ab3081

This deserves further investigation ...

Looks like scipy changed from 1.9dev to 1.10dev so maybe the scipy wheels were not updated in a while not 100% sure ... (the version was bumped in Scipy two weeks ago but we picked the 1.10dev wheels only today)

The script creating an issue automatically failed, I created https://github.com/scikit-learn/scikit-learn/pull/23615 to fix it.

COMMENT:
It seems that machine learning is relying a lot on solving linear algebra problem apparently ;)

Labels: Build / CI
800+ test failures in scipy-dev build

https://dev.azure.com/scikit-learn/scikit-learn/_build/results?buildId=43215&view=logs&j=dfe99b15-50db-5d7b-b1e9-4105c42527cf&t=ef785ae2-496b-5b02-9f0e-07a6c3ab3081

This deserves further investigation ...

Looks like scipy changed from 1.9dev to 1.10dev so maybe the scipy wheels were not updated in a while not 100% sure ... (the version was bumped in Scipy two weeks ago but we picked the 1.10dev wheels only today)

The script creating an issue automatically failed, I created https://github.com/scikit-learn/scikit-learn/pull/23615 to fix it.

COMMENT:
Closing in favour of #23626 now that the script creating the issue worked.

Labels: Build / CI
Mention factor x2 between MAE and mean pinball loss

### Describe the issue linked to the documentation

In the documentation, we mention that the mean pinball loss with `alpha=0.5` is equal to the mean absolute error.

With a small reproducer, it seems that we have a factor x2:

```python
import numpy as np
from sklearn.metrics import mean_absolute_error, mean_pinball_loss

rng = np.random.default_rng(0)
y_true = rng.normal(size=100)
indices = rng.choice(np.arange(y_true.size), size=30, replace=False)
y_pred = y_true.copy()
y_pred[indices] = y_pred[indices] + rng.normal(size=30)

print(
    f"MAE: {mean_absolute_error(y_true, y_pred)}\n"
    f"MPL: {mean_pinball_loss(y_true, y_pred, alpha=0.5)}"
)
```

```
MAE: 0.2213652899241902
MPL: 0.1106826449620951
```

From @lesteve link (https://stats.stackexchange.com/questions/440218/quantile-loss-50th-is-mae-is-it/440225#440225) it seems to be reasonable but I think that we should mention it in the documentation.

### Suggest a potential alternative/fix

Mention the constant.

I think that it could also be nice to have an additional test in `sklearn/metrics/tests/test_regression.py` that check this equality.

COMMENT:
The phrasing in the documentation is:

```
The pinball loss is equivalent to :func:`mean_absolute_error` when the quantile
parameter ``alpha`` is set to 0.5.
```

which is not wrong because we use "equivalent" (that was my mistake at the first reading). It could still be nice to have the equivalence mentioned.

Labels: Documentation, Needs Triage
.pyx and .pxd files are getting imported in my .py file

### Describe the bug

I was trying to contribute for one of the feature, while doing the debug, i encountered an import error. When i tried to analyse, it was .pyx and  .pyd file. Could anyone help me how to fix this?(Note:- i didn't pip install the sklearn.)

### Steps/Code to Reproduce

import neighbors._base

### Expected Results

shouldn't throw the error

### Actual Results

ModuleNotFoundError: No module named 'neighbors._ball_tree'

### Versions

```shell
didn't install the sklearn for now
```

COMMENT:
Hi, according to the [contributing guideline](https://scikit-learn.org/dev/developers/contributing.html#how-to-contribute) and [here](https://scikit-learn.org/dev/developers/advanced_installation.html#building-from-source), you need to build scikit-learn in development mode first to start contributing.

From what I know, the error happens because the .pyx files needs to be compiled first to C by Cython and then .so.
This build process is normally handled by `pip install` the sklearn.

Labels: Question
.pyx and .pxd files are getting imported in my .py file

### Describe the bug

I was trying to contribute for one of the feature, while doing the debug, i encountered an import error. When i tried to analyse, it was .pyx and  .pyd file. Could anyone help me how to fix this?(Note:- i didn't pip install the sklearn.)

### Steps/Code to Reproduce

import neighbors._base

### Expected Results

shouldn't throw the error

### Actual Results

ModuleNotFoundError: No module named 'neighbors._ball_tree'

### Versions

```shell
didn't install the sklearn for now
```

COMMENT:
(sklearn-env) F:\open_source\scikit-learn\sklearn\utils>python _param_validation.py
Traceback (most recent call last):
  File "bit_generator.pyx", line 40, in numpy.random.bit_generator
  File "C:\Users\Debasish Behera\AppData\Local\Programs\Python\Python38\lib\secrets.py", line 20, in <module>
    from random import SystemRandom
  File "F:\open_source\scikit-learn\sklearn\utils\random.py", line 5, in <module>
    import scipy.sparse as sp
  File "F:\open_source\scikit-learn\sklearn-env\lib\site-packages\scipy\__init__.py", line 71, in <module>
    from numpy import __version__ as __numpy_version__
ImportError: cannot import name '__version__' from partially initialized module 'numpy' (most likely due to a circular import) (F:\open_source\scikit-learn\sklearn-env\lib\site-packages\numpy\__init__.py)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "_param_validation.py", line 9, in <module>
    import numpy as np
  File "F:\open_source\scikit-learn\sklearn-env\lib\site-packages\numpy\__init__.py", line 155, in <module>
    from . import random
  File "F:\open_source\scikit-learn\sklearn-env\lib\site-packages\numpy\random\__init__.py", line 180, in <module>
    from . import _pickle
  File "F:\open_source\scikit-learn\sklearn-env\lib\site-packages\numpy\random\_pickle.py", line 1, in <module>
    from .mtrand import RandomState
  File "mtrand.pyx", line 1, in init numpy.random.mtrand
  File "bit_generator.pyx", line 43, in init numpy.random.bit_generator
  File "F:\open_source\scikit-learn\sklearn\utils\random.py", line 5, in <module>
    import scipy.sparse as sp
  File "F:\open_source\scikit-learn\sklearn-env\lib\site-packages\scipy\__init__.py", line 71, in <module>
    from numpy import __version__ as __numpy_version__
ImportError: cannot import name '__version__' from partially initialized module 'numpy' (most likely due to a circular import) (F:\open_source\scikit-learn\sklearn-env\lib\site-packages\numpy\__init__.py)



i builded by following the contributing guidlines. after that i tried to debug, i found this error while doing it. please help me with this.

Labels: Question
.pyx and .pxd files are getting imported in my .py file

### Describe the bug

I was trying to contribute for one of the feature, while doing the debug, i encountered an import error. When i tried to analyse, it was .pyx and  .pyd file. Could anyone help me how to fix this?(Note:- i didn't pip install the sklearn.)

### Steps/Code to Reproduce

import neighbors._base

### Expected Results

shouldn't throw the error

### Actual Results

ModuleNotFoundError: No module named 'neighbors._ball_tree'

### Versions

```shell
didn't install the sklearn for now
```

COMMENT:
closed .pyx and .pyd files are getting imported

Labels: Question