Talip7/scikit-learn-issues-multilabel huggingface dataset:
Add Hannan-Quinn IC to LassoLarsIC

### Describe the workflow you want to enable

Hannan–Quinn information criterion was originally described to be an alternative model selection criterion for autoregressive models, but it could be used in other cases too. Unlike AIC it also penalizes model's number of parameters, but unlike BIC it imposes a smaller penalty on complex models in large samples, which is beneficial when working with large amounts of complex data.

Some links: [wiki](https://en.wikipedia.org/wiki/Hannan%E2%80%93Quinn_information_criterion), [original paper](https://www.jstor.org/stable/2985032), [comparison of different IC for autoregressive models](http://www3.stat.sinica.edu.tw/statistica/oldpdf/A3n214.pdf), [model selection techniques overview](https://arxiv.org/pdf/1810.09583.pdf)

### Describe your proposed solution

Adding two lines of code to existing implementation:
            
`elif self.criterion == "hqic":`
    `    criterion_factor = 2*log(log(n_samples))`

### Describe alternatives you've considered, if relevant

_No response_

### Additional context

It shouldn't be too costly to maintain and will provide valid alternatives to AIC and BIC.

COMMENT:
Since there is no interest in this feature, I'm closing the issue

Labels: New Feature, module:linear_model, Needs Decision - Include Feature
⚠️ CI failed on Linux.ubuntu_atlas ⚠️

**CI is still failing on [Linux.ubuntu_atlas](https://dev.azure.com/scikit-learn/scikit-learn/_build/results?buildId=46059&view=logs&j=0a287ed6-22f4-5cb4-88b1-d5fcdc4d8b7e)** (Aug 30, 2022)
- Test Collection Failure

COMMENT:
## CI is no longer failing! ✅

[Successful run](https://dev.azure.com/scikit-learn/scikit-learn/_build/results?buildId=49279&view=logs&j=0a287ed6-22f4-5cb4-88b1-d5fcdc4d8b7e) on Nov 25, 2022

Labels: Build / CI
⚠️ CI failed on Linux.ubuntu_atlas ⚠️

**CI is still failing on [Linux.ubuntu_atlas](https://dev.azure.com/scikit-learn/scikit-learn/_build/results?buildId=46059&view=logs&j=0a287ed6-22f4-5cb4-88b1-d5fcdc4d8b7e)** (Aug 30, 2022)
- Test Collection Failure

COMMENT:
As noted in https://github.com/scikit-learn/scikit-learn/issues/24131#issuecomment-1211756677, this was fixed in #24168

Labels: Build / CI
⚠️ CI failed on Linux.ubuntu_atlas ⚠️

**CI is still failing on [Linux.ubuntu_atlas](https://dev.azure.com/scikit-learn/scikit-learn/_build/results?buildId=46059&view=logs&j=0a287ed6-22f4-5cb4-88b1-d5fcdc4d8b7e)** (Aug 30, 2022)
- Test Collection Failure

COMMENT:
:thinking: there were two separate issues here. The pairwise distances one was fixed but the fastica one debugged in https://github.com/scikit-learn/scikit-learn/issues/24131#issuecomment-1208091119 still exists.

I'll reopen this one for now. Do you think it is better to open a separate issue about it?

Labels: Build / CI
⚠️ CI failed on Linux.ubuntu_atlas ⚠️

**CI is still failing on [Linux.ubuntu_atlas](https://dev.azure.com/scikit-learn/scikit-learn/_build/results?buildId=46059&view=logs&j=0a287ed6-22f4-5cb4-88b1-d5fcdc4d8b7e)** (Aug 30, 2022)
- Test Collection Failure

COMMENT:
Ah I see, there are two issues. I'm okay with keeping this open.

Labels: Build / CI
⚠️ CI failed on Linux.ubuntu_atlas ⚠️

**CI is still failing on [Linux.ubuntu_atlas](https://dev.azure.com/scikit-learn/scikit-learn/_build/results?buildId=46059&view=logs&j=0a287ed6-22f4-5cb4-88b1-d5fcdc4d8b7e)** (Aug 30, 2022)
- Test Collection Failure

COMMENT:
@jjerphan to help understand the nature of the failures found by `assert_argkmin_results_quasi_equality` it would help to report the original distances (before rounding) for the nighbor indices in the 2 rounded dist groups in the `AssertionError` message.

Labels: Build / CI
⚠️ CI failed on Linux.ubuntu_atlas ⚠️

**CI is still failing on [Linux.ubuntu_atlas](https://dev.azure.com/scikit-learn/scikit-learn/_build/results?buildId=46059&view=logs&j=0a287ed6-22f4-5cb4-88b1-d5fcdc4d8b7e)** (Aug 30, 2022)
- Test Collection Failure

COMMENT:
> @jjerphan to help understand the nature of the failures found by `assert_argkmin_results_quasi_equality` it would help to report the original distances (before rounding) for the nighbor indices in the 2 rounded dist groups in the `AssertionError` message.

That's a good suggestion. I've added an item in the description of https://github.com/scikit-learn/scikit-learn/issues/22587.

Labels: Build / CI
⚠️ CI failed on Linux.ubuntu_atlas ⚠️

**CI is still failing on [Linux.ubuntu_atlas](https://dev.azure.com/scikit-learn/scikit-learn/_build/results?buildId=46059&view=logs&j=0a287ed6-22f4-5cb4-88b1-d5fcdc4d8b7e)** (Aug 30, 2022)
- Test Collection Failure

COMMENT:
Closing since #24198 has been merged it should not happen again.

Labels: Build / CI
The documentation search is broken.

### Describe the issue linked to the documentation

When searching for methods, it gives an empty page in response to any request

### Suggest a potential alternative/fix

_No response_

COMMENT:
Thanks for the report, this will likely be fixed by https://github.com/scikit-learn/scikit-learn/pull/25504.

@brainsnewmath don't hesitate to open a new issue next time, rather than commenting on an old issue, which has already been closed!

Labels: Bug, Documentation
RandomForestClassifier RAM memory increase on newer versions

### Describe the bug

I tested the performance of my program on different sklearn versions. I found that the program uses more memory when sklearn is on the latest version compared to older versions. 
```shell
1.0.1    1449MB
0.24.2   1338MB
0.23.2   1443MB
0.22.1   1314MB
0.22     1381MB
0.21.3   503MB
0.20.3   494MB
0.19.2   591MB
```
By the way, there is no effect on the evaluation of program execution time and output results.

### Steps/Code to Reproduce


[train.zip](https://github.com/scikit-learn/scikit-learn/files/9268813/train.zip)
[test.zip](https://github.com/scikit-learn/scikit-learn/files/9268826/test.zip)

```python
import numpy as np 
import pandas as pd 
df_train = pd.read_csv("train.csv")
df_test = pd.read_csv("test.csv")
df_train.isna().sum()
df_test.isna().sum()
df_train.info()
object_type = np.dtype("O")
df_train = df_train.apply(lambda x: x.fillna("NA") if x.dtype == object_type
                                       else x.fillna(-1))
df_test = df_test.apply(lambda x: x.fillna("NA") if x.dtype == object_type
                                       else x.fillna(-1))
from sklearn.preprocessing import LabelEncoder
categorical_columns = df_train.select_dtypes("object")
for col in categorical_columns:
    encoder = LabelEncoder()
    encoded = encoder.fit_transform(df_train[col])
    df_train[col] = encoded
categorical_columns = df_test.select_dtypes("object")
for col in categorical_columns:
    encoder = LabelEncoder()
    encoded = encoder.fit_transform(df_test[col])
    df_test[col] = encoded
from sklearn.model_selection import train_test_split
X = df_train.drop(["id","target"],axis=1)
y = df_train.target
X_train, X_test, y_train, y_test = train_test_split(X,y) 
import tracemalloc
tracemalloc.start()
from sklearn.ensemble import RandomForestClassifier 
rf = RandomForestClassifier(n_jobs=-1,n_estimators=100)
rf.fit(X_train,y_train)
preds = rf.predict(X_test)
preds = rf.predict(df_test.drop("id",axis=1))
import sklearn
print(sklearn.__version__)
current3, peak3 = tracemalloc.get_traced_memory()
print("Get_dummies memory usage is {",current3 /1024/1024,"}MB; Peak memory was :{",peak3 / 1024/1024,"}MB")
```

### Expected Results

Same memory usage

### Actual Results

The newer versions spend more RAM memory .


### Versions

```shell
1.0.1
0.24.2
0.23.2
0.22.1
0.22
0.21.3
0.20.3
0.19.2
```

COMMENT:
Could be connected to addition of `max_samples` feature that generates several int arrays of shape (N, 1), but I'm not sure

Labels: module:ensemble, Needs Investigation
RandomForestClassifier RAM memory increase on newer versions

### Describe the bug

I tested the performance of my program on different sklearn versions. I found that the program uses more memory when sklearn is on the latest version compared to older versions. 
```shell
1.0.1    1449MB
0.24.2   1338MB
0.23.2   1443MB
0.22.1   1314MB
0.22     1381MB
0.21.3   503MB
0.20.3   494MB
0.19.2   591MB
```
By the way, there is no effect on the evaluation of program execution time and output results.

### Steps/Code to Reproduce


[train.zip](https://github.com/scikit-learn/scikit-learn/files/9268813/train.zip)
[test.zip](https://github.com/scikit-learn/scikit-learn/files/9268826/test.zip)

```python
import numpy as np 
import pandas as pd 
df_train = pd.read_csv("train.csv")
df_test = pd.read_csv("test.csv")
df_train.isna().sum()
df_test.isna().sum()
df_train.info()
object_type = np.dtype("O")
df_train = df_train.apply(lambda x: x.fillna("NA") if x.dtype == object_type
                                       else x.fillna(-1))
df_test = df_test.apply(lambda x: x.fillna("NA") if x.dtype == object_type
                                       else x.fillna(-1))
from sklearn.preprocessing import LabelEncoder
categorical_columns = df_train.select_dtypes("object")
for col in categorical_columns:
    encoder = LabelEncoder()
    encoded = encoder.fit_transform(df_train[col])
    df_train[col] = encoded
categorical_columns = df_test.select_dtypes("object")
for col in categorical_columns:
    encoder = LabelEncoder()
    encoded = encoder.fit_transform(df_test[col])
    df_test[col] = encoded
from sklearn.model_selection import train_test_split
X = df_train.drop(["id","target"],axis=1)
y = df_train.target
X_train, X_test, y_train, y_test = train_test_split(X,y) 
import tracemalloc
tracemalloc.start()
from sklearn.ensemble import RandomForestClassifier 
rf = RandomForestClassifier(n_jobs=-1,n_estimators=100)
rf.fit(X_train,y_train)
preds = rf.predict(X_test)
preds = rf.predict(df_test.drop("id",axis=1))
import sklearn
print(sklearn.__version__)
current3, peak3 = tracemalloc.get_traced_memory()
print("Get_dummies memory usage is {",current3 /1024/1024,"}MB; Peak memory was :{",peak3 / 1024/1024,"}MB")
```

### Expected Results

Same memory usage

### Actual Results

The newer versions spend more RAM memory .


### Versions

```shell
1.0.1
0.24.2
0.23.2
0.22.1
0.22
0.21.3
0.20.3
0.19.2
```

COMMENT:
The default value of `n_estimators` changed from 10 to 100. It means that we store 100 `DecisionTreeClassifier` internally. It explains the memory increase.

Labels: module:ensemble, Needs Investigation
RandomForestClassifier RAM memory increase on newer versions

### Describe the bug

I tested the performance of my program on different sklearn versions. I found that the program uses more memory when sklearn is on the latest version compared to older versions. 
```shell
1.0.1    1449MB
0.24.2   1338MB
0.23.2   1443MB
0.22.1   1314MB
0.22     1381MB
0.21.3   503MB
0.20.3   494MB
0.19.2   591MB
```
By the way, there is no effect on the evaluation of program execution time and output results.

### Steps/Code to Reproduce


[train.zip](https://github.com/scikit-learn/scikit-learn/files/9268813/train.zip)
[test.zip](https://github.com/scikit-learn/scikit-learn/files/9268826/test.zip)

```python
import numpy as np 
import pandas as pd 
df_train = pd.read_csv("train.csv")
df_test = pd.read_csv("test.csv")
df_train.isna().sum()
df_test.isna().sum()
df_train.info()
object_type = np.dtype("O")
df_train = df_train.apply(lambda x: x.fillna("NA") if x.dtype == object_type
                                       else x.fillna(-1))
df_test = df_test.apply(lambda x: x.fillna("NA") if x.dtype == object_type
                                       else x.fillna(-1))
from sklearn.preprocessing import LabelEncoder
categorical_columns = df_train.select_dtypes("object")
for col in categorical_columns:
    encoder = LabelEncoder()
    encoded = encoder.fit_transform(df_train[col])
    df_train[col] = encoded
categorical_columns = df_test.select_dtypes("object")
for col in categorical_columns:
    encoder = LabelEncoder()
    encoded = encoder.fit_transform(df_test[col])
    df_test[col] = encoded
from sklearn.model_selection import train_test_split
X = df_train.drop(["id","target"],axis=1)
y = df_train.target
X_train, X_test, y_train, y_test = train_test_split(X,y) 
import tracemalloc
tracemalloc.start()
from sklearn.ensemble import RandomForestClassifier 
rf = RandomForestClassifier(n_jobs=-1,n_estimators=100)
rf.fit(X_train,y_train)
preds = rf.predict(X_test)
preds = rf.predict(df_test.drop("id",axis=1))
import sklearn
print(sklearn.__version__)
current3, peak3 = tracemalloc.get_traced_memory()
print("Get_dummies memory usage is {",current3 /1024/1024,"}MB; Peak memory was :{",peak3 / 1024/1024,"}MB")
```

### Expected Results

Same memory usage

### Actual Results

The newer versions spend more RAM memory .


### Versions

```shell
1.0.1
0.24.2
0.23.2
0.22.1
0.22
0.21.3
0.20.3
0.19.2
```

COMMENT:
The script uses `rf = RandomForestClassifier(n_jobs=-1,n_estimators=100)` so that change should already be "factored in", no?

Labels: module:ensemble, Needs Investigation
RandomForestClassifier RAM memory increase on newer versions

### Describe the bug

I tested the performance of my program on different sklearn versions. I found that the program uses more memory when sklearn is on the latest version compared to older versions. 
```shell
1.0.1    1449MB
0.24.2   1338MB
0.23.2   1443MB
0.22.1   1314MB
0.22     1381MB
0.21.3   503MB
0.20.3   494MB
0.19.2   591MB
```
By the way, there is no effect on the evaluation of program execution time and output results.

### Steps/Code to Reproduce


[train.zip](https://github.com/scikit-learn/scikit-learn/files/9268813/train.zip)
[test.zip](https://github.com/scikit-learn/scikit-learn/files/9268826/test.zip)

```python
import numpy as np 
import pandas as pd 
df_train = pd.read_csv("train.csv")
df_test = pd.read_csv("test.csv")
df_train.isna().sum()
df_test.isna().sum()
df_train.info()
object_type = np.dtype("O")
df_train = df_train.apply(lambda x: x.fillna("NA") if x.dtype == object_type
                                       else x.fillna(-1))
df_test = df_test.apply(lambda x: x.fillna("NA") if x.dtype == object_type
                                       else x.fillna(-1))
from sklearn.preprocessing import LabelEncoder
categorical_columns = df_train.select_dtypes("object")
for col in categorical_columns:
    encoder = LabelEncoder()
    encoded = encoder.fit_transform(df_train[col])
    df_train[col] = encoded
categorical_columns = df_test.select_dtypes("object")
for col in categorical_columns:
    encoder = LabelEncoder()
    encoded = encoder.fit_transform(df_test[col])
    df_test[col] = encoded
from sklearn.model_selection import train_test_split
X = df_train.drop(["id","target"],axis=1)
y = df_train.target
X_train, X_test, y_train, y_test = train_test_split(X,y) 
import tracemalloc
tracemalloc.start()
from sklearn.ensemble import RandomForestClassifier 
rf = RandomForestClassifier(n_jobs=-1,n_estimators=100)
rf.fit(X_train,y_train)
preds = rf.predict(X_test)
preds = rf.predict(df_test.drop("id",axis=1))
import sklearn
print(sklearn.__version__)
current3, peak3 = tracemalloc.get_traced_memory()
print("Get_dummies memory usage is {",current3 /1024/1024,"}MB; Peak memory was :{",peak3 / 1024/1024,"}MB")
```

### Expected Results

Same memory usage

### Actual Results

The newer versions spend more RAM memory .


### Versions

```shell
1.0.1
0.24.2
0.23.2
0.22.1
0.22
0.21.3
0.20.3
0.19.2
```

COMMENT:
Right, I forgot to read again the script before to come back on the issue, my bad.
Reopening. We will need more investigation and small profiling, then.

Labels: module:ensemble, Needs Investigation
⚠️ CI failed on Wheel builder ⚠️

**CI is still failing on [Wheel builder](https://github.com/scikit-learn/scikit-learn/actions/runs/2801198918)** (Aug 05, 2022)

COMMENT:
For the failing test `SpectralEmbedding()-check_pipeline_consistency`, it looks like the columns are flipped:

```
  E       AssertionError: 
  E       Not equal to tolerance rtol=1e-07, atol=1e-09
  E       
  E       Mismatched elements: 60 / 60 (100%)
  E       Max absolute difference: 0.27740543
  E       Max relative difference: 9.4893366
  E        x: array([[-0.140034,  0.09269 ],
  E              [ 0.072992,  0.16214 ],
  E              [ 0.072992,  0.16214 ],...
  E        y: array([[ 0.09269 , -0.140034],
  E              [ 0.16214 ,  0.072992],
  E              [ 0.16214 ,  0.072992],...
```

Labels: Needs Triage
⚠️ CI failed on Wheel builder ⚠️

**CI is still failing on [Wheel builder](https://github.com/scikit-learn/scikit-learn/actions/runs/2801198918)** (Aug 05, 2022)

COMMENT:
## CI is no longer failing! ✅

[Successful run](https://github.com/scikit-learn/scikit-learn/actions/runs/2807530133) on Aug 06, 2022

Labels: Needs Triage
Pb in example for spectral coclustering

I think there is a missing final transposition missing in the example demo for spectral coclustering here : 
https://scikit-learn.org/stable/auto_examples/bicluster/plot_spectral_coclustering.html

It should be : 

```
fit_data = data[np.argsort(model.row_labels_)]

fit_data = fit_data[:, np.argsort(model.column_labels_)].transpose()
```

COMMENT:
I think the current representation correct as is. The cluster labels found by `SpectralCoclustering` does not necessary match the order of the original clusters.

One way to see that the transpose is not needed is to break the symmetry when generating the biclusters:

```python
data, rows, columns = make_biclusters(
    shape=(300, 500), n_clusters=5, noise=5, shuffle=False, random_state=0
)
```

In this case, the first figure that shows the data has width 500 and the last figure with the clusters found by coclustering also has width 500:

![Screen Shot 2022-08-03 at 5 36 02 PM](https://user-images.githubusercontent.com/5402633/182717062-e970c335-ec4c-4734-a57b-c62d541c1d4f.jpg)

Labels: Needs Triage
Pb in example for spectral coclustering

I think there is a missing final transposition missing in the example demo for spectral coclustering here : 
https://scikit-learn.org/stable/auto_examples/bicluster/plot_spectral_coclustering.html

It should be : 

```
fit_data = data[np.argsort(model.row_labels_)]

fit_data = fit_data[:, np.argsort(model.column_labels_)].transpose()
```

COMMENT:
Sorry, but with a score of 1.00, the final figure of the example should be exactly the same as before the shuffling. And that is what would happen *with* the transpose. I don't get your example. I'm talking about that specific example I'm mentioning in the the link.

Labels: Needs Triage
Pb in example for spectral coclustering

I think there is a missing final transposition missing in the example demo for spectral coclustering here : 
https://scikit-learn.org/stable/auto_examples/bicluster/plot_spectral_coclustering.html

It should be : 

```
fit_data = data[np.argsort(model.row_labels_)]

fit_data = fit_data[:, np.argsort(model.column_labels_)].transpose()
```

COMMENT:
If I adjust the example with 500 columns and use the suggested transpose:

```python
import numpy as np
from matplotlib import pyplot as plt

from sklearn.datasets import make_biclusters
from sklearn.cluster import SpectralCoclustering
from sklearn.metrics import consensus_score

# 500 columns
data, rows, columns = make_biclusters(
    shape=(300, 500), n_clusters=5, noise=5, shuffle=False, random_state=0
)

plt.matshow(data, cmap=plt.cm.Blues)
plt.title("Original dataset")

# shuffle clusters
rng = np.random.RandomState(0)
row_idx = rng.permutation(data.shape[0])
col_idx = rng.permutation(data.shape[1])
data = data[row_idx][:, col_idx]

plt.matshow(data, cmap=plt.cm.Blues)
plt.title("Shuffled dataset")

model = SpectralCoclustering(n_clusters=5, random_state=0)
model.fit(data)
score = consensus_score(model.biclusters_, (rows[:, row_idx], columns[:, col_idx]))

print("consensus score: {:.3f}".format(score))

# Added suggested transpose here
fit_data = data[np.argsort(model.row_labels_)]
fit_data = fit_data[:, np.argsort(model.column_labels_)].transpose()

plt.matshow(fit_data, cmap=plt.cm.Blues)
plt.title("After biclustering; rearranged to show biclusters")

plt.show()
```

I get Figure 1:

![Figure_1](https://user-images.githubusercontent.com/5402633/182719672-e7c7972c-16aa-4d2e-86cb-70efd17ba994.png)

I get Figure 3:

![Figure_3](https://user-images.githubusercontent.com/5402633/182719643-d0ebaa8e-2905-47f3-ad8a-e4719f09ebe1.png)

Flipping the axis on the last figure does not match the first one purely based on shape.

Labels: Needs Triage
Pb in example for spectral coclustering

I think there is a missing final transposition missing in the example demo for spectral coclustering here : 
https://scikit-learn.org/stable/auto_examples/bicluster/plot_spectral_coclustering.html

It should be : 

```
fit_data = data[np.argsort(model.row_labels_)]

fit_data = fit_data[:, np.argsort(model.column_labels_)].transpose()
```

COMMENT:
With the code from the [linked example](https://scikit-learn.org/stable/auto_examples/bicluster/plot_spectral_coclustering.html), here is what I think the mapping is between Figure 1 and Figure 3:

![Screen Shot 2022-08-03 at 6 07 21 PM](https://user-images.githubusercontent.com/5402633/182721350-642333f7-2739-421d-9481-567c4d0fa204.jpg)

Note that the `consensus_score` is computed against the shuffled data and the biclusters, which was also trained on the shuffled data:

```python
# The `rows[:, row_idx]` shuffles the rows to be consistent with the training data.
# Same goes for `columns[:, col_idx]`
score = consensus_score(model.biclusters_, (rows[:, row_idx], columns[:, col_idx]))
```

I do not see now `SpectralCoclustering` can learn about the order of the labels from the original unshuffled dataset.

Labels: Needs Triage
Pb in example for spectral coclustering

I think there is a missing final transposition missing in the example demo for spectral coclustering here : 
https://scikit-learn.org/stable/auto_examples/bicluster/plot_spectral_coclustering.html

It should be : 

```
fit_data = data[np.argsort(model.row_labels_)]

fit_data = fit_data[:, np.argsort(model.column_labels_)].transpose()
```

COMMENT:
Hey thanks for the very clean explanation, I get it now. 
Maybe we could use a word about that shuffled order in the labels in the text of the example.

Labels: Needs Triage
Add other connectivity definitions to grid_to_graph function

### Describe the workflow you want to enable

The current grid_to_graph function only defines voxel neighbors with the 6-connectivity definition. I would like to add 18 and 26 connectivity. (https://en.wikipedia.org/wiki/Pixel_connectivity#26-connected)

### Describe your proposed solution

I already made a [PR](https://github.com/scikit-learn/scikit-learn/pull/16405#event-7047878910) that addresses this change, but it was closed and i was encouraged to make an issue first.

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

_No response_

### Additional context

_No response_

COMMENT:
Thank you for opening this issue. The `feature_extraction.image` module is one of the least maintained modules in scikit-learn. The module was added ~11 years ago and mostly remain unchanged.

For me, I prefer not to add more features to the `feature_extraction.image` module. That being said, I am open to seeing what other maintainers think.

Labels: New Feature, module:feature_extraction, Needs Decision - Include Feature