Talip7/scikit-learn-issues-multilabel huggingface dataset:
`FunctionTransformer.transform()` API Confusion

### Describe the issue linked to the documentation

Documentation in question: https://scikit-learn.org/stable/modules/generated/sklearn.preprocessing.FunctionTransformer.html#sklearn.preprocessing.FunctionTransformer.transform

I need the FunctionTransformer in order to convert some of my image normalization functions into Pipeline components. At normalization time, the dataset of images can't be coerced into a 2D array (they are different sizes and color modes) - the input I need to be acceptable is a _list_ of non-uniform images. The API states that X should be an array like, with (n_samples, n_features) dimensions. Thus, I thought I couldn't use this feature.

However, array input is _not_ required. When I configured my underlying function to accept a list, then I can pass a List into `FunctionTransformer.transform()`. If this isn't a desired workflow, I'd appreciate knowing of any alternatives.

### Suggest a potential alternative/fix

I'm proposing the parameter/docs be changed from:

- X: array-like, shape (n_samples, n_features)

To:

- X: Input satisfying the requirements of the underlying function

COMMENT:
Right, which looks a little bulky. But I'll give it a thumbs up because it would have helped me out.

Labels: Documentation, module:preprocessing
`FunctionTransformer.transform()` API Confusion

### Describe the issue linked to the documentation

Documentation in question: https://scikit-learn.org/stable/modules/generated/sklearn.preprocessing.FunctionTransformer.html#sklearn.preprocessing.FunctionTransformer.transform

I need the FunctionTransformer in order to convert some of my image normalization functions into Pipeline components. At normalization time, the dataset of images can't be coerced into a 2D array (they are different sizes and color modes) - the input I need to be acceptable is a _list_ of non-uniform images. The API states that X should be an array like, with (n_samples, n_features) dimensions. Thus, I thought I couldn't use this feature.

However, array input is _not_ required. When I configured my underlying function to accept a list, then I can pass a List into `FunctionTransformer.transform()`. If this isn't a desired workflow, I'd appreciate knowing of any alternatives.

### Suggest a potential alternative/fix

I'm proposing the parameter/docs be changed from:

- X: array-like, shape (n_samples, n_features)

To:

- X: Input satisfying the requirements of the underlying function

COMMENT:
Working on this

Labels: Documentation, module:preprocessing
Reduce warnings in test_logistic.py

### Description
The tests of `LogisticRegression` in `test_logistic.py` produce currently **468 warnings** (run `pytest sklearn/linear_model/tests/test_logistic.py`).
This is quite a lot and should be reduced.

### Remark
To explore the cause for the warnings, run `pytest -Werror sklearn/linear_model/tests/test_logistic.py`.

COMMENT:
This would be indeed nice. Maybe a way to start would be to catch is scaling the data when `solver="lbfgs"` can help at suppressing warning.

Labels: help wanted, module:linear_model, module:test-suite
`DictVectorizer` doesn't raise `NotFittedError` when using transform without prior fitting

### Describe the bug

When trying to call the `transform` method of an unfitted DictVectorizer instance an `AttributeError` is raised instead of a `NotFittedError` .

Other transformers, such as StandardScaler, make use of `check_is_fitted` to raise a `NotFittedError`.

_I'm willing to make a PR to add `check_is_fitted` to DictVectorizer. Please let me know, if that's ok._

### Steps/Code to Reproduce

```python
from sklearn.exceptions import NotFittedError
from sklearn.feature_extraction import DictVectorizer

feat_dict = [{'col1': 'a', 'col2': 'x'},{'col1': 'b', 'col2': 'y'}]
dv = DictVectorizer()

try:
    dv.transform(feat_dict)
except NotFittedError as e:
    print("DictVectorizer is not fitted yet.")
```

### Expected Results

`NotFittedError` is raised, because `transform` method was called without prior fitting.

### Actual Results

```python
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
Cell In [4], line 8
      5 dv = DictVectorizer()
      7 try:
----> 8     dv.transform(feat_dict)
      9 except NotFittedError as e:
     10     print("DictVectorizer is not fitted yet.")

File ~/../lib/python3.11/site-packages/sklearn/feature_extraction/_dict_vectorizer.py:373, in DictVectorizer.transform(self, X)
    356 def transform(self, X):
    357     """Transform feature->value dicts to array or sparse matrix.
    358 
    359     Named features not encountered during fit or fit_transform will be
   (...)
    371         Feature vectors; always 2-d.
    372     """
--> 373     return self._transform(X, fitting=False)

File ~/.../lib/python3.11/site-packages/sklearn/feature_extraction/_dict_vectorizer.py:207, in DictVectorizer._transform(self, X, fitting)
    205     vocab = {}
    206 else:
--> 207     feature_names = self.feature_names_
    208     vocab = self.vocabulary_
    210 transforming = True

AttributeError: 'DictVectorizer' object has no attribute 'feature_names_'
```

### Versions

```shell
System:
    python: 3.11.0 (main, Oct 24 2022, 19:56:13) [GCC 11.2.0]
executable: /home/user/.cache/pypoetry/virtualenvs/sklean-dev-SgMhZBSc-py3.11/bin/python
   machine: Linux-5.10.102.1-microsoft-standard-WSL2-x86_64-with-glibc2.35

Python dependencies:
      sklearn: 1.1.3
          pip: 22.3
   setuptools: 65.5.0
        numpy: 1.23.4
        scipy: 1.9.3
       Cython: None
       pandas: 1.5.1
   matplotlib: 3.6.0
       joblib: 1.2.0
threadpoolctl: 3.1.0

Built with OpenMP: True
```

COMMENT:
Indeed, we would expect such a warning. From the top of the head, the vectorizers are not passed into `check_estimator` because of the type of input. I assume that we don't have a test for it.

You can go ahead with a PR. In case this is the desired behavior, then the test suite should tell us but I don't think this is the case.

Labels: Bug, module:feature_extraction
`MatplotlibDeprecationWarnings` in examples

### Describe the issue linked to the documentation

Some `MatplotlibDeprecationWarning`s are still present in the dev documentation and need to be fixed.
Here a list:
- [x] [classification/plot_lda_qda.html](https://scikit-learn.org/dev/auto_examples/classification/plot_lda_qda.html) https://github.com/scikit-learn/scikit-learn/pull/24809
- [x] [cluster/plot_adjusted_for_chance_measures.html](https://scikit-learn.org/dev/auto_examples/cluster/plot_adjusted_for_chance_measures.html#sphx-glr-auto-examples-cluster-plot-adjusted-for-chance-measures-py) https://github.com/scikit-learn/scikit-learn/pull/24785
- [x] [datasets/plot_iris_dataset.html](https://scikit-learn.org/dev/auto_examples/datasets/plot_iris_dataset.html) https://github.com/scikit-learn/scikit-learn/pull/24813
- [x] [decomposition/plot_pca_3d.html](https://scikit-learn.org/dev/auto_examples/decomposition/plot_pca_3d.html) https://github.com/scikit-learn/scikit-learn/pull/24814
- [x] [decomposition/plot_pca_iris.html](https://scikit-learn.org/dev/auto_examples/decomposition/plot_pca_iris.html) https://github.com/scikit-learn/scikit-learn/pull/24815
- [x] [linear_model/plot_lasso_and_elasticnet.html](https://scikit-learn.org/dev/auto_examples/linear_model/plot_lasso_and_elasticnet.html#sphx-glr-auto-examples-linear-model-plot-lasso-and-elasticnet-py) https://github.com/scikit-learn/scikit-learn/pull/24832
- [x] [linear_model/plot_ols_3d.html](https://scikit-learn.org/dev/auto_examples/linear_model/plot_ols_3d.html) https://github.com/scikit-learn/scikit-learn/pull/24820
- [x] [linear_model/plot_omp.html](https://scikit-learn.org/dev/auto_examples/linear_model/plot_omp.html) https://github.com/scikit-learn/scikit-learn/pull/24833
- [x] [linear_model/plot_sgd_early_stopping.html](https://scikit-learn.org/dev/auto_examples/linear_model/plot_sgd_early_stopping.html]) https://github.com/scikit-learn/scikit-learn/pull/24841
- [x] [mixture/plot_concentration_prior.html](https://scikit-learn.org/dev/auto_examples/mixture/plot_concentration_prior.html) https://github.com/scikit-learn/scikit-learn/pull/24821
- [x] [mixture/plot_gmm_covariances.html](https://scikit-learn.org/dev/auto_examples/mixture/plot_gmm_covariances.html) https://github.com/scikit-learn/scikit-learn/pull/24822
- [x] [mixture/plot_gmm.html](https://scikit-learn.org/dev/auto_examples/mixture/plot_gmm.html) https://github.com/scikit-learn/scikit-learn/pull/24823
- [x] [mixture/plot_gmm_selection.html](https://scikit-learn.org/dev/auto_examples/mixture/plot_gmm_selection.html) https://github.com/scikit-learn/scikit-learn/pull/24721
- [x] [mixture/plot_gmm_sin.html](https://scikit-learn.org/dev/auto_examples/mixture/plot_gmm_sin.html) https://github.com/scikit-learn/scikit-learn/pull/24824

Contributors willing to address this issue, please offer **one example per pull request**.
Also be sure to install matplotlib 3.6.1 locally in order to reproduce the Warning.

Thanks for your help!

COMMENT:
I will be happy to help ✋

Labels: Documentation, good first issue, Meta-issue
`MatplotlibDeprecationWarnings` in examples

### Describe the issue linked to the documentation

Some `MatplotlibDeprecationWarning`s are still present in the dev documentation and need to be fixed.
Here a list:
- [x] [classification/plot_lda_qda.html](https://scikit-learn.org/dev/auto_examples/classification/plot_lda_qda.html) https://github.com/scikit-learn/scikit-learn/pull/24809
- [x] [cluster/plot_adjusted_for_chance_measures.html](https://scikit-learn.org/dev/auto_examples/cluster/plot_adjusted_for_chance_measures.html#sphx-glr-auto-examples-cluster-plot-adjusted-for-chance-measures-py) https://github.com/scikit-learn/scikit-learn/pull/24785
- [x] [datasets/plot_iris_dataset.html](https://scikit-learn.org/dev/auto_examples/datasets/plot_iris_dataset.html) https://github.com/scikit-learn/scikit-learn/pull/24813
- [x] [decomposition/plot_pca_3d.html](https://scikit-learn.org/dev/auto_examples/decomposition/plot_pca_3d.html) https://github.com/scikit-learn/scikit-learn/pull/24814
- [x] [decomposition/plot_pca_iris.html](https://scikit-learn.org/dev/auto_examples/decomposition/plot_pca_iris.html) https://github.com/scikit-learn/scikit-learn/pull/24815
- [x] [linear_model/plot_lasso_and_elasticnet.html](https://scikit-learn.org/dev/auto_examples/linear_model/plot_lasso_and_elasticnet.html#sphx-glr-auto-examples-linear-model-plot-lasso-and-elasticnet-py) https://github.com/scikit-learn/scikit-learn/pull/24832
- [x] [linear_model/plot_ols_3d.html](https://scikit-learn.org/dev/auto_examples/linear_model/plot_ols_3d.html) https://github.com/scikit-learn/scikit-learn/pull/24820
- [x] [linear_model/plot_omp.html](https://scikit-learn.org/dev/auto_examples/linear_model/plot_omp.html) https://github.com/scikit-learn/scikit-learn/pull/24833
- [x] [linear_model/plot_sgd_early_stopping.html](https://scikit-learn.org/dev/auto_examples/linear_model/plot_sgd_early_stopping.html]) https://github.com/scikit-learn/scikit-learn/pull/24841
- [x] [mixture/plot_concentration_prior.html](https://scikit-learn.org/dev/auto_examples/mixture/plot_concentration_prior.html) https://github.com/scikit-learn/scikit-learn/pull/24821
- [x] [mixture/plot_gmm_covariances.html](https://scikit-learn.org/dev/auto_examples/mixture/plot_gmm_covariances.html) https://github.com/scikit-learn/scikit-learn/pull/24822
- [x] [mixture/plot_gmm.html](https://scikit-learn.org/dev/auto_examples/mixture/plot_gmm.html) https://github.com/scikit-learn/scikit-learn/pull/24823
- [x] [mixture/plot_gmm_selection.html](https://scikit-learn.org/dev/auto_examples/mixture/plot_gmm_selection.html) https://github.com/scikit-learn/scikit-learn/pull/24721
- [x] [mixture/plot_gmm_sin.html](https://scikit-learn.org/dev/auto_examples/mixture/plot_gmm_sin.html) https://github.com/scikit-learn/scikit-learn/pull/24824

Contributors willing to address this issue, please offer **one example per pull request**.
Also be sure to install matplotlib 3.6.1 locally in order to reproduce the Warning.

Thanks for your help!

COMMENT:
Thanks @cmarmo it worked!

Labels: Documentation, good first issue, Meta-issue
`MatplotlibDeprecationWarnings` in examples

### Describe the issue linked to the documentation

Some `MatplotlibDeprecationWarning`s are still present in the dev documentation and need to be fixed.
Here a list:
- [x] [classification/plot_lda_qda.html](https://scikit-learn.org/dev/auto_examples/classification/plot_lda_qda.html) https://github.com/scikit-learn/scikit-learn/pull/24809
- [x] [cluster/plot_adjusted_for_chance_measures.html](https://scikit-learn.org/dev/auto_examples/cluster/plot_adjusted_for_chance_measures.html#sphx-glr-auto-examples-cluster-plot-adjusted-for-chance-measures-py) https://github.com/scikit-learn/scikit-learn/pull/24785
- [x] [datasets/plot_iris_dataset.html](https://scikit-learn.org/dev/auto_examples/datasets/plot_iris_dataset.html) https://github.com/scikit-learn/scikit-learn/pull/24813
- [x] [decomposition/plot_pca_3d.html](https://scikit-learn.org/dev/auto_examples/decomposition/plot_pca_3d.html) https://github.com/scikit-learn/scikit-learn/pull/24814
- [x] [decomposition/plot_pca_iris.html](https://scikit-learn.org/dev/auto_examples/decomposition/plot_pca_iris.html) https://github.com/scikit-learn/scikit-learn/pull/24815
- [x] [linear_model/plot_lasso_and_elasticnet.html](https://scikit-learn.org/dev/auto_examples/linear_model/plot_lasso_and_elasticnet.html#sphx-glr-auto-examples-linear-model-plot-lasso-and-elasticnet-py) https://github.com/scikit-learn/scikit-learn/pull/24832
- [x] [linear_model/plot_ols_3d.html](https://scikit-learn.org/dev/auto_examples/linear_model/plot_ols_3d.html) https://github.com/scikit-learn/scikit-learn/pull/24820
- [x] [linear_model/plot_omp.html](https://scikit-learn.org/dev/auto_examples/linear_model/plot_omp.html) https://github.com/scikit-learn/scikit-learn/pull/24833
- [x] [linear_model/plot_sgd_early_stopping.html](https://scikit-learn.org/dev/auto_examples/linear_model/plot_sgd_early_stopping.html]) https://github.com/scikit-learn/scikit-learn/pull/24841
- [x] [mixture/plot_concentration_prior.html](https://scikit-learn.org/dev/auto_examples/mixture/plot_concentration_prior.html) https://github.com/scikit-learn/scikit-learn/pull/24821
- [x] [mixture/plot_gmm_covariances.html](https://scikit-learn.org/dev/auto_examples/mixture/plot_gmm_covariances.html) https://github.com/scikit-learn/scikit-learn/pull/24822
- [x] [mixture/plot_gmm.html](https://scikit-learn.org/dev/auto_examples/mixture/plot_gmm.html) https://github.com/scikit-learn/scikit-learn/pull/24823
- [x] [mixture/plot_gmm_selection.html](https://scikit-learn.org/dev/auto_examples/mixture/plot_gmm_selection.html) https://github.com/scikit-learn/scikit-learn/pull/24721
- [x] [mixture/plot_gmm_sin.html](https://scikit-learn.org/dev/auto_examples/mixture/plot_gmm_sin.html) https://github.com/scikit-learn/scikit-learn/pull/24824

Contributors willing to address this issue, please offer **one example per pull request**.
Also be sure to install matplotlib 3.6.1 locally in order to reproduce the Warning.

Thanks for your help!

COMMENT:
Thanks to everyone who contributed on this issue !

Labels: Documentation, good first issue, Meta-issue
URLs of citeseer or citeseerx should be updated

### Describe the issue linked to the documentation

Files pointed by the `citeseer` or `citeseerx` URLs are no longer reachable. I think the site has updated its routes to the files. 

The good news is that there are only 25 places in 17 files to be modified
![image](https://user-images.githubusercontent.com/8778305/199014330-e604a631-58a6-41cc-be9f-083098c88e3d.png)


### Suggest a potential alternative/fix

For example, the URL in `clustering.rst`

`"A Random Walks View of Spectral Segmentation"
   <http://citeseer.ist.psu.edu/viewdoc/summary?doi=10.1.1.33.1501>`_

should be replaced with https://citeseerx.ist.psu.edu/pdf/84a86a69315e994cfd1e0c7debb86d62d7bd1f44 or https://citeseerx.ist.psu.edu/doc_view/pid/84a86a69315e994cfd1e0c7debb86d62d7bd1f44

![image](https://user-images.githubusercontent.com/8778305/199014633-d2c364af-acdf-4f51-9cd3-245c66b52264.png)
![image](https://user-images.githubusercontent.com/8778305/199014721-dd97047d-d575-4f19-a99d-47b38b8d233f.png)

COMMENT:
Would you like to make a PR that updates the links?

It is a bit annoying for citeseer to break URLs like this :-/

Labels: Documentation
URLs of citeseer or citeseerx should be updated

### Describe the issue linked to the documentation

Files pointed by the `citeseer` or `citeseerx` URLs are no longer reachable. I think the site has updated its routes to the files. 

The good news is that there are only 25 places in 17 files to be modified
![image](https://user-images.githubusercontent.com/8778305/199014330-e604a631-58a6-41cc-be9f-083098c88e3d.png)


### Suggest a potential alternative/fix

For example, the URL in `clustering.rst`

`"A Random Walks View of Spectral Segmentation"
   <http://citeseer.ist.psu.edu/viewdoc/summary?doi=10.1.1.33.1501>`_

should be replaced with https://citeseerx.ist.psu.edu/pdf/84a86a69315e994cfd1e0c7debb86d62d7bd1f44 or https://citeseerx.ist.psu.edu/doc_view/pid/84a86a69315e994cfd1e0c7debb86d62d7bd1f44

![image](https://user-images.githubusercontent.com/8778305/199014633-d2c364af-acdf-4f51-9cd3-245c66b52264.png)
![image](https://user-images.githubusercontent.com/8778305/199014721-dd97047d-d575-4f19-a99d-47b38b8d233f.png)

COMMENT:
I can have a look at this and change the links.

Labels: Documentation
URLs of citeseer or citeseerx should be updated

### Describe the issue linked to the documentation

Files pointed by the `citeseer` or `citeseerx` URLs are no longer reachable. I think the site has updated its routes to the files. 

The good news is that there are only 25 places in 17 files to be modified
![image](https://user-images.githubusercontent.com/8778305/199014330-e604a631-58a6-41cc-be9f-083098c88e3d.png)


### Suggest a potential alternative/fix

For example, the URL in `clustering.rst`

`"A Random Walks View of Spectral Segmentation"
   <http://citeseer.ist.psu.edu/viewdoc/summary?doi=10.1.1.33.1501>`_

should be replaced with https://citeseerx.ist.psu.edu/pdf/84a86a69315e994cfd1e0c7debb86d62d7bd1f44 or https://citeseerx.ist.psu.edu/doc_view/pid/84a86a69315e994cfd1e0c7debb86d62d7bd1f44

![image](https://user-images.githubusercontent.com/8778305/199014633-d2c364af-acdf-4f51-9cd3-245c66b52264.png)
![image](https://user-images.githubusercontent.com/8778305/199014721-dd97047d-d575-4f19-a99d-47b38b8d233f.png)

COMMENT:
If @wenh06 isn't of course already doing this :)

Labels: Documentation
ValueError: The loss log_loss is not supported.

### Describe the bug

I have this error, and I can't find a solution when using SGDClassifier with the loss="log_loss" parameter to take advantage of online learning as LR



### Steps/Code to Reproduce

```
#training
df_training = df.head(int(len(df) * config.training))
y_train = df_training[config.class_object]
X_train = df_training.drop(config.class_object, axis=1)

model = SGDClassifier(loss="log_loss", alpha=0.01)
model.fit(X_train, y_train)
```

### Expected Results

train with log_loss




### Actual Results

```
D:\app\kafka\Kafka_Python>python -m consumerLR creditcardfraud
Traceback (most recent call last):
  File "C:\Users\PC\AppData\Local\Programs\Python\Python37\lib\runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "C:\Users\PC\AppData\Local\Programs\Python\Python37\lib\runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "D:\app\kafka\Kafka_Python\consumerLR\__main__.py", line 3, in <module>
    from .model.LogisticRegression import model
  File "D:\app\kafka\Kafka_Python\consumerLR\model\LogisticRegression.py", line 19, in <module>
    model.fit(X_train.values, y_train.values)
  File "C:\Users\PC\AppData\Local\Programs\Python\Python37\lib\site-packages\sklearn\linear_model\_stochastic_gradient.py", line 892, in fit
    sample_weight=sample_weight,
  File "C:\Users\PC\AppData\Local\Programs\Python\Python37\lib\site-packages\sklearn\linear_model\_stochastic_gradient.py", line 649, in _fit
    self._validate_params()
  File "C:\Users\PC\AppData\Local\Programs\Python\Python37\lib\site-packages\sklearn\linear_model\_stochastic_gradient.py", line 162, in _validate_params
    raise ValueError("The loss %s is not supported. " % self.loss)
ValueError: The loss log_loss is not supported.
```


### Versions

```shell
C:\Users\PC>python -m pip install --upgrade sklearn
Requirement already satisfied: sklearn in c:\users\pc\appdata\local\programs\python\python37\lib\site-packages (0.0)
Requirement already satisfied: scikit-learn in c:\users\pc\appdata\local\programs\python\python37\lib\site-packages (from sklearn) (1.0.2)
Requirement already satisfied: joblib>=0.11 in c:\users\pc\appdata\local\programs\python\python37\lib\site-packages (from scikit-learn->sklearn) (1.1.0)
Requirement already satisfied: numpy>=1.14.6 in c:\users\pc\appdata\local\programs\python\python37\lib\site-packages (from scikit-learn->sklearn) (1.21.6)
Requirement already satisfied: threadpoolctl>=2.0.0 in c:\users\pc\appdata\local\programs\python\python37\lib\site-packages (from scikit-learn->sklearn) (3.1.0)
Requirement already satisfied: scipy>=1.1.0 in c:\users\pc\appdata\local\programs\python\python37\lib\site-packages (from scikit-learn->sklearn) (1.7.3)
```

COMMENT:
`log_loss` was added in `1.1` and you are using `1.0`. Be aware that scikit-learn 1.0 is the latest release supporting Python 3.7, as recommended by the [NEP 29](https://numpy.org/neps/nep-0029-deprecation_policy.html). You will need to upgrade Python to get the latest scikit-learn.

Labels: Bug, Needs Triage
Example change produces warnings in documentation

### Describe the issue linked to the documentation

The tutorial about [Unsupervised learning](https://scikit-learn.org/dev/tutorial/statistical_inference/unsupervised_learning.html) in the development version is missing images from the K-means clustering example. This is not the case for the stable version.
The changes in https://github.com/scikit-learn/scikit-learn/pull/24692 join all the plots in one figure.

### Suggest a potential alternative/fix

We already had a similar issue in the past, https://github.com/scikit-learn/scikit-learn/issues/22061, and it was decided to regenerate the images.
My opinion is that getting rid of the links to the missing images should be enough in this case.

COMMENT:
Indeed, I merge the 4 individual figures into a single figure to simplify and avoid some Matplotlib warnings.

Labels: Documentation
Example change produces warnings in documentation

### Describe the issue linked to the documentation

The tutorial about [Unsupervised learning](https://scikit-learn.org/dev/tutorial/statistical_inference/unsupervised_learning.html) in the development version is missing images from the K-means clustering example. This is not the case for the stable version.
The changes in https://github.com/scikit-learn/scikit-learn/pull/24692 join all the plots in one figure.

### Suggest a potential alternative/fix

We already had a similar issue in the past, https://github.com/scikit-learn/scikit-learn/issues/22061, and it was decided to regenerate the images.
My opinion is that getting rid of the links to the missing images should be enough in this case.

COMMENT:
/take

Labels: Documentation