type: question
aws:ssm
aws:secretsmanager

bug: Can't get SSM secret parameter using localstack.

### Is there an existing issue for this?

- [X] I have searched the existing issues

### Current Behavior

This bug has been reported before here. https://github.com/localstack/localstack/issues/3128
Currently, I'm encountering the same issues.
The issue is that creating an SSM secret using the awslocal cli and trying to retrieve the secret using awslocal gives me a (ParameterNotFound) error.

### Expected Behavior

The expected behaviour is that I should successfully retrieve a stored secret instead of getting a (ParameterNotFound) error.

### How are you starting LocalStack?

Custom (please describe below)

### Steps To Reproduce

#### How are you starting localstack (e.g., `bin/localstack` command, arguments, or `docker-compose.yml`)

Starting local stack from the local stack cli by running `localstack start`

#### Client commands (e.g., AWS SDK code snippet, or sequence of "awslocal" commands)
Create secret
`awslocal secretsmanager create-secret --name TestSecret --secret-string "TT"`

Try to get secret
`awslocal ssm get-parameter --name TestSecret`

### Environment

```markdown
- OS:Windows 10 pro 20H2
- Python version - 3.10
- LocalStack version: 1.0.3.dev
- LocalStack: latest
```

### Anything else?

docker logs
```
2022-07-29T13:36:46.005  INFO --- [   asgi_gw_0] localstack.request.aws     : AWS secretsmanager.CreateSecret => 200

2022-07-29T13:37:28.515  INFO --- [   asgi_gw_1] localstack.request.aws     : AWS ssm.GetParameter => 400 (ParameterNotFound)

```


Underscore converted to hyphen while put it as metadata using amazon-sdk

Hi,
When try to put object with metadata that include underscore(the metadata include underscore) we got the underscore converted to  hyphen.
The same code in Amazon will return the metadata  with underscore - not converted.

for example:
we put map of string as metadata - the "__key1" will convert to "--key1"

```
public class MyAwsS3Tester {

    public static final String IP = "10.0.0.24";
    public static final String BUCKET_NAME = "zanavi-test";

    public static void main(String[] args) {
        AmazonS3 s3 = AmazonS3ClientBuilder.standard()
                .withEndpointConfiguration(new AwsClientBuilder.EndpointConfiguration("http://" + IP + ":4572/", "us-east-1"))
                .disableChunkedEncoding()
                .withCredentials(new AWSStaticCredentialsProvider(new BasicAWSCredentials("zanavi", "1234")))
                .build();
        if (s3.doesBucketExistV2(BUCKET_NAME)) {
            System.out.println("bucket zanavi exists");
        }
        else {
            System.out.println("bucket " + BUCKET_NAME + " doesn't exists");
            s3.createBucket(BUCKET_NAME);
        }

        String dummyStr = "dummy-str";

        Map<String, String> myMap = new HashMap<String, String>();
        myMap.put("__key1", "val1");

        ObjectMetadata objectMetadata = new ObjectMetadata();
        objectMetadata.setUserMetadata(myMap);

        InputStream is = new ByteArrayInputStream(dummyStr.getBytes(StandardCharsets.UTF_8));
        s3.putObject(new PutObjectRequest(BUCKET_NAME, "my-key1", is, objectMetadata));

        S3Object getObj = s3.getObject(new GetObjectRequest(BUCKET_NAME, "my-key1"));
        ObjectMetadata objectMetadataResponse = getObj.getObjectMetadata();

        Map<String, String> myMap1 = objectMetadataResponse.getUserMetadata();

        System.out.println("done " + myMap1);
    }
```

{'base_commit': '177fc797678664a0c06b8c6c434330cef44541a1', 'files': [{'path': 'bin/Dockerfile.base', 'status': 'modified', 'Loc': {'(None, None, None)': {'mod': [30, 32]}}}, {'path': 'localstack/ext/java/src/test/java/cloud/localstack/S3HttpsConnectionTest.java', 'status': 'removed', 'Loc': {}}, {'path': 'localstack/ext/java/src/test/java/cloud/localstack/S3LifecycleTest.java', 'status': 'removed', 'Loc': {}}, {'path': 'localstack/services/generic_proxy.py', 'status': 'modified', 'Loc': {"('GenericProxyHandler', 'forward', 158)": {'mod': [224, 225]}}}, {'path': 'tests/integration/test_dynamodb.py', 'status': 'modified', 'Loc': {'(None, None, None)': {'add': [8]}, "('DynamoDBIntegrationTest', 'test_non_ascii_chars', 14)": {'add': [34]}}}]}


type: bug
status: triage needed
aws:firehose
aws:opensearch

bug: `AmazonopensearchserviceDestinationConfiguration` is not supported for Firehose-Streams

### Is there an existing issue for this?

- [X] I have searched the existing issues

### Current Behavior

As mentioned [here](https://github.com/localstack/localstack/issues/4834#issuecomment-1021009701) it seems like the `AmazonopensearchserviceDestinationConfiguration` was not added while implementing OpenSearch. I guess it just needs be added [here](https://github.com/localstack/localstack/blob/53b5c7788bf35b1882b6cb1949e17d27e198cf61/localstack/services/cloudformation/models/kinesisfirehose.py#L23-L27).

### Expected Behavior

I can (and should) use `AmazonopensearchserviceDestinationConfiguration` instead of `ElasticsearchDestinationConfiguration` (which I should only be able to use if I use ElasticSearch-Service).

### How are you starting LocalStack?

With a docker-compose file

### Steps To Reproduce

Well, just use `AmazonopensearchserviceDestinationConfiguration` and your stream will never be able to deliver the records to your (external) Cluster. But it works with `ElasticsearchDestinationConfiguration`.

### Environment

```markdown
- OS: Windows mit WSL (Ubuntu 20.04)
- LocalStack: latest
```

### Anything else?

_No response_


Use lambci/docker-lambda for local lambda execution?

Feel free to close this but might be worth considering using https://github.com/lambci/docker-lambda to execute lambdas. Seems they dumped the filesystem of a live lambda and made a container out of it. Neat.


Displaying the version details in the logs

<!-- Love localstack? Please consider supporting our collective:
👉  https://opencollective.com/localstack/donate -->

# Type of request: This is a ...

[ ] bug report
[X ] feature request

# Detailed description
Am running the localstack using docker-compose up and the logs are being printed at console

Its good to have the below features in the logs while start-up (which is useful for debugging purpose).

1. Display the localstack version number
2. Display the docker container id.

...

## Expected behavior

...

## Actual behavior

...

# Steps to reproduce

## Command used to start LocalStack

...

## Client code (AWS SDK code snippet, or sequence of "awslocal" commands)

...

{'base_commit': '651f87eb51c36f7e58b421acf8e9966a8932feb1', 'files': [{'path': 'bin/localstack', 'status': 'modified', 'Loc': {'(None, None, None)': {'add': [23, 36, 39]}}}, {'path': 'localstack/utils/cli.py', 'status': 'modified', 'Loc': {"(None, 'cmd_infra', 9)": {'add': [20]}, "(None, 'cmd_web', 37)": {'add': [47]}, '(None, None, None)': {'mod': [2]}}}]}


Lambda executor "docker-reuse" errors with "tcp :9001: bind: address already in use"

Hi I'm using localstack 0.8.5 and was using lambda executor in "docker-reuse" mode. This was working all along but suddenly started to give these port bind errors during execution.  There don't seems to be any processes using this port however.  If i use "docker" as the lambda executor this issue goes away, but i end up with another problem a huge number of containers one for each execution of the lambda. My integration tests essentially send events to a kinesis stream and the lambda reads from this stream so for each execution i get a new container. This is not ideal as it hogs up all the memory on the machine and the tests end up timing out.

Has anyone come across this issue recently or know what changed. I don't see any changes to the 0.8.5 docker image.

localstack_1             | 2019-11-20T05:25:59:WARNING:localstack.services.awslambda.lambda_api: Error executing Lambda function: Lambda process returned error status code: 1. Output:
localstack_1             | 2019/11/20 05:25:59 listen tcp :9001: bind: address already in use
localstack_1             |  Traceback (most recent call last):
localstack_1             |   File "/opt/code/localstack/localstack/services/awslambda/lambda_api.py", line 250, in run_lambda
localstack_1             |     event, context=context, version=version, async=async)
localstack_1             |   File "/opt/code/localstack/localstack/services/awslambda/lambda_executors.py", line 129, in execute
localstack_1             |     result, log_output = self.run_lambda_executor(cmd, environment, async)
localstack_1             |   File "/opt/code/localstack/localstack/services/awslambda/lambda_executors.py", line 66, in run_lambda_executor
localstack_1             |     (return_code, log_output))
localstack_1             | Exception: Lambda process returned error status code: 1. Output:
localstack_1             | 2019/11/20 05:25:59 listen tcp :9001: bind: address already in use
localstack_1             |

These errors happen sporadically, but the result of these errors is nondeterministic test failures :(

Docker compose service:

 localstack:
    image: localstack/localstack:0.8.5
    ports:
      - "4567-4583:4567-4583"
    expose:
      - "4567-4583"
    environment:
      - SERVICES=sqs,kinesis,lambda,dynamodb
      - DEFAULT_REGION=us-east-1
      - LAMBDA_EXECUTOR=docker-reuse
      - DOCKER_HOST=unix:///var/run/docker.sock
    volumes:
      - "/private${TMPDIR}/localstack:/tmp/localstack"
      - "/var/run/docker.sock:/var/run/docker.sock"

{'base_commit': '2d3a44fdb977213589ba202a5e495710097ce88b', 'files': [{'path': 'localstack/services/awslambda/lambda_executors.py', 'status': 'modified', 'Loc': {'(None, None, None)': {'add': [45]}, "('LambdaExecutorSeparateContainers', None, 571)": {'add': [572]}, "('LambdaExecutorSeparateContainers', 'prepare_execution', 579)": {'add': [589], 'mod': [586, 587, 597, 598, 599, 602]}}}]}


s3.upload returns `Location: http://localhost:4566`

# Bug report

# Detailed description

The `AWS.s3.upload()` (official SDK - https://github.com/aws/aws-sdk-js) returns an object with the `Location` key that points to 4566 instead of 4572 (LocalStack S3 port).

## Expected behavior

The `Location` should point to the file on S3.

Example:

```
Location: http://localhost:4572/path/to/bucket.txt
```

## Actual behavior

The `Location` points to the LocalStack entrypoint.

Example:

```
Location: http://localhost:4566/path/to/bucket.txt
```

# Steps to reproduce

- Upload a file to S3 using the official AWS SDK (https://github.com/aws/aws-sdk-js).
- Check out the `Location` property.

## Client code

```javascript
const AWS = require('aws-sdk');
const s3 = new AWS.S3({
  region: 'us-west-1',
  endpoint: 'http://localhost:4566',
  apiVersion: '2006-03-01',
  s3ForcePathStyle: true,
});

(async () => {
  await s3
    .createBucket({ Bucket: 'my-bucket', ACL: 'private' })
    .promise();

  const { Location } = await s3
    .upload({ Key: 'file.txt', Body: 'test', Bucket: 'my-bucket' })
    .promise();

  console.assert(Location === 'http://localhost:4572/my-bucket/file.txt');
})();
```

{'base_commit': '8433682f8ad29dc23a5e909cb229d0cb033beeaa', 'files': [{'path': 'localstack/services/edge.py', 'status': 'modified', 'Loc': {"('ProxyListenerEdge', 'forward_request', 22)": {'add': [40]}}}, {'path': 'tests/integration/test_lambda.py', 'status': 'modified', 'Loc': {}}, {'path': 'tests/unit/test_sns.py', 'status': 'modified', 'Loc': {"('SNSTests', 'test_unsubscribe_should_remove_listener', 25)": {'mod': [26, 27, 34]}, "('SNSTests', 'test_only_one_subscription_per_topic_per_endpoint', 207)": {'mod': [208, 209, 217]}}}]}


Date format string error on Windows when using --os flag

### Describe the bug

I encountered an error when running `interpreter --os` on Windows. The error occurs due to an incompatible date format string.

## Environment
- OS: Windows
- Python version: 3.11
- open-interpreter version: 0.4.1

## Error Message
ValueError: Invalid format string

## Error Location
The error occurs in `interpreter\computer_use\loop.py`, where the date format string uses `%-d` which is not supported on Windows.

## Current code:
```python
datetime.today().strftime('%A, %B %-d, %Y')

## Solution
Changing %-d to %d fixes the issue. This suggests that the code should handle platform-specific date formatting.

## Suggestion
Consider using one of these approaches to fix this cross-platform issue:

Use %d instead of %-d
Add platform-specific handling for date formatting
Use a cross-platform date formatting library

This would improve the Windows user experience with open-interpreter.

### Reproduce

1. Run `pip install open-interpreter`
2. Run `interpreter --os`
3. The error occurs due to incompatible date format string
4. Error message shows: ValueError: Invalid format string

### Expected behavior

The program should start normally without any date format errors when using the --os flag on Windows.

### Screenshots

![image](https://github.com/user-attachments/assets/4ffc3a11-78e4-48d5-b44b-9b384a54bd36)

### Open Interpreter version

0.4.1

### Python version

3.11

### Operating System name and version

Windows 11

### Additional context

_No response_

{'base_commit': 'eded6a2ab6f46cd19caa1559ae23b528a70d1707', 'files': [{'path': 'interpreter/computer_use/loop.py', 'status': 'modified', 'Loc': {'(None, None, None)': {'mod': [104]}}}]}


The code it generated repeated the same function call 20-30 times and used up $5 in a matter of minutes

### Describe the bug

same line was written multiple times, I was pressing y and enter and didnt realise i executed a code with 20-30 calls to a gpt-4 summary of long text and it ate $5.

### Reproduce

I am not sure, but i did paste a code snippet along with instruction to guide it because it was making same mistake multiple times.

### Expected behavior

i wanted to recreate this https://platform.openai.com/docs/tutorials/meeting-minutes/creating-an-automated-meeting-minutes-generator-with-whisper-and-gpt-4

### Screenshots

_No response_

### Open Interpreter version

0.1.3

### Python version

3.11.4

### Operating System name and version

mac 12.5

### Additional context

_No response_


Add a Dockerfile

so it's easier for people to get this up and running and then, running a bunch of different commands.

{'base_commit': '82c448803f28aa3f5035e5302d78891dfcc661c0', 'files': [{'path': '.gitignore', 'status': 'modified', 'Loc': {'(None, None, None)': {'add': [4]}}}, {'path': 'README.md', 'status': 'modified', 'Loc': {'(None, None, None)': {'add': [45], 'mod': [18, 31]}}}, {'path': 'frontend/src/generateCode.ts', 'status': 'modified', 'Loc': {'(None, None, None)': {'mod': [4]}}}]}


Containers should allow module assignments

Right now, after you created a Container, you can assign modules at a later time to it like this:

``` python
container.add_module('linear', nn.Linear())
```

Instead, also allow this simpler interface:

``` python
container.linear = nn.Linear()
```


high priority
module: cuda
triaged
enhancement

[feature request] Set limit on GPU memory use

## 🚀 Feature
<!-- A clear and concise description of the feature proposal -->
Allow user to easily specify a fraction of the GPU memory to use.

## Motivation
<!-- Please outline the motivation for the proposal. Is your feature request related to a problem? e.g., I'm always frustrated when [...]. If this is related to another GitHub issue, please link here too -->
I recently switched from tensorflow to pytorch for what I saw as greater flexibility and user control. However, I have been recently frustrated by the inability to specify a cap on the fraction of GPU memory my pytorch process should be using. I have what I think is a fairly standard use case in performing hyper-parameter search by running multiple independent training processes in parallel (there is a whole ecosystem of packages for this). A modern GPU is large enough to train 4-8+ models of my size, but very rarely a configuration is selected which uses almost my full GPU memory. Instead of that memory-hungry process failing with an OOM by using more than its share (the sensible behavior), instead all the other training processes die, and as my script automatically generates more to take their place, they fail too, leading to a catastrophic global failure.

There are additional use cases like shared servers, training models with small batch sizes for statistical efficiency, and using very large GPUs effectively (like modern Voltas).

In tensorflow, this can be done simply by passing a `ConfigProto` with `gpu_memory_fraction=x`.

There seems to be a pain point for others as well (see Additional context). I know that for me, finding a way to do this will probably make the difference on switching back to TF.

## Pitch

<!-- A clear and concise description of what you want to happen. -->
It would be awesome if an option like gpu_memory_fraction could be set somewhere in the pytorch flow. My current recommendation would be to allow an optional arg or kwarg to torch.device, like the index argument, which would specify the fraction of GPU memory to use. If more than `gpu_mem_fraction * total_gpu_mem` is attempted to be allocated, raise OOM.

## Alternatives

<!-- A clear and concise description of any alternative solutions or features you've considered, if any. -->
It seems like you might be able to do some kind of hacky work around using https://pytorch.org/docs/stable/cuda.html#torch.cuda.max_memory_allocated and monitoring of each process being trained.

## Additional context

<!-- Add any other context or screenshots about the feature request here. -->
https://discuss.pytorch.org/t/how-to-set-a-limit-to-gpu-usage/7271
https://stackoverflow.com/questions/49529372/force-gpu-memory-limit-in-pytorch
https://discuss.pytorch.org/t/limiting-gpu-usage/7662

cc @ezyang @gchanan @zou3519 @bdhirsh @jbschlosser @ngimel


Some cublas functions don't handle inputs with zero strides

## 🐛 Bug

<!-- A clear and concise description of what the bug is. -->

## To Reproduce

Steps to reproduce the behavior:

```python
import torch
import torch.nn as nn

torch.set_default_tensor_type('torch.cuda.FloatTensor')
x = nn.Parameter(torch.ones(2, 2))
(x @ torch.ones(2)).sum().backward()
---------------------------------------------------------------------------
RuntimeError                              Traceback (most recent call last)
<ipython-input-11-c3b66f275e9a> in <module>()
      1 x = nn.Parameter(torch.ones(2, 2))
----> 2 (x @ torch.ones(2)).sum().backward()

1 frames
/usr/local/lib/python3.6/dist-packages/torch/autograd/__init__.py in backward(tensors, grad_tensors, retain_graph, create_graph, grad_variables)
     97     Variable._execution_engine.run_backward(
     98         tensors, grad_tensors, retain_graph, create_graph,
---> 99         allow_unreachable=True)  # allow_unreachable flag
    100
    101

RuntimeError: cublas runtime error : an invalid numeric value was used as an argument at /pytorch/aten/src/THC/THCBlas.cu:120
```
## Expected behavior

No exception is raised.

## Environment
```
Collecting environment information...
PyTorch version: 1.3.1+cu100
Is debug build: No
CUDA used to build PyTorch: 10.0.130

OS: Ubuntu 18.04.3 LTS
GCC version: (Ubuntu 7.4.0-1ubuntu1~18.04.1) 7.4.0
CMake version: version 3.12.0

Python version: 3.6
Is CUDA available: Yes
CUDA runtime version: 10.0.130
GPU models and configuration: GPU 0: Tesla T4
Nvidia driver version: 418.67
cuDNN version: /usr/lib/x86_64-linux-gnu/libcudnn.so.7.6.3

Versions of relevant libraries:
[pip3] numpy==1.17.4
[pip3] torch==1.3.1+cu100
[pip3] torchsummary==1.5.1
[pip3] torchtext==0.3.1
[pip3] torchvision==0.4.2+cu100
[conda] Could not collect
```

This code was run on Google Colab. The bug also reproduces on my server (Ubuntu 16.04LTS, 4x GTX1080Ti GPUs).

## Additional context

The bug doesn't occur if:
1. If I replace `sum()` with `mean()`
```python
(x @ torch.ones(2)).mean().backward()
```

2. If I use a different shape of the tensor
```python
(x @ torch.ones(2, 1)).sum().backward()
```

3. If I run the code on CPU

Therefore, I believe that this is not intended behavior.

cc @ezyang @gchanan @zou3519 @jerryzh168 @SsnL @albanD @gqchen

{'base_commit': '52e9953faffe45d48660fc666db3b520b918c37c', 'files': [{'path': 'aten/src/ATen/native/cuda/Blas.cu', 'status': 'modified', 'Loc': {'(None, None, 10)': {'add': [10]}, '(None, None, 16)': {'mod': [16]}, '(None, None, 22)': {'mod': [22]}, '(None, None, 28)': {'mod': [28]}}}, {'path': 'test/test_autograd.py', 'status': 'modified', 'Loc': {'(None, None, None)': {'add': [6154]}}}, {'path': 'test/test_torch.py', 'status': 'modified', 'Loc': {'(None, None, None)': {'add': [16620]}, "('TestTorchDeviceType', None, 5321)": {'mod': [13015]}}}]}


No module named 'info'

ModuleNotFoundError: No module named 'info'
Traceback:
File "/Users/apple/.pyenv/versions/3.10.11/lib/python3.10/site-packages/streamlit/runtime/scriptrunner/script_runner.py", line 565, in _run_script
    exec(code, module.__dict__)
File "/Users/apple/Documents/AI/gpt4free/gui/streamlit_app.py", line 7, in <module>
    from gpt4free import you
File "/Users/apple/Documents/AI/gpt4free/gui/../gpt4free/__init__.py", line 8, in <module>
    from gpt4free import aicolors
File "/Users/apple/Documents/AI/gpt4free/gui/../gpt4free/aicolors/__init__.py", line 4, in <module>
    from typings import AiColorsResponse
File "/Users/apple/.pyenv/versions/3.10.11/lib/python3.10/site-packages/typings/__init__.py", line 1, in <module>
    from .database import *
File "/Users/apple/.pyenv/versions/3.10.11/lib/python3.10/site-packages/typings/database.py", line 2, in <module>
    from info import DATABASE_NAME, DATABASE_URI, IMDB, IMDB_TEMPLATE, MELCOW_NEW_USERS, P_TTI_SHOW_OFF, SINGLE_BUTTON, SPELL_CHECK_REPLY, PROTECT_CONTENT

{'base_commit': 'ebc10fa465adc32b165afa5f968e4fb6bf26a8ea', 'files': [{'path': 'gpt4free/aicolors/__init__.py', 'status': 'modified', 'Loc': {'(None, None, None)': {'mod': [4]}}}]}


TypeError: unhashable type: 'Model'

import g4f, asyncio

async def run_async():
  _providers = [
      g4f.Provider.ChatgptAi,
      g4f.Provider.ChatgptLogin,
      g4f.Provider.DeepAi,
      g4f.Provider.Opchatgpts,
      g4f.Provider.Vercel,
      g4f.Provider.Wewordle,
      g4f.Provider.You,
      g4f.Provider.Yqcloud,
  ]
  responses = [
      provider.create_async(
          model=g4f.models.default,
          messages=[{"role": "user", "content": "Hello"}],
      )
      for provider in _providers
  ]
  responses = await asyncio.gather(*responses)
  for idx, provider in enumerate(_providers):
      print(f"{provider.__name__}:", responses[idx])

asyncio.run(run_async())

TypeError: unhashable type: 'Model'

Version 0.0.3.0


CORS not enabled for API

**Bug description**

Run docker image
Try to access the Completion API via Javascript console in Browser

`fetch("http://localhost:1337/v1/chat/completions", {
  "headers": {
    "accept-language": "de-DE,de;q=0.9,en-DE;q=0.8,en;q=0.7,en-US;q=0.6",
    "cache-control": "no-cache",
    "content-type": "application/json",
    "pragma": "no-cache",
    "sec-ch-ua": "\"Google Chrome\";v=\"125\", \"Chromium\";v=\"125\", \"Not.A/Brand\";v=\"24\"",
    "sec-ch-ua-mobile": "?0",
    "sec-ch-ua-platform": "\"Windows\"",
    "sec-fetch-dest": "empty",
    "sec-fetch-mode": "cors",
    "sec-fetch-site": "same-origin",
  },
    "referrerPolicy": "no-referrer",
"body": JSON.stringify({model: "gpt-3.5-turbo",
    messages: [{"role": "user", "content": "Hello"}]}),
	"method": "POST",
  "mode": "cors"
})`

`Promise {<pending>}
Access to fetch at 'http://localhost:1337/v1/chat/completions' from origin 'null' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.`

It is no option to set   "mode": "no-cors" because for some reason Chrome reset the request  "content-type": "application/json", to  "content-type": "text/plain"

**Screenshots**

![image](https://github.com/xtekky/gpt4free/assets/8710166/60040772-b3e7-4880-a70a-84248aae12e2)

**Environment**
Docker

**Additional context**
Solution might be to just add a CORSMiddleware to the FastAPI
https://fastapi.tiangolo.com/tutorial/cors/

If i have some time, i might create a PR


How to use providers via HTTP Request ?

I am trying to use the api version of this project, but, the providers option in my request is not working, am i doing something wrong?

```js
const response = await axios.post(
      `${API_BASE}`,
      {
        provider: 'g4f.Provider.ChatgptAi',
        temperature:0.75,
        top_p: 0.6,
        model: 'gpt-3.5-long',
        messages: [
          {role: 'user', content: msg }
        ],
      },
      {
        headers: {
          'Content-Type': 'application/json',
        }
      }
    );
    return response.data.choices[0].message.content
```

this is the code, i already tried with `provider: 'ChatgptAi'` and others providers, but the api always ignore the option providers.


Model "command-r+" returning 401 error: "You have to be logged in"

**Bug description**

I'm experiencing an issue with the model "command-r+" not working. When attempting to use this model through the g4f API (running "g4f api"), I receive the following error:

```
ERROR:root:Request failed with status code: 401, response: {"error":"You have to be logged in."}
Traceback (most recent call last):
  File "/usr/lib/python3.11/site-packages/g4f/api/__init__.py", line 177, in chat_completions
    response = self.client.chat.completions.create(
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/g4f/client/client.py", line 241, in create
    return next(response)
           ^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/g4f/client/client.py", line 119, in iter_append_model_and_provider
    for chunk in response:
  File "/usr/lib/python3.11/site-packages/g4f/client/client.py", line 79, in iter_response
    for chunk in response:
  File "/usr/lib/python3.11/site-packages/g4f/Provider/HuggingChat.py", line 83, in create_completion
    raise RuntimeError(f"Request failed with status code: {response.status_code}, response: {response.text}")
RuntimeError: Request failed with status code: 401, response: {"error":"You have to be logged in."}
```

The model "command-r+" was working perfectly until yesterday. I am using g4f with Docker.

**Steps to Reproduce**

1. Run "g4f api" with the "command-r+" model.
2. Observe the error message in the terminal output.

**Environment**
- Python version: 3.11
- Location: Not in a Cloudflare-flagged country
- g4f version: [g4f v-0.3.3.3]

**Additional context**
No recent changes were made on my side. The model was working without issues until yesterday.


OpenaiChat:\lib\asyncio\base_events.py", line 498, in _make_subprocess_transport     raise NotImplementedError

![image](https://github.com/xtekky/gpt4free/assets/37258899/c14b81f6-a429-4cb9-9029-4fab53d0e812)
this problem happens today after I update to the latest version!


target not found yay and python-pip.19.1.1-1

i have a problem when i try to run bash install.sh it says error target not found yay, python-pip.19.1.1-1 , i have installed the yay and i have no idea how to install python-pip so i need help.

OS: Arch linux 64x_86X
shell: bash 5.1.6
![image](https://user-images.githubusercontent.com/127435098/224668316-8f1bfd93-6f01-4264-b70d-19ebef17382f.png)


Typos found by codespell

./tools/xss_attack.py:107: vulnerabilites ==> vulnerabilities
./tools/information_gathering_tools.py:87: Scaning ==> Scanning
./tools/information_gathering_tools.py:117: informations ==> information
./tools/information_gathering_tools.py:168: informations ==> information
./tools/forensic_tools.py:60: Aquire ==> Acquire
./tools/wireless_attack_tools.py:51: bluetooh ==> bluetooth
./tools/webattack.py:89: analizing ==> analyzing
./tools/phising_attack.py:40: enginee ==> engine
./tools/phising_attack.py:95: Engagment ==> Engagement
./tools/payload_creator.py:89: writen ==> written
./tools/others/socialmedia_finder.py:53: Usege ==> Usage

{'base_commit': '1e088ad35b66dda0ee9139a5220627f86cb54365', 'files': [{'path': '.github/workflows/lint_python.yml', 'status': 'modified', 'Loc': {'(None, None, None)': {'mod': [25]}}}, {'path': 'tools/forensic_tools.py', 'status': 'modified', 'Loc': {"('Guymager', None, 59)": {'mod': [60]}}}, {'path': 'tools/information_gathering_tools.py', 'status': 'modified', 'Loc': {"('ReconSpider', None, 86)": {'mod': [87]}, "('Infoga', None, 115)": {'mod': [117]}, "('Shodan', None, 166)": {'mod': [168]}}}, {'path': 'tools/others/socialmedia_finder.py', 'status': 'modified', 'Loc': {"('Sherlock', None, 50)": {'mod': [53]}}}, {'path': 'tools/payload_creator.py', 'status': 'modified', 'Loc': {"('Venom', None, 85)": {'mod': [89]}}}, {'path': 'tools/phising_attack.py', 'status': 'modified', 'Loc': {"('Setoolkit', None, 37)": {'mod': [40]}, "('ISeeYou', None, 92)": {'mod': [95]}}}, {'path': 'tools/webattack.py', 'status': 'modified', 'Loc': {"('Dirb', None, 84)": {'mod': [89]}}}, {'path': 'tools/wireless_attack_tools.py', 'status': 'modified', 'Loc': {"('BluePot', None, 49)": {'mod': [51]}}}, {'path': 'tools/xss_attack.py', 'status': 'modified', 'Loc': {"('XSSStrike', None, 105)": {'mod': [107]}}}]}


SyntaxError: invalid syntax

Traceback (most recent call last):
  File "/home/kali/hackingtool/hackingtool.py", line 11, in <module>
    from tools.ddos import DDOSTools
  File "/home/kali/hackingtool/tools/ddos.py", line 29
    "sudo", "python3 ddos", method, url, socks_type5.4.1, threads, proxylist, multiple, timer])

I'm getting this error someone can help? also in sudo in python3


Arpack wrappers fail with new scipy

I have scipy 0.11.0.dev-c1ea274. This does not seem to play well with the current arpack wrappers.
I'm a bit out of my depth there, though.


CI with boundscheck=False

I really dislike segmentation faults! Unfortunately, there are many issues reporting them.
Findings in #21654, #21283 were easier with setting `boundscheck = True`.

**Proposition**
Set up one CI configuration that runs with `boundscheck = True` globally which should be easier now that #21512 is merged.

{'base_commit': 'c9e5067cb14de578ab48b64f399743b994e3ca94', 'files': [{'path': 'azure-pipelines.yml', 'status': 'modified', 'Loc': {'(None, None, 202)': {'add': [202]}}}, {'path': 'doc/computing/parallelism.rst', 'status': 'modified', 'Loc': {'(None, None, 216)': {'add': [216]}}}, {'path': 'sklearn/_build_utils/__init__.py', 'status': 'modified', 'Loc': {"(None, 'cythonize_extensions', 40)": {'add': [72], 'mod': [81]}}}]}


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_


PERF : StratifiedShuffleSplit is slow when using large number of classes

When using large number of classes (e.g. > 10000, e.g for recommender systems), `StratifiedShuffleSplit` is very slow when compared to `ShuffleSplit`. Looking at the code, I believe that the following part:

``` python
            for i, class_i in enumerate(classes):
                permutation = rng.permutation(class_counts[i])
                perm_indices_class_i = np.where((y == class_i))[0][permutation]
```

`l. 1070` in `sklearn.model_selection._split` is suboptimal : we should build an index matrix holding the indices for each class in the dataset (implying to do a single pass over data, maybe along with a `bincount(classes)`). Indeed np.where does a pass over `y` at each call, leading to a `O(n_classes * len(y))` complexity, whereas it could be `O(len(y))` only.

I obtain a significant gain in perf doing:

``` python

        class_indices = np.zeros((n_classes, class_counts.max()), dtype='int')
        count = np.zeros(n_classes, dtype='int')
        for i in range(len(y_indices)):
            class_indices[y_indices[i], count[y_indices[i]]] = i
            count[y_indices[i]] += 1
```

and subsequently replacing

``` python
perm_indices_class_i = np.where((y == class_i))[0][permutation]
```

 by

``` python
perm_indices_class_i = class_indices[class_i,:class_counts[i]][permutation]
```

This is suboptimal given we iterate over y values using within a Python loop. I believe that the proper way to do this would be to create a `bincount_with_ref` cython function that would both count the occurence of classes and accumulate class index in a  `class_indices` array - in `arrayfuncs.pyx`. Memory usage goes up of `len(y) * sizeof('int')`, which is typically small when compared to `X` size.

Would this be useful ? I'll have to provide benchmarks !

{'base_commit': '41e129f1a6eb17a39ff0b25f682d903d0ae3c5af', 'files': [{'path': 'doc/whats_new.rst', 'status': 'modified', 'Loc': {'(None, None, None)': {'add': [219]}}}, {'path': 'sklearn/model_selection/_split.py', 'status': 'modified', 'Loc': {"('StratifiedShuffleSplit', '_iter_indices', 1495)": {'add': [1523], 'mod': [1536, 1538]}}}]}


Should mixture models have a clusterer-compatible interface

Mixture models are currently a bit different. They are basically clusterers, except they are probabilistic, and are applied to inductive problems unlike many clusterers. But they are unlike clusterers in API:
* they have an `n_components` parameter, with identical purpose to `n_clusters`
* they do not store the `labels_` of the training data
* they do not have a `fit_predict` method

And they are almost entirely documented separately.

Should we make the MMs more like clusterers?

{'base_commit': '4143356c3c51831300789e4fdf795d83716dbab6', 'files': [{'path': 'doc/whats_new/v0.20.rst', 'status': 'modified', 'Loc': {'(None, None, None)': {'add': [583]}}}, {'path': 'sklearn/mixture/base.py', 'status': 'modified', 'Loc': {"('BaseMixture', 'fit', 172)": {'add': [190], 'mod': [175, 243]}}}, {'path': 'sklearn/mixture/tests/test_bayesian_mixture.py', 'status': 'modified', 'Loc': {'(None, None, None)': {'add': [3, 9], 'mod': [17]}, "(None, 'test_invariant_translation', 400)": {'add': [421]}}}, {'path': 'sklearn/mixture/tests/test_gaussian_mixture.py', 'status': 'modified', 'Loc': {'(None, None, None)': {'add': [5, 571]}}}]}


Possible infinite loop iterations in synthetic data sets generation module

Hello,

I found two code snippets in https://github.com/scikit-learn/scikit-learn/blob/7e85a6d1f/sklearn/datasets/_samples_generator.py are susceptible to infinite loop iterations when using make_multilabel_classification():

1) https://github.com/scikit-learn/scikit-learn/blob/7e85a6d1f/sklearn/datasets/_samples_generator.py#L357

2) https://github.com/scikit-learn/scikit-learn/blob/7e85a6d1f/sklearn/datasets/_samples_generator.py#L371

These happen when the parameters of make_multilabel_classification functions are EITHER (allowed_unlabeled = False and n_classes = 0) OR length = 0.

I am using the version 0.20.3 of scikit-learn.

Please let me know if you have any questions about this.
Thank You

{'base_commit': 'd7795a431e30d23f7e8499bdbe89dbdc6e9a068e', 'files': [{'path': 'doc/whats_new/v0.23.rst', 'status': 'modified', 'Loc': {'(None, None, None)': {'add': [65]}}}, {'path': 'sklearn/datasets/_samples_generator.py', 'status': 'modified', 'Loc': {"(None, 'make_multilabel_classification', 263)": {'add': [344]}}}, {'path': 'sklearn/datasets/tests/test_samples_generator.py', 'status': 'modified', 'Loc': {'(None, None, None)': {'add': [224]}}}]}


Speed up tree construction

CC: @pprett @amueller @bdholt1

Hi folks,

Everyone will agree that tree-based methods have shown to perform quite well (e.g., the recent achievement of Peter!) and are increasingly used by our users. However, the tree module still has a major drawback: it is slow as hell in comparison to other machine learning packages.

For that reason, I think we should put some more effort into accelerating the tree module. In particular, I would like to suggest to move the whole `Tree` class (not the estimators,  but only our struct-of-arrays representation) from tree.py into Cython in _tree.pyx. First the code would be a lot faster. But second, it could also actually be more readable and maintainable if the whole tree construction process was packaged into a single file, in a single class. Currently, the construction process is indeed split across 2 files, estimator classes, the Tree class and all the Cython routines. (imo, this is a mess.)

To show that indeed the construction process could be a lot faster, I profiled `recursive_partition` using  line-profiler (see link below). Insignicant Python instructions do actually take quite some time in comparison to the important parts of the algorithm. E.g., line 314 vs line 320. A mere Python if-statement is only twice faster than finding the best threshold!!!

I let you examine  the rest of the profiling report by yourself, but as far as I am concerned, I am convinced that we could indeed significantly speed up the tree module (and be 5-10x faster at least).

http://pastebin.com/0rC1QmPy (toggle text warping)

What's your opinion about this? Since I am increasingly using the module myself, I can actually work on that  in the days to come.


Documentation
good first issue
help wanted

Ensure that we have an example in the docstring of each public function or class

We should make sure that we have a small example for all public functions or classes. Most of the missing examples are linked to functions.

I could list the following classes and functions for which `numpydoc` did not find any example:

- [x] sklearn.base.BaseEstimator
- [x] sklearn.base.BiclusterMixin
- [x] sklearn.base.ClassNamePrefixFeaturesOutMixin
- [x] sklearn.base.ClassifierMixin
- [x] sklearn.base.ClusterMixin
- [x] sklearn.base.DensityMixin
- [x] sklearn.base.MetaEstimatorMixin
- [x] sklearn.base.OneToOneFeatureMixin
- [x] sklearn.base.OutlierMixin
- [x] sklearn.base.RegressorMixin
- [x] sklearn.base.TransformerMixin
- [x] sklearn.base.clone
- [x] sklearn.base.is_classifier
- [x] sklearn.base.is_regressor
- [x] sklearn.cluster.affinity_propagation
- [x] sklearn.cluster.cluster_optics_dbscan
- [x] sklearn.cluster.cluster_optics_xi
- [x] sklearn.cluster.compute_optics_graph
- [x] sklearn.cluster.estimate_bandwidth
- [x] sklearn.cluster.k_means
- [x] sklearn.cluster.mean_shift
- [x] sklearn.cluster.spectral_clustering
- [x] sklearn.cluster.ward_tree
- [x] sklearn.covariance.graphical_lasso
- [x] sklearn.covariance.ledoit_wolf
- [x] sklearn.covariance.ledoit_wolf_shrinkage
- [x] sklearn.covariance.shrunk_covariance
- [x] sklearn.datasets.clear_data_home
- [x] sklearn.datasets.dump_svmlight_file
- [x] sklearn.datasets.fetch_20newsgroups
- [x] sklearn.datasets.fetch_20newsgroups_vectorized
- [x] sklearn.datasets.fetch_california_housing
- [x] sklearn.datasets.fetch_covtype
- [x] sklearn.datasets.fetch_kddcup99
- [x] sklearn.datasets.fetch_lfw_pairs
- [x] sklearn.datasets.fetch_lfw_people
- [x] sklearn.datasets.fetch_olivetti_faces
- [x] sklearn.datasets.fetch_openml
- [x] sklearn.datasets.fetch_rcv1
- [x] sklearn.datasets.fetch_species_distributions
- [x] sklearn.datasets.get_data_home
- [x] sklearn.datasets.load_diabetes
- [x] sklearn.datasets.load_files
- [x] sklearn.datasets.load_linnerud
- [x] sklearn.datasets.load_svmlight_files
- [x] sklearn.datasets.make_biclusters
- [x] sklearn.datasets.make_checkerboard
- [x] sklearn.datasets.make_circles
- [x] sklearn.datasets.make_classification
- [x] sklearn.datasets.make_friedman1
- [x] sklearn.datasets.make_friedman2
- [x] sklearn.datasets.make_friedman3
- [x] sklearn.datasets.make_gaussian_quantiles
- [x] sklearn.datasets.make_hastie_10_2
- [x] sklearn.datasets.make_low_rank_matrix
- [x] sklearn.datasets.make_moons
- [x] sklearn.datasets.make_multilabel_classification
- [x] sklearn.datasets.make_s_curve
- [x] sklearn.datasets.make_sparse_coded_signal
- [x] sklearn.datasets.make_sparse_spd_matrix
- [x] sklearn.datasets.make_sparse_uncorrelated
- [x] sklearn.datasets.make_spd_matrix
- [x] sklearn.datasets.make_swiss_roll
- [x] sklearn.decomposition.dict_learning
- [x] sklearn.decomposition.dict_learning_online
- [x] sklearn.decomposition.sparse_encode
- [x] sklearn.feature_extraction.image.grid_to_graph
- [x] sklearn.feature_extraction.image.img_to_graph
- [x] sklearn.feature_extraction.image.reconstruct_from_patches_2d
- [x] sklearn.feature_selection.SelectorMixin
- [x] sklearn.feature_selection.chi2
- [x] sklearn.feature_selection.f_classif
- [x] sklearn.feature_selection.f_regression
- [x] sklearn.feature_selection.mutual_info_classif
- [x] sklearn.feature_selection.mutual_info_regression
- [x] sklearn.feature_selection.r_regression
- [x] sklearn.gaussian_process.kernels.Kernel
- [x] sklearn.get_config
- [x] sklearn.isotonic.check_increasing
- [x] sklearn.isotonic.isotonic_regression
- [x] sklearn.linear_model.enet_path
- [x] sklearn.linear_model.lars_path
- [x] sklearn.linear_model.lars_path_gram
- [x] sklearn.linear_model.orthogonal_mp
- [x] sklearn.linear_model.orthogonal_mp_gram
- [x] sklearn.linear_model.ridge_regression
- [x] sklearn.manifold.locally_linear_embedding
- [x] sklearn.manifold.smacof
- [x] sklearn.manifold.spectral_embedding
- [x] sklearn.manifold.trustworthiness
- [x] sklearn.metrics.calinski_harabasz_score
- [x] sklearn.metrics.check_scoring
- [x] sklearn.metrics.cohen_kappa_score
- [x] sklearn.metrics.consensus_score
- [x] sklearn.metrics.coverage_error
- [x] sklearn.metrics.davies_bouldin_score
- [x] sklearn.metrics.get_scorer
- [x] sklearn.metrics.get_scorer_names
- [x] sklearn.metrics.homogeneity_completeness_v_measure
- [x] sklearn.metrics.label_ranking_loss
- [x] sklearn.metrics.mutual_info_score
- [x] sklearn.metrics.pairwise.additive_chi2_kernel
- [x] sklearn.metrics.pairwise.chi2_kernel
- [x] sklearn.metrics.pairwise.cosine_distances
- [x] sklearn.metrics.pairwise.cosine_similarity
- [x] sklearn.metrics.pairwise.distance_metrics
- [x] sklearn.metrics.pairwise.kernel_metrics
- [x] sklearn.metrics.pairwise.laplacian_kernel
- [x] sklearn.metrics.pairwise.linear_kernel
- [x] sklearn.metrics.pairwise.paired_cosine_distances
- [x] sklearn.metrics.pairwise.paired_euclidean_distances
- [x] sklearn.metrics.pairwise.pairwise_kernels
- [x] sklearn.metrics.pairwise.polynomial_kernel
- [x] sklearn.metrics.pairwise.rbf_kernel
- [x] sklearn.metrics.pairwise.sigmoid_kernel
- [x] sklearn.metrics.pairwise_distances
- [x] sklearn.metrics.pairwise_distances_argmin
- [x] sklearn.metrics.pairwise_distances_argmin_min
- [x] sklearn.metrics.silhouette_samples
- [x] sklearn.metrics.silhouette_score
- [x] sklearn.model_selection.check_cv
- [x] sklearn.model_selection.permutation_test_score
- [x] sklearn.model_selection.validation_curve
- [x] sklearn.neighbors.sort_graph_by_row_values
- [x] sklearn.preprocessing.binarize
- [x] sklearn.preprocessing.maxabs_scale
- [x] sklearn.preprocessing.minmax_scale
- [x] sklearn.preprocessing.normalize
- [x] sklearn.preprocessing.robust_scale
- [x] sklearn.preprocessing.scale
- [x] sklearn.set_config
- [x] sklearn.show_versions
- [x] sklearn.svm.l1_min_c
- [x] sklearn.utils._safe_indexing
- [x] sklearn.utils.arrayfuncs.min_pos
- [x] sklearn.utils.as_float_array
- [x] sklearn.utils.assert_all_finite
- [x] sklearn.utils.check_X_y
- [x] sklearn.utils.check_array
- [x] sklearn.utils.check_consistent_length
- [x] sklearn.utils.check_random_state
- [x] sklearn.utils.check_scalar
- [x] sklearn.utils.class_weight.compute_class_weight
- [x] sklearn.utils.class_weight.compute_sample_weight
- [x] sklearn.utils.deprecated
- [x] sklearn.utils.discovery.all_displays
- [x] sklearn.utils.discovery.all_estimators
- [x] sklearn.utils.discovery.all_functions
- [x] sklearn.utils.estimator_checks.check_estimator
- [x] sklearn.utils.estimator_html_repr
- [x] sklearn.utils.extmath.density
- [x] sklearn.utils.extmath.randomized_range_finder
- [x] sklearn.utils.extmath.safe_sparse_dot
- [x] sklearn.utils.indexable
- [x] sklearn.utils.metadata_routing.MetadataRequest
- [x] sklearn.utils.metadata_routing.MetadataRouter
- [x] sklearn.utils.metadata_routing.MethodMapping
- [x] sklearn.utils.metadata_routing.get_routing_for_object
- [x] sklearn.utils.metadata_routing.process_routing
- [x] sklearn.utils.murmurhash3_32
- [x] sklearn.utils.parallel.Parallel
- [x] sklearn.utils.parallel.delayed
- [x] sklearn.utils.parallel_backend
- [x] sklearn.utils.random.sample_without_replacement
- [x] sklearn.utils.register_parallel_backend
- [x] sklearn.utils.safe_mask
- [x] sklearn.utils.safe_sqr
- [x] sklearn.utils.sparsefuncs.incr_mean_variance_axis
- [x] sklearn.utils.sparsefuncs.inplace_column_scale
- [x] sklearn.utils.sparsefuncs.inplace_csr_column_scale
- [x] sklearn.utils.sparsefuncs.inplace_row_scale
- [x] sklearn.utils.sparsefuncs.inplace_swap_column
- [x] sklearn.utils.sparsefuncs.inplace_swap_row
- [x] sklearn.utils.sparsefuncs.mean_variance_axis
- [x] sklearn.utils.sparsefuncs_fast.inplace_csr_row_normalize_l1
- [x] sklearn.utils.sparsefuncs_fast.inplace_csr_row_normalize_l2
- [x] sklearn.utils.validation.check_is_fitted
- [x] sklearn.utils.validation.check_memory
- [x] sklearn.utils.validation.check_symmetric
- [x] sklearn.utils.validation.column_or_1d

The code used to find the list above is detailed below:

<details>

```python
import importlib
import inspect
from pathlib import Path

from numpydoc.docscrape import NumpyDocString

path_sklearn_doc = Path(
    "/{path_to_git_repo}/scikit-learn/doc/_build/html/stable/"
    "modules/generated"
)

missing_examples_name = []
for document in path_sklearn_doc.glob("*.html"):
    extracted_doc = []
    full_name = document.stem
    try:
        module_name, class_or_function_name = full_name.rsplit(".", maxsplit=1)
        module = importlib.import_module(module_name)
        class_or_function = getattr(module, class_or_function_name)
    except (ValueError, AttributeError, ImportError):
        # This is due to the experimental module and function with
        # module name
        continue
    is_class = inspect.isclass(class_or_function)
    docstring = NumpyDocString(class_or_function.__doc__)
    if not docstring["Examples"]:
        missing_examples_name.append(full_name)

for full_name in sorted(missing_examples_name):
    print(f"- [ ] {full_name}")
```

</details>

{'base_commit': 'd967cfe8124902181892411b18b50dce9921a32d', 'files': [{'path': 'sklearn/datasets/_samples_generator.py', 'status': 'modified', 'Loc': {"(None, 'make_low_rank_matrix', 1359)": {'add': [1413]}}}]}


sklearn.datasets.load_files select file extension

<!--
If you want to propose a new algorithm, please refer first to the scikit-learn
inclusion criterion:
https://scikit-learn.org/stable/faq.html#what-are-the-inclusion-criteria-for-new-algorithms
-->

#### Describe the workflow you want to enable
When using load_files in a directory where there are different kinds of files (.txt, .png, ...), the user might want to load only certain files (*.txt for example). This feature would put load_files closer to the function `index_directory` from tensorflow.python.keras.preprocessing.dataset_utils.py.

For MacOs users, .DStore files also gets loaded which is an undesired behaviour.

#### Describe your proposed solution
Add an argument to select the types of files to load.

{'base_commit': 'e11c4d21a4579f0d49f414a4b76e386f80f0f074', 'files': [{'path': 'doc/whats_new/v1.1.rst', 'status': 'modified', 'Loc': {'(None, None, None)': {'add': [175]}}}, {'path': 'sklearn/datasets/_base.py', 'status': 'modified', 'Loc': {'(None, None, None)': {'add': [13]}, "(None, 'load_files', 99)": {'add': [108, 145, 186, 214], 'mod': [218]}}}, {'path': 'sklearn/datasets/tests/test_base.py', 'status': 'modified', 'Loc': {'(None, None, None)': {'add': [131]}}}]}


Matplotlib update on CI makes example look different

The examples look different on the current dev website, in particular the classifier comparison that's on the landing pages looks a bit odd now:
http://scikit-learn.org/dev/auto_examples/classification/plot_classifier_comparison.html

I suspect the culprit is the CI upgrading to matplotlib v2. I think we should go through the examples and see how they are holding up with the new styles.


Implement SLEP009: keyword-only arguments

[SLEP009](https://scikit-learn-enhancement-proposals.readthedocs.io/en/latest/slep009/proposal.html) is all but accepted.

It proposes to make most parameters keyword-only.

We should do this by first:
* [x] Merging #13311
* [x] Perhaps getting some stats on usage of positional arguments as per https://github.com/scikit-learn/enhancement_proposals/pull/19#issuecomment-514671933
* [ ] applying the deprecation to each subpackage. Checked means PR opened at least.
  * [x] base
  * [x] calibration
  * [x] cluster
  * [x] compose
  * [x] covariance
  * [x] cross_decomposition
  * [x] datasets
  * [x] decomposition
  * [x] discriminant_analysis
  * [x] dummy
  * [x] ensemble
  * [x] feature_extraction
  * [x] feature_selection
  * [x] gaussian_process
  * [x] impute
  * [x] inspection
  * [x] isotonic
  * [x] kernel_approximation
  * [x] kernel_ridge
  * [x] linear_model
  * [x] manifold
  * [x] metrics
  * [x] metrics.pairwise
  * [x] mixture
  * [x] model_selection
  * [x] multiclass
  * [x] multioutput
  * [x] naive_bayes
  * [x] neighbors
  * [x] neural_network
  * [x] pipeline
  * [x] preprocessing
  * [x] random_projection
  * [x] semi_supervised
  * [x] svm
  * [x] tree
  * [x] utils

We might along the way establish rules of thumb and principles like  "are the semantics reasonably clear when the argument is passed positionally?" As I noted on the mailing list, I think they are clear for PCA's components, for Pipeline's steps, and for GridSearchCV's estimator and parameter grid. Other parameters of those estimators seem more suitable for keyword-only. Trickier is whether n_components in TSNE should follow PCA in being positional... It's not as commonly set by users.

{'base_commit': '839b356f45fac7724eab739dcc129a0c8f650a23', 'files': [{'path': 'sklearn/datasets/_base.py', 'status': 'modified', 'Loc': {'(None, None, None)': {'add': [19]}, "(None, 'load_files', 83)": {'mod': [83]}, "(None, 'load_wine', 270)": {'mod': [270]}, "(None, 'load_iris', 384)": {'mod': [384]}, "(None, 'load_breast_cancer', 498)": {'mod': [498]}, "(None, 'load_digits', 622)": {'mod': [622]}, "(None, 'load_diabetes', 745)": {'mod': [745]}, "(None, 'load_linnerud', 837)": {'mod': [837]}, "(None, 'load_boston', 940)": {'mod': [940]}}}, {'path': 'sklearn/datasets/_california_housing.py', 'status': 'modified', 'Loc': {'(None, None, None)': {'add': [38]}, "(None, 'fetch_california_housing', 51)": {'mod': [51]}}}, {'path': 'sklearn/datasets/_covtype.py', 'status': 'modified', 'Loc': {'(None, None, None)': {'add': [30]}, "(None, 'fetch_covtype', 43)": {'mod': [43]}}}, {'path': 'sklearn/datasets/_kddcup99.py', 'status': 'modified', 'Loc': {'(None, None, None)': {'add': [25]}, "(None, 'fetch_kddcup99', 46)": {'mod': [46]}}}, {'path': 'sklearn/datasets/_lfw.py', 'status': 'modified', 'Loc': {'(None, None, None)': {'add': [22]}, "(None, 'fetch_lfw_people', 218)": {'mod': [218]}, "(None, 'fetch_lfw_pairs', 388)": {'mod': [388]}}}, {'path': 'sklearn/datasets/_olivetti_faces.py', 'status': 'modified', 'Loc': {'(None, None, None)': {'add': [27]}, "(None, 'fetch_olivetti_faces', 38)": {'mod': [38]}}}, {'path': 'sklearn/datasets/_openml.py', 'status': 'modified', 'Loc': {'(None, None, None)': {'add': [25]}, "(None, 'fetch_openml', 611)": {'mod': [611]}}}, {'path': 'sklearn/datasets/_rcv1.py', 'status': 'modified', 'Loc': {'(None, None, None)': {'add': [27]}, "(None, 'fetch_rcv1', 78)": {'mod': [78]}}}, {'path': 'sklearn/datasets/_samples_generator.py', 'status': 'modified', 'Loc': {'(None, None, None)': {'add': [20]}, "(None, 'make_classification', 36)": {'mod': [36]}, "(None, 'make_multilabel_classification', 264)": {'mod': [264]}, "(None, 'make_hastie_10_2', 425)": {'mod': [425]}, "(None, 'make_regression', 473)": {'mod': [473]}, "(None, 'make_circles', 595)": {'mod': [595]}, "(None, 'make_moons', 671)": {'mod': [671]}, "(None, 'make_blobs', 734)": {'mod': [734]}, "(None, 'make_friedman1', 892)": {'mod': [892]}, "(None, 'make_friedman2', 954)": {'mod': [954]}, "(None, 'make_friedman3', 1019)": {'mod': [1019]}, "(None, 'make_low_rank_matrix', 1083)": {'mod': [1083]}, "(None, 'make_sparse_coded_signal', 1152)": {'mod': [1152]}, "(None, 'make_sparse_uncorrelated', 1214)": {'mod': [1214]}, "(None, 'make_spd_matrix', 1265)": {'mod': [1265]}, "(None, 'make_sparse_spd_matrix', 1298)": {'mod': [1298]}, "(None, 'make_swiss_roll', 1372)": {'mod': [1372]}, "(None, 'make_s_curve', 1424)": {'mod': [1424]}, "(None, 'make_gaussian_quantiles', 1466)": {'mod': [1466]}, "(None, 'make_biclusters', 1561)": {'mod': [1561]}, "(None, 'make_checkerboard', 1652)": {'mod': [1652]}}}, {'path': 'sklearn/datasets/_species_distributions.py', 'status': 'modified', 'Loc': {'(None, None, None)': {'add': [52]}, "(None, 'fetch_species_distributions', 140)": {'mod': [140]}}}, {'path': 'sklearn/datasets/_svmlight_format_io.py', 'status': 'modified', 'Loc': {'(None, None, None)': {'add': [27]}, "(None, 'load_svmlight_file', 40)": {'mod': [40, 154, 155]}, "(None, 'load_svmlight_files', 199)": {'mod': [199]}, "(None, 'dump_svmlight_file', 383)": {'mod': [383]}}}, {'path': 'sklearn/datasets/_twenty_newsgroups.py', 'status': 'modified', 'Loc': {'(None, None, None)': {'add': [47]}, "(None, 'fetch_20newsgroups', 149)": {'mod': [149]}, "(None, 'fetch_20newsgroups_vectorized', 325)": {'mod': [325]}}}, {'path': 'sklearn/datasets/tests/test_base.py', 'status': 'modified', 'Loc': {"(None, 'test_load_digits_n_class_lt_10', 154)": {'mod': [155]}}}, {'path': 'sklearn/linear_model/tests/test_omp.py', 'status': 'modified', 'Loc': {'(None, None, None)': {'mod': [21, 22]}}}]}


Remove "from __future__ import XXX"

Given #12746, I think we should remove ``from __future__ import XXX``, right? @adrinjalali
```
$ git grep "from __future__ import" | wc -l
147
```

{'base_commit': '62d205980446a1abc1065f4332fd74eee57fcf73', 'files': [{'path': 'sklearn/utils/_random.pyx', 'status': 'modified', 'Loc': {'(None, None, None)': {'add': [0], 'mod': [16]}}}]}


SimpleImputer to Crash on Constant Imputation with string value when dataset is encoded Numerically

#### Description
The title kind of describes it. It might be pretty logical, but just putting it out here as it took a while for me to realize and debug what exactly happened.

The SimpleImputer has the ability to impute missing values with a constant. If the data is categorical, it is possible to impute with a string value. However, when fetching a dataset from OpenML (or many other datasets from different sources) the data is encoded numerically automatically as numeric. When applying the SimpleImputer and a string value, scikit-learn crashes. I assume there's not a lot that can be done about this, as everything behaves exactly as you would expect when you dive deep into the code, but maybe the documentation can be extended a little bit (probably on SimpleImputer side, or maybe on the side of the data sources).

What do you think?

#### Steps/Code to Reproduce
```
import numpy as np
import sklearn.datasets
import sklearn.compose
import sklearn.tree
import sklearn.impute

X, y = sklearn.datasets.fetch_openml('Australian', 4, return_X_y=True)

numeric_imputer = sklearn.impute.SimpleImputer(strategy='mean')
numeric_scaler = sklearn.preprocessing.StandardScaler()

nominal_imputer = sklearn.impute.SimpleImputer(strategy='constant', fill_value='missing')
nominal_encoder = sklearn.preprocessing.OneHotEncoder(handle_unknown='ignore')

numeric_idx = [1, 2, 7, 10, 13]
nominal_idx = [0, 3, 4, 5, 6, 8, 9, 11, 12]

print('missing numeric vals:', np.count_nonzero(~np.isnan(X[:, numeric_idx])))
print('missing nominal vals:', np.count_nonzero(~np.isnan(X[:, nominal_idx])))

clf_nom = sklearn.pipeline.make_pipeline(nominal_imputer, nominal_encoder)
clf_nom.fit(X[:, nominal_idx], y)
```

#### Expected Results
A fitted classifier? Depending on how you write the documentation, the current error could also be the expected result.

#### Actual Results
```
missing numeric vals: 3450
missing nominal vals: 6210
Traceback (most recent call last):
  File "/home/janvanrijn/projects/sklearn-bot/testjan.py", line 23, in <module>
    clf_nom.fit(X[:, nominal_idx], y)
  File "/home/janvanrijn/anaconda3/envs/sklearn-bot/lib/python3.6/site-packages/sklearn/pipeline.py", line 265, in fit
    Xt, fit_params = self._fit(X, y, **fit_params)
  File "/home/janvanrijn/anaconda3/envs/sklearn-bot/lib/python3.6/site-packages/sklearn/pipeline.py", line 230, in _fit
    **fit_params_steps[name])
  File "/home/janvanrijn/anaconda3/envs/sklearn-bot/lib/python3.6/site-packages/sklearn/externals/joblib/memory.py", line 329, in __call__
    return self.func(*args, **kwargs)
  File "/home/janvanrijn/anaconda3/envs/sklearn-bot/lib/python3.6/site-packages/sklearn/pipeline.py", line 614, in _fit_transform_one
    res = transformer.fit_transform(X, y, **fit_params)
  File "/home/janvanrijn/anaconda3/envs/sklearn-bot/lib/python3.6/site-packages/sklearn/base.py", line 465, in fit_transform
    return self.fit(X, y, **fit_params).transform(X)
  File "/home/janvanrijn/anaconda3/envs/sklearn-bot/lib/python3.6/site-packages/sklearn/impute.py", line 241, in fit
    "data".format(fill_value))
ValueError: 'fill_value'=missing is invalid. Expected a numerical value when imputing numerical data
```

#### Versions
```
Python=3.6.0
numpy==1.15.2
scikit-learn==0.20.0
scipy==1.1.0
```


Add Pre-fit Model to Stacking Model

<!--
If you want to propose a new algorithm, please refer first to the scikit-learn
inclusion criterion:
https://scikit-learn.org/stable/faq.html#what-are-the-inclusion-criteria-for-new-algorithms
-->

#### Describe the workflow you want to enable

Allow pre-fit models to stacking model such as `StackingClassifier` and `StackingRegressor` so that the final estimator can use their predictions directly without fitting the model on the given training data.

The motivation for this functionality originates from situation in which it is not possible to fit model on the entire dataset (due to compliance or other non-technical restrictions) or simply a research question to test with different models trained on different data. I feel this added flexibility could be beneficial in the long term.

#### Describe your proposed solution

One possible solution I have in mind is to exclude fitted estimators during fitting. We can iterate through the list of estimators and see if they have been fitted (which sklearn already has helper functions). If yes, we skip them when fitting the estimators.

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

Another option I thought about was to ask users to specify if they want to exclude fitting certain estimators. But in this case, I feel it is safer to check the estimators' status regardless, which makes the manual input somewhat redundant.


When min_samples_split and min_samples_leaf are greater than or equal to 1.0 and 0.5, no error is thrown.

<!-- Instructions For Filing a Bug: https://github.com/scikit-learn/scikit-learn/blob/master/CONTRIBUTING.md#filing-bugs -->
#### Description

This is a silent bug in version 0.18.0, as a result of the following change: "Random forest, extra trees, decision trees and gradient boosting estimator accept the parameter min_samples_split and min_samples_leaf provided as a percentage of the training samples. By yelite and Arnaud Joly."

The bug is that no error is thrown when large float values are passed. In theory, it would be useless to set `min_samples_split` to 1.0 or more, or `min_samples_leaf` to 0.5 or more. For example, `min_samples_split=2` gives a very different result compared with `min_samples_split=2.0`. In this case, accidentally setting `min_samples_split=2.0` in 0.18.0 would produce a tree with no splits. In this example, the error would be completely silent, and difficult to debug. This would probably be an unexpected outcome, especially for users coming from version 0.17.1, where these two values (`2.0` and `2`) would behave identically.
#### Steps/Code to Reproduce

Example:

```
from sklearn.ensemble import RandomForestClassifier
from sklearn.cross_validation import train_test_split
from sklearn.datasets import load_iris

iris = load_iris()
X, y = iris.data[:, [0,1,2]], iris.target
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=.33)

rf = RandomForestClassifier(n_estimators=5, min_samples_leaf=3.0)
rf.fit(X_train, y_train)
print "rf score %s" % rf.score(X_test, y_test)
```
#### Expected Results

The RandomForestClassifier scores in the ~0.9 range in 0.17.1, and I believe an error should be thrown in 0.18.0.
#### Actual Results

The RandomForestClassifier scores in the ~0.3 range in 0.18.0, with no error thrown.
#### Versions

```
Darwin-15.6.0-x86_64-i386-64bit
('Python', '2.7.11 (default, Jan 22 2016, 08:29:18) \n[GCC 4.2.1 Compatible Apple LLVM 7.0.2 (clang-700.1.81)]')
('NumPy', '1.11.2')
('SciPy', '0.17.0')
('Scikit-Learn', '0.18')
```


TST: optics function is not tested

Related to https://github.com/scikit-learn/scikit-learn/pull/1984 that was merged: it seems that the `optics` function (that @amueller added to the `cluster/__init__.py` in https://github.com/scikit-learn/scikit-learn/pull/11567) is not tested (at least not in `test_optics.py`)

(so the function `optics` that wraps the `OPTICS` class)


Deprecate n_iter in SGDClassifier and implement max_iter.

We should implement a stopping condition based on the scaled norm of the parameter update as done in the new SAG solver for LogisticRegression / Ridge. The convergence check should be done at the end of the each epoch to avoid introducing too much overhead.

Other classes sharing the same underlying implementation should be updated as well, e.g.:
- SGDRegressor
- PassiveAggressiveClassifier
- Perceptron

maybe others.

We should store the effective number of iterations in a new `n_iter_` attribute on the estimator at the end of `fit` as done in many other scikit-learn model that accept a `max_iter` hyperparam.

{'base_commit': 'ebf2bf81075ae1f4eb47ea0f54981c512bda5ceb', 'files': [{'path': 'benchmarks/bench_covertype.py', 'status': 'modified', 'Loc': {'(None, None, None)': {'mod': [105]}}}, {'path': 'benchmarks/bench_sgd_regression.py', 'status': 'modified', 'Loc': {'(None, None, None)': {'add': [23, 27], 'mod': [1, 2, 4, 5, 6, 8, 78, 80, 81, 90, 92, 94, 95, 96]}}}, {'path': 'benchmarks/bench_sparsify.py', 'status': 'modified', 'Loc': {'(None, None, None)': {'mod': [66, 75, 76, 80]}}}, {'path': 'doc/modules/kernel_approximation.rst', 'status': 'modified', 'Loc': {'(None, None, None)': {'mod': [66, 67, 68]}}}, {'path': 'doc/modules/linear_model.rst', 'status': 'modified', 'Loc': {'(None, None, None)': {'mod': [1268]}}}, {'path': 'doc/modules/sgd.rst', 'status': 'modified', 'Loc': {'(None, None, None)': {'mod': [66, 67, 68]}}}, {'path': 'doc/tutorial/text_analytics/working_with_text_data.rst', 'status': 'modified', 'Loc': {'(None, None, None)': {'mod': [355]}}}, {'path': 'doc/whats_new.rst', 'status': 'modified', 'Loc': {'(None, None, None)': {'add': [147]}}}, {'path': 'examples/linear_model/plot_sgd_iris.py', 'status': 'modified', 'Loc': {'(None, None, None)': {'mod': [41]}}}, {'path': 'examples/linear_model/plot_sgd_separating_hyperplane.py', 'status': 'modified', 'Loc': {'(None, None, None)': {'mod': [21]}}}, {'path': 'examples/linear_model/plot_sgd_weighted_samples.py', 'status': 'modified', 'Loc': {'(None, None, None)': {'mod': [30, 37]}}}, {'path': 'sklearn/decomposition/tests/test_kernel_pca.py', 'status': 'modified', 'Loc': {"(None, 'test_gridsearch_pipeline', 175)": {'mod': [181]}, "(None, 'test_gridsearch_pipeline_precomputed', 188)": {'mod': [194, 195]}, "(None, 'test_nested_circles', 202)": {'mod': [208, 221]}}}, {'path': 'sklearn/ensemble/tests/test_bagging.py', 'status': 'modified', 'Loc': {"(None, 'test_classification', 55)": {'mod': [68]}, "(None, 'test_base_estimator', 501)": {'mod': [522]}}}, {'path': 'sklearn/ensemble/tests/test_base.py', 'status': 'modified', 'Loc': {"(None, 'test_base', 25)": {'mod': [27, 28, 49]}, "(None, 'test_base_zero_n_estimators', 54)": {'mod': [57]}, "(None, 'test_base_not_int_n_estimators', 65)": {'mod': [68, 74]}, "(None, 'test_set_random_states', 81)": {'mod': [85, 94]}, "(None, 'make_steps', 100)": {'mod': [101, 102]}}}, {'path': 'sklearn/feature_selection/tests/test_from_model.py', 'status': 'modified', 'Loc': {"(None, 'test_invalid_input', 26)": {'mod': [27]}, "(None, 'test_input_estimator_unchanged', 34)": {'mod': [35, 36, 37]}, "(None, 'test_partial_fit', 108)": {'mod': [109]}, "(None, 'test_prefit', 137)": {'mod': [138, 139, 140, 143]}, "(None, 'test_threshold_without_refitting', 175)": {'mod': [176, 177]}}}, {'path': 'sklearn/linear_model/passive_aggressive.py', 'status': 'modified', 'Loc': {"('PassiveAggressiveClassifier', None, 9)": {'add': [85], 'mod': [26, 100, 101, 102]}, "('PassiveAggressiveRegressor', None, 184)": {'add': [247], 'mod': [205, 260, 261]}, "('PassiveAggressiveClassifier', '__init__', 100)": {'mod': [106, 114]}, "('PassiveAggressiveClassifier', 'partial_fit', 118)": {'mod': [153]}, "('PassiveAggressiveRegressor', '__init__', 260)": {'mod': [263, 270, 275]}, "('PassiveAggressiveRegressor', 'partial_fit', 279)": {'mod': [297]}}}, {'path': 'sklearn/linear_model/perceptron.py', 'status': 'modified', 'Loc': {"('Perceptron', None, 7)": {'add': [73], 'mod': [28]}, "('Perceptron', '__init__', 91)": {'mod': [92, 93, 98, 107]}}}, {'path': 'sklearn/linear_model/sgd_fast.pyx', 'status': 'modified', 'Loc': {'(None, None, None)': {'add': [19, 401, 508, 563, 573, 692], 'mod': [338, 366, 367, 404, 405, 406, 407, 408, 409, 410, 411, 412, 413, 414, 415, 416, 417, 418, 419, 420, 421, 433, 466, 467, 519, 538, 599, 615, 616, 680, 681, 683, 700]}}}, {'path': 'sklearn/linear_model/stochastic_gradient.py', 'status': 'modified', 'Loc': {'(None, None, None)': {'add': [7, 19]}, "('BaseSGD', '__init__', 47)": {'add': [68], 'mod': [48, 49, 51, 60]}, "(None, 'fit_binary', 238)": {'add': [259], 'mod': [238, 263, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 288]}, "('BaseSGDClassifier', '_fit', 378)": {'add': [410], 'mod': [408]}, "('BaseSGDClassifier', '_fit_multiclass', 438)": {'add': [454], 'mod': [439, 449, 450, 453, 456]}, "('SGDClassifier', None, 542)": {'add': [679], 'mod': [602, 603, 604, 692, 693, 694, 695]}, "('BaseSGDRegressor', '_fit_regressor', 1008)": {'add': [1023], 'mod': [1009, 1026, 1036, 1048, 1058, 1066, 1076]}, "('SGDRegressor', None, 1080)": {'add': [1196], 'mod': [1131, 1132, 1133, 1209, 1210, 1211]}, "('BaseSGD', '_validate_params', 80)": {'mod': [84, 85]}, "('BaseSGDClassifier', None, 291)": {'mod': [308, 309, 310, 311, 312]}, "('BaseSGDClassifier', '__init__', 308)": {'mod': [317, 324]}, "('BaseSGDClassifier', '_partial_fit', 334)": {'mod': [335, 367, 371]}, "('BaseSGDClassifier', '_fit_binary', 413)": {'mod': [414, 416, 417, 418, 419, 420, 422]}, "('BaseSGDClassifier', 'partial_fit', 467)": {'mod': [504]}, "('SGDClassifier', '__init__', 705)": {'mod': [706, 707, 708, 709, 712, 713, 716]}, "('BaseSGDRegressor', '__init__', 845)": {'mod': [846, 847, 848, 849, 853, 860]}, "('BaseSGDRegressor', '_partial_fit', 862)": {'mod': [863, 864, 890]}, "('BaseSGDRegressor', 'partial_fit', 894)": {'mod': [915, 916, 917]}, "('BaseSGDRegressor', '_fit', 919)": {'mod': [939, 940, 941]}, "('SGDRegressor', '__init__', 1218)": {'mod': [1219, 1220, 1221, 1222, 1226, 1233]}}}, {'path': 'sklearn/linear_model/tests/test_huber.py', 'status': 'modified', 'Loc': {"(None, 'test_huber_scaling_invariant', 120)": {'mod': [121, 122]}, "(None, 'test_huber_and_sgd_same_results', 138)": {'mod': [139, 154, 155]}}}, {'path': 'sklearn/linear_model/tests/test_passive_aggressive.py', 'status': 'modified', 'Loc': {"(None, 'test_classifier_accuracy', 70)": {'mod': [74, 75, 76, 77]}, "(None, 'test_classifier_partial_fit', 88)": {'mod': [92, 93, 94, 95]}, "(None, 'test_classifier_refit', 107)": {'mod': [109]}, "(None, 'test_classifier_correctness', 116)": {'mod': [122, 123, 124, 125, 129, 130, 131, 132]}, "(None, 'test_classifier_undefined_methods', 138)": {'mod': [139]}, "(None, 'test_class_weights', 144)": {'mod': [150, 156]}, "(None, 'test_partial_fit_weight_class_balanced', 166)": {'mod': [168]}, "(None, 'test_equal_class_weight', 172)": {'mod': [175, 179, 180, 183, 184]}, "(None, 'test_wrong_class_weight_label', 192)": {'mod': [198]}, "(None, 'test_wrong_class_weight_format', 202)": {'mod': [208, 211]}, "(None, 'test_regressor_mse', 215)": {'mod': [222, 223, 224, 225]}, "(None, 'test_regressor_partial_fit', 236)": {'mod': [242, 243, 244, 245]}, "(None, 'test_regressor_correctness', 257)": {'mod': [262, 263, 264, 265, 269, 270, 271, 272]}, "(None, 'test_regressor_undefined_methods', 278)": {'mod': [279]}}}, {'path': 'sklearn/linear_model/tests/test_perceptron.py', 'status': 'modified', 'Loc': {'(None, None, None)': {'mod': [5]}, "(None, 'test_perceptron_accuracy', 46)": {'mod': [48, 51]}, "(None, 'test_perceptron_correctness', 54)": {'mod': [61]}, "(None, 'test_undefined_methods', 67)": {'mod': [68]}}}, {'path': 'sklearn/linear_model/tests/test_sgd.py', 'status': 'modified', 'Loc': {'(None, None, None)': {'add': [16, 22, 1166]}, "('CommonTest', 'factory', 103)": {'add': [105]}, "('CommonTest', '_test_warm_start', 144)": {'mod': [146, 150, 157]}, "('CommonTest', 'test_input_format', 179)": {'mod': [181, 182]}, "('CommonTest', 'test_clone', 189)": {'mod': [191, 196]}, "('CommonTest', 'test_late_onset_averaging_reached', 232)": {'mod': [241, 244]}, "('DenseSGDClassifierTestCase', 'test_sgd', 270)": {'mod': [275]}, "('DenseSGDClassifierTestCase', None, 266)": {'mod': [311]}, "('DenseSGDClassifierTestCase', 'test_sgd_n_iter_param', 311)": {'mod': [313]}, "('DenseSGDClassifierTestCase', 'test_average_binary_computed_correctly', 342)": {'mod': [356]}, "('DenseSGDClassifierTestCase', 'test_sgd_at_least_two_labels', 380)": {'mod': [382]}, "('DenseSGDClassifierTestCase', 'test_sgd_multiclass', 398)": {'mod': [400]}, "('DenseSGDClassifierTestCase', 'test_sgd_multiclass_average', 407)": {'mod': [415]}, "('DenseSGDClassifierTestCase', 'test_sgd_multiclass_with_init_coef', 430)": {'mod': [432]}, "('DenseSGDClassifierTestCase', 'test_sgd_multiclass_njobs', 440)": {'mod': [442]}, "('DenseSGDClassifierTestCase', 'test_sgd_proba', 467)": {'mod': [473, 480, 493, 516]}, "('DenseSGDClassifierTestCase', 'test_sgd_l1', 534)": {'mod': [545]}, "('DenseSGDClassifierTestCase', 'test_class_weights', 563)": {'mod': [569, 575]}, "('DenseSGDClassifierTestCase', 'test_equal_class_weight', 583)": {'mod': [587, 592]}, "('DenseSGDClassifierTestCase', 'test_wrong_class_weight_label', 600)": {'mod': [602]}, "('DenseSGDClassifierTestCase', 'test_wrong_class_weight_format', 606)": {'mod': [608]}, "('DenseSGDClassifierTestCase', 'test_weights_multiplied', 611)": {'mod': [620, 621]}, "('DenseSGDClassifierTestCase', 'test_balanced_weight', 628)": {'mod': [639, 641, 642, 645, 648, 649, 663, 669, 670, 671, 672, 674, 675]}, "('DenseSGDClassifierTestCase', 'test_sample_weights', 680)": {'mod': [686]}, "('DenseSGDClassifierTestCase', 'test_wrong_sample_weights', 698)": {'mod': [700]}, "('DenseSGDClassifierTestCase', '_test_partial_fit_equal_fit', 766)": {'mod': [768]}, "('DenseSGDClassifierTestCase', 'test_multiple_fit', 816)": {'mod': [818, 819]}, "('DenseSGDRegressorTestCase', 'test_sgd', 842)": {'mod': [844]}, "('DenseSGDRegressorTestCase', 'test_sgd_averaged_computed_correctly', 859)": {'mod': [877]}, "('DenseSGDRegressorTestCase', 'test_sgd_averaged_partial_fit', 887)": {'mod': [904]}, "('DenseSGDRegressorTestCase', 'test_average_sparse', 915)": {'mod': [924]}, "('DenseSGDRegressorTestCase', 'test_sgd_least_squares_fit', 937)": {'mod': [946, 955]}, "('DenseSGDRegressorTestCase', 'test_sgd_epsilon_insensitive', 961)": {'mod': [971, 981]}, "('DenseSGDRegressorTestCase', 'test_sgd_huber_fit', 987)": {'mod': [996, 1005]}, "('DenseSGDRegressorTestCase', 'test_elasticnet_convergence', 1011)": {'mod': [1028]}, "('DenseSGDRegressorTestCase', '_test_partial_fit_equal_fit', 1054)": {'mod': [1055]}, "(None, 'test_l1_ratio', 1091)": {'mod': [1098, 1099, 1100, 1104, 1105, 1106]}, "(None, 'test_underflow_or_overlow', 1110)": {'mod': [1132]}, "(None, 'test_numerical_stability_large_gradient', 1145)": {'mod': [1148, 1150]}, "(None, 'test_large_regularization', 1156)": {'mod': [1161]}}}, {'path': 'sklearn/model_selection/tests/test_search.py', 'status': 'modified', 'Loc': {"(None, 'test_stochastic_gradient_loss_param', 1218)": {'mod': [1226, 1241]}}}, {'path': 'sklearn/model_selection/tests/test_validation.py', 'status': 'modified', 'Loc': {"(None, 'test_learning_curve_batch_and_incremental_learning_are_equal', 754)": {'mod': [759]}, "(None, 'test_learning_curve_with_shuffle', 820)": {'mod': [830]}}}, {'path': 'sklearn/tests/test_learning_curve.py', 'status': 'modified', 'Loc': {"(None, 'test_learning_curve_batch_and_incremental_learning_are_equal', 219)": {'mod': [224]}}}, {'path': 'sklearn/tests/test_multiclass.py', 'status': 'modified', 'Loc': {"(None, 'test_ovr_partial_fit', 82)": {'mod': [101, 102, 106, 107]}, "(None, 'test_ovo_ties', 605)": {'mod': [610]}, "(None, 'test_ovo_ties2', 629)": {'mod': [637]}}}, {'path': 'sklearn/tests/test_multioutput.py', 'status': 'modified', 'Loc': {"(None, 'test_multi_target_regression_partial_fit', 45)": {'mod': [53, 58]}, "(None, 'test_multi_target_sample_weight_partial_fit', 106)": {'mod': [111, 116]}, "(None, 'test_multi_output_classification_partial_fit_parallelism', 154)": {'mod': [155]}, "(None, 'test_multi_output_classification_partial_fit', 165)": {'mod': [169]}, "(None, 'test_multi_output_classifiation_partial_fit_no_first_classes_exception', 196)": {'mod': [196, 197]}, "(None, 'test_multi_output_classification_partial_fit_sample_weights', 309)": {'mod': [314, 321]}}}, {'path': 'sklearn/utils/estimator_checks.py', 'status': 'modified', 'Loc': {'(None, None, None)': {'add': [44], 'mod': [135, 395, 417, 432, 501, 551, 661, 671, 684, 847, 972, 993, 1149, 1196, 1228, 1262, 1290, 1349, 1386, 1404, 1435, 1469, 1488, 1526, 1619, 1658, 1684, 1709, 1720]}, "(None, 'check_class_weight_classifiers', 1350)": {'add': [1374]}, "(None, 'check_class_weight_balanced_classifiers', 1387)": {'add': [1391]}, "(None, 'check_class_weight_balanced_linear_classifier', 1405)": {'add': [1416]}, "(None, 'check_parameters_default_constructible', 1548)": {'add': [1603], 'mod': [1553, 1608]}, "(None, 'set_checking_parameters', 283)": {'mod': [287]}, "(None, 'check_estimator_sparse_data', 353)": {'mod': [366, 373]}, "(None, 'check_estimators_nan_inf', 867)": {'mod': [885]}, "(None, 'check_classifiers_one_label', 1044)": {'mod': [1053]}}}, {'path': 'sklearn/utils/weight_vector.pyx', 'status': 'modified', 'Loc': {}}]}


`min_samples` in HDSCAN

### Describe the issue linked to the documentation

I find the description of the `min_samples` argument in sklearn.cluster.HDBSCAN confusing.

It says "The number of samples in a neighborhood for a point to be considered as a core point. This includes the point itself."

But if I understand everything correctly `min_samples` corresponds to the $k$ used to compute the core distance $\text{core}_k\left(x\right)$ for every sample $x$ where the $k$'th core distance for some sample $x$ is defined as the distance to the $k$'th nearest-neighbor of $x$ (counting itself). (-> which exactly what is happening in the code here: https://github.com/scikit-learn-contrib/hdbscan/blob/fc94241a4ecf5d3668cbe33b36ef03e6160d7ab7/hdbscan/_hdbscan_reachability.pyx#L45-L47, where it is called `min_points`)

I don't understand how both of these descriptions are equivalent. I would assume that other people might find that confusing as well.

Link in Code: https://github.com/scikit-learn/scikit-learn/blob/8721245511de2f225ff5f9aa5f5fadce663cd4a3/sklearn/cluster/_hdbscan/hdbscan.py#L441-L444

Link in Documentation: https://scikit-learn.org/stable/modules/generated/sklearn.cluster.DBSCAN.html#sklearn.cluster.DBSCAN

### Suggest a potential alternative/fix

_No response_

{'base_commit': 'dc1cad2b3fddb8b9069d7cfd89cb1039260baf8e', 'files': [{'path': 'sklearn/cluster/_hdbscan/_reachability.pyx', 'status': 'modified', 'Loc': {'(None, None, None)': {'mod': [65, 66]}}}, {'path': 'sklearn/cluster/_hdbscan/hdbscan.py', 'status': 'modified', 'Loc': {"('HDBSCAN', None, 419)": {'mod': [444, 445]}}}]}


add predict and fit_predict to more clustering algorithms

We should add `predict` and `fit_predict` to other clustering algorithms than `KMeans`: they are useful to retrieve cluster labels independently of the underlying attribute names...

{'base_commit': '127415b209ca1df3f8502bdf74de56c33aff2565', 'files': [{'path': 'sklearn/base.py', 'status': 'modified', 'Loc': {'(None, None, None)': {'add': [365]}}}, {'path': 'sklearn/cluster/affinity_propagation_.py', 'status': 'modified', 'Loc': {'(None, None, None)': {'mod': [12]}, "('AffinityPropagation', None, 168)": {'mod': [168]}}}, {'path': 'sklearn/cluster/dbscan_.py', 'status': 'modified', 'Loc': {'(None, None, None)': {'mod': [13]}, "('DBSCAN', None, 112)": {'mod': [112]}}}, {'path': 'sklearn/cluster/hierarchical.py', 'status': 'modified', 'Loc': {'(None, None, None)': {'mod': [18]}, "('Ward', None, 257)": {'mod': [257]}}}, {'path': 'sklearn/cluster/k_means_.py', 'status': 'modified', 'Loc': {'(None, None, None)': {'mod': [19]}, "('KMeans', None, 599)": {'mod': [599, 759, 760, 762, 763, 764, 765]}, "('MiniBatchKMeans', None, 963)": {'mod': [963]}}}, {'path': 'sklearn/cluster/mean_shift_.py', 'status': 'modified', 'Loc': {'(None, None, None)': {'mod': [12]}, "('MeanShift', None, 202)": {'mod': [202]}}}, {'path': 'sklearn/cluster/spectral.py', 'status': 'modified', 'Loc': {'(None, None, None)': {'mod': [10]}, "('SpectralClustering', None, 227)": {'mod': [227]}}}, {'path': 'sklearn/cluster/tests/test_k_means.py', 'status': 'modified', 'Loc': {'(None, None, None)': {'add': [419]}}}]}


cross_val_predict AttributeError with lists

When calling the cross_val_predict with an X parameter that is a list type, an AttributeError is raised on line 1209. This is because it is checking for the shape of the X parameter, but a list does not have the shape attribute.

The documentation says that this function supports lists so I am supposing that it isn't intended behavior. Commenting out that line also makes the rest of the function work perfectly fine.

Also not that the cross_val_score function, that takes the same arguments, works fine.

I can provide the dataset I used if necessary.

{'base_commit': '9385c45c0379ceab913daa811b1e7d4128faee35', 'files': [{'path': 'sklearn/cross_validation.py', 'status': 'modified', 'Loc': {"(None, 'cross_val_predict', 958)": {'mod': [1027]}}}, {'path': 'sklearn/tests/test_cross_validation.py', 'status': 'modified', 'Loc': {'(None, None, None)': {'add': [1037]}, "('MockClassifier', 'predict', 95)": {'mod': [98]}}}, {'path': 'sklearn/utils/mocking.py', 'status': 'modified', 'Loc': {"('CheckingClassifier', 'fit', 46)": {'add': [51]}, '(None, None, None)': {'mod': [1, 2]}, "('CheckingClassifier', None, 33)": {'mod': [33]}, "('CheckingClassifier', 'predict', 55)": {'mod': [58]}}}]}


[RFC] Minimal scipy version for 1.0 (or 0.26) release

#### Proposal
I'd like to propose to increase the minimal scipy version to 1.0.
```python
SCIPY_MIN_VERSION = '1.0.0'
```

#### Reasoning

1. In case we should release scikit-learn 1.0, it would be a good fit:smirk:
2. Linear quantile regression #9978 could make it into the next release. It uses `scipy.optimize.linprog` under the hood. Scipy 1.0.0 has introduced a new solver `method="interior-point"` which is set as default method. Having it available would help us to avoid to support the `"simplex"` method in scikit-learn. Note, that scipy v1.3.0 introduced the `"revised simplex"` method and version 1.5 the `"highs**"` solvers which are much preferred.
   I think we should avoid the legacy simplex method.
3. *Your reason for scipy 1.0.0.*

{'base_commit': '053d2d1af477d9dc17e69162b9f2298c0fda5905', 'files': [{'path': '.circleci/config.yml', 'status': 'modified', 'Loc': {'(None, None, None)': {'mod': [6, 11, 50, 99, 133]}}}, {'path': '.travis.yml', 'status': 'modified', 'Loc': {'(None, None, None)': {'mod': [43, 48, 49, 50, 51, 52, 53, 54]}}}, {'path': 'azure-pipelines.yml', 'status': 'modified', 'Loc': {'(None, None, None)': {'add': [121, 125], 'mod': [14, 41, 60, 86, 108, 124, 135, 136, 137, 139, 143, 144, 146, 147, 149, 154, 155, 157, 158, 159, 160, 174, 183, 184, 185, 189, 190, 234, 235]}}}, {'path': 'build_tools/azure/install.sh', 'status': 'modified', 'Loc': {'(None, None, None)': {'mod': [73, 75]}}}, {'path': 'build_tools/azure/posix-32.yml', 'status': 'modified', 'Loc': {'(None, None, None)': {'mod': [48, 66]}}}, {'path': 'build_tools/azure/test_script.sh', 'status': 'modified', 'Loc': {'(None, None, None)': {'mod': [7]}}}, {'path': 'doc/conftest.py', 'status': 'modified', 'Loc': {'(None, None, None)': {'add': [9]}, "(None, 'setup_preprocessing', 80)": {'add': [82]}}}, {'path': 'doc/modules/sgd.rst', 'status': 'modified', 'Loc': {'(None, None, None)': {'mod': [133]}}}, {'path': 'doc/tutorial/statistical_inference/supervised_learning.rst', 'status': 'modified', 'Loc': {'(None, None, None)': {'mod': [176]}}}, {'path': 'doc/whats_new/v1.0.rst', 'status': 'modified', 'Loc': {'(None, None, None)': {'add': [14]}}}, {'path': 'pyproject.toml', 'status': 'modified', 'Loc': {'(None, None, None)': {'mod': [14]}}}, {'path': 'sklearn/_min_dependencies.py', 'status': 'modified', 'Loc': {'(None, None, None)': {'add': [13], 'mod': [8, 11, 12, 29, 30, 31]}}}, {'path': 'sklearn/decomposition/_truncated_svd.py', 'status': 'modified', 'Loc': {"('TruncatedSVD', None, 24)": {'mod': [90, 91, 92, 97, 99, 101]}}}, {'path': 'sklearn/ensemble/_hist_gradient_boosting/tests/test_loss.py', 'status': 'modified', 'Loc': {"(None, 'test_derivatives', 66)": {'mod': [101]}}}, {'path': 'sklearn/utils/tests/test_validation.py', 'status': 'modified', 'Loc': {'(None, None, None)': {'mod': [27, 52, 348, 371, 372]}, "(None, 'test_check_array_dtype_numeric_errors', 374)": {'mod': [376, 377, 378]}}}]}


Poisson criterion in RandomForestRegressor

#### Describe the workflow you want to enable
I want to officially use the Poisson splitting criterion in `RandomForestRegressor`.

#### Describe your proposed solution
#17386 implemented the poisson splitting criterion for `DecisionTreeRegressor` and `ExtraTreeRegressor`. This also enabled—somewhat silently—to do:
```
import numpy as np
from sklearn.ensemble import RandomForestRegressor
y = [0, 1, 2]
X = np.arange(6).reshape(3, 2)
rf = RandomForestRegressor(criterion="poisson")
rf.fit(X, y)
```
Note: The same is true for `ensemble.ExtraTreesRegressor`.

Tasks:

- [ ] Add the poisson splitting criterion to the docstring of `RandomForestRegressor`.
- [ ] Add input validation (non-negative `y`) to `RandomForestRegressor`.
- [ ] Expand the tests for `RandomForestRegressor`.


RidgeClassifier triggers data copy

RidgeClassifier always triggers a data copy even when not using sample weights.

Regression introduced in #4838.

See:
https://github.com/scikit-learn/scikit-learn/pull/4838#discussion_r32090535


float numbers can't be set to RFECV's parameter "step"

#### Description

When I use RFECV with parameter 'step' as a float number will cause warnings/errors "rfe.py:203: VisibleDeprecationWarning: using a non-integer number instead of an integer will result in an error in the future".  And the analysis can't be finished until integer or 1/2.

I read description of RFECV and learned that parameter 'step' can accept float. (introduction online: If greater than or equal to 1, then step corresponds to the (integer) number of features to remove at each iteration. If within (0.0, 1.0), then step corresponds to the percentage (rounded down) of features to remove at each iteration.)

And I didn't read any bugs from source script. Please tell.

{'base_commit': 'c9e227b70d64f73b953d8d60629d6ac63e02a91c', 'files': [{'path': 'sklearn/feature_selection/rfe.py', 'status': 'modified', 'Loc': {"('RFECV', 'fit', 378)": {'add': [398], 'mod': [427]}}}, {'path': 'sklearn/feature_selection/tests/test_rfe.py', 'status': 'modified', 'Loc': {'(None, None, None)': {'add': [184]}}}]}


l1_ratio in sklearn.linear_model's ElasticNet greater than 1?

I accidentally ran ElasticNet (from sklearn.linear_model) for l1_ratio >1, and no error or warning was raised. From the docsstring, it says that ``0 < l1_ratio < 1``. Should we raise a ValueError or something? Found this with @mathurinm.

If this turns out to be something to be done, I could help out if someone could point me towards the right direction. Thanks !

p/s: Not sure if this should be under bugs/documentations/others, so I listed it under others. Sklearn version is 0.22.1.

{'base_commit': '9b42b0cc7d5cf6978805619bc2433e3888c38d0c', 'files': [{'path': 'sklearn/linear_model/_coordinate_descent.py', 'status': 'modified', 'Loc': {"('ElasticNet', 'fit', 719)": {'add': [757]}}}, {'path': 'sklearn/linear_model/tests/test_coordinate_descent.py', 'status': 'modified', 'Loc': {'(None, None, None)': {'add': [60]}}}]}


Memory leak in LogisticRegression

Dear all,

while running many logistic regressions, I encountered a continuous memory increase on several (Debian) machines. The problem is isolated in this code:

```python
import sklearn
from sklearn.linear_model import LogisticRegression
import numpy as np
import time
import psutil
import os

if __name__ == "__main__":
    print("Sklearn version: %s" % sklearn.__version__)
    n_samples = 2
    n_features = 2
    data = np.arange(n_samples*n_features).reshape((n_samples,n_features))
    labels = np.arange(n_samples)
    last_output_time = 0
    process = psutil.Process(os.getpid())
    for i in range(10000000):
        clf = LogisticRegression()
        clf.fit(X=data, y=labels)
        del clf
        if time.time()-last_output_time >= 5:
            print(process.get_memory_info()[0] / float(2 ** 20))
            last_output_time = time.time()
```
This was Python 2.7 under Linux 3.16.0-4-amd64 #1 SMP Debian 3.16.39-1+deb8u1 (2017-02-22) x86_64 GNU/Linux, with scikit-learn 0.18.1. Is this reproducable?

{'base_commit': '38c7e93b1edcbfb85060cf7c14cca3ab47b9267c', 'files': [{'path': 'sklearn/svm/src/liblinear/liblinear_helper.c', 'status': 'modified', 'Loc': {"(None, 'free_problem', 217)": {'add': [221]}}}, {'path': 'sklearn/svm/src/liblinear/linear.cpp', 'status': 'modified', 'Loc': {"(None, 'free_model_content', 2907)": {'add': [2912]}}}]}


Incorrect sample weight handling in `KBinsDiscretizer`

### Describe the bug

Sample weights are not properly passed through when specifying subsample within KBinsDiscretizer.

### Steps/Code to Reproduce

```python
from sklearn.datasets import make_blobs
from sklearn.preprocessing import KBinsDiscretizer
import numpy as np

rng = np.random.RandomState(42)

# Four centres
centres = np.array([[0, 0], [0, 5], [3, 1], [2, 4], [8, 8]])
X, _ = make_blobs(
            n_samples=100,
            cluster_std=0.5,
            centers=centres,
            random_state=10,
        )

# Randomly generate sample weights
sample_weight = rng.randint(0, 10, size=X.shape[0])

est = KBinsDiscretizer(n_bins=4, strategy='quantile', subsample=20,
                                    random_state=10).fit(X, sample_weight=sample_weight)
```

### Expected Results

No error is thrown

### Actual Results

```
[253](https://file+.vscode-resource.vscode-cdn.net/Users/shrutinath/sklearn-dev/~/sklearn-dev/scikit-learn/sklearn/preprocessing/_discretization.py:253) if sample_weight is not None:
--> [254](https://file+.vscode-resource.vscode-cdn.net/Users/shrutinath/sklearn-dev/~/sklearn-dev/scikit-learn/sklearn/preprocessing/_discretization.py:254)     sample_weight = _check_sample_weight(sample_weight, X, dtype=X.dtype)
    [256](https://file+.vscode-resource.vscode-cdn.net/Users/shrutinath/sklearn-dev/~/sklearn-dev/scikit-learn/sklearn/preprocessing/_discretization.py:256) bin_edges = np.zeros(n_features, dtype=object)
    [257](https://file+.vscode-resource.vscode-cdn.net/Users/shrutinath/sklearn-dev/~/sklearn-dev/scikit-learn/sklearn/preprocessing/_discretization.py:257) for jj in range(n_features):

File ~/sklearn-dev/scikit-learn/sklearn/utils/validation.py:2133, in _check_sample_weight(sample_weight, X, dtype, copy, ensure_non_negative)
   [2130](https://file+.vscode-resource.vscode-cdn.net/Users/shrutinath/sklearn-dev/~/sklearn-dev/scikit-learn/sklearn/utils/validation.py:2130)         raise ValueError("Sample weights must be 1D array or scalar")
   [2132](https://file+.vscode-resource.vscode-cdn.net/Users/shrutinath/sklearn-dev/~/sklearn-dev/scikit-learn/sklearn/utils/validation.py:2132)     if sample_weight.shape != (n_samples,):
-> [2133](https://file+.vscode-resource.vscode-cdn.net/Users/shrutinath/sklearn-dev/~/sklearn-dev/scikit-learn/sklearn/utils/validation.py:2133)         raise ValueError(
   [2134](https://file+.vscode-resource.vscode-cdn.net/Users/shrutinath/sklearn-dev/~/sklearn-dev/scikit-learn/sklearn/utils/validation.py:2134)             "sample_weight.shape == {}, expected {}!".format(
   [2135](https://file+.vscode-resource.vscode-cdn.net/Users/shrutinath/sklearn-dev/~/sklearn-dev/scikit-learn/sklearn/utils/validation.py:2135)                 sample_weight.shape, (n_samples,)
   [2136](https://file+.vscode-resource.vscode-cdn.net/Users/shrutinath/sklearn-dev/~/sklearn-dev/scikit-learn/sklearn/utils/validation.py:2136)             )
   [2137](https://file+.vscode-resource.vscode-cdn.net/Users/shrutinath/sklearn-dev/~/sklearn-dev/scikit-learn/sklearn/utils/validation.py:2137)         )
   [2139](https://file+.vscode-resource.vscode-cdn.net/Users/shrutinath/sklearn-dev/~/sklearn-dev/scikit-learn/sklearn/utils/validation.py:2139) if ensure_non_negative:
   [2140](https://file+.vscode-resource.vscode-cdn.net/Users/shrutinath/sklearn-dev/~/sklearn-dev/scikit-learn/sklearn/utils/validation.py:2140)     check_non_negative(sample_weight, "`sample_weight`")

ValueError: sample_weight.shape == (100,), expected (20,)!
```

### Versions

```shell
System:
    python: 3.12.4 | packaged by conda-forge | (main, Jun 17 2024, 10:13:44) [Clang 16.0.6 ]
executable: /Users/shrutinath/micromamba/envs/scikit-learn/bin/python
   machine: macOS-14.3-arm64-arm-64bit

Python dependencies:
      sklearn: 1.6.dev0
          pip: 24.0
   setuptools: 70.1.1
        numpy: 2.0.0
        scipy: 1.14.0
       Cython: 3.0.10
       pandas: 2.2.2
   matplotlib: 3.9.0
       joblib: 1.4.2
threadpoolctl: 3.5.0

Built with OpenMP: True

threadpoolctl info:
       user_api: blas
   internal_api: openblas
    num_threads: 8
         prefix: libopenblas
...
    num_threads: 8
         prefix: libomp
       filepath: /Users/shrutinath/micromamba/envs/scikit-learn/lib/libomp.dylib
        version: None
Output is truncated. View as a scrollable element or open in a text editor. Adjust cell output settings...
```


var.monotone option in GradientBoosting

Hi, is it possible to add the equivalent of the var.monotone option in R GBM package to the GradientBoostingClassifier/Regressor? Sometimes it is really useful when we know/want some factors to have monotonic effect to avoid overfitting and non-intuitive results.

Thanks!

{'base_commit': 'dcfb3df9a3df5aa2a608248316d537cd6b3643ee', 'files': [{'path': 'doc/modules/ensemble.rst', 'status': 'modified', 'Loc': {'(None, None, None)': {'add': [1052], 'mod': [900]}}}, {'path': 'doc/whats_new/v0.23.rst', 'status': 'modified', 'Loc': {'(None, None, None)': {'add': [186]}}}, {'path': 'sklearn/ensemble/_hist_gradient_boosting/common.pxd', 'status': 'modified', 'Loc': {'(None, None, None)': {'add': [32]}}}, {'path': 'sklearn/ensemble/_hist_gradient_boosting/gradient_boosting.py', 'status': 'modified', 'Loc': {"('BaseHistGradientBoosting', '__init__', 30)": {'add': [41], 'mod': [32, 33]}, "('BaseHistGradientBoosting', None, 26)": {'add': [84]}, "('BaseHistGradientBoosting', 'fit', 85)": {'add': [360]}, "('HistGradientBoostingRegressor', None, 725)": {'add': [792]}, "('HistGradientBoostingClassifier', None, 910)": {'add': [980]}, "('HistGradientBoostingRegressor', '__init__', 867)": {'mod': [870, 871, 878, 879]}, "('HistGradientBoostingClassifier', '__init__', 1059)": {'mod': [1061, 1062, 1070, 1071]}}}, {'path': 'sklearn/ensemble/_hist_gradient_boosting/grower.py', 'status': 'modified', 'Loc': {'(None, None, None)': {'add': [19]}, "('TreeNode', '__init__', 90)": {'add': [97], 'mod': [91]}, "('TreeGrower', '__init__', 167)": {'add': [191, 202], 'mod': [170, 171, 198]}, "('TreeGrower', None, 116)": {'add': [254]}, "('TreeNode', None, 25)": {'mod': [74]}, "('TreeGrower', '_intilialize_root', 255)": {'mod': [268]}, "('TreeGrower', '_compute_best_split_and_push', 286)": {'mod': [297]}, "('TreeGrower', 'split_next', 304)": {'mod': [332, 337, 375, 377, 378]}, "('TreeGrower', '_finalize_leaf', 414)": {'mod': [415, 417, 418, 420, 421, 422, 423, 424, 425]}, "(None, '_fill_predictor_node_array', 455)": {'mod': [467, 470]}}}, {'path': 'sklearn/ensemble/_hist_gradient_boosting/splitting.pyx', 'status': 'modified', 'Loc': {'(None, None, None)': {'add': [21, 26, 41, 83, 128, 143, 154, 368, 388, 432, 458, 485, 492, 544, 570, 668], 'mod': [73, 353, 381, 407, 415, 484, 489, 490, 491, 522, 525, 526, 527, 528, 529, 530, 531, 532, 533, 534, 535, 536, 568, 574, 575, 576, 607, 610, 611, 612, 613, 614, 615, 616, 617, 618, 619, 620, 621, 628, 641, 642, 643, 644, 645, 648, 649, 650, 651, 652]}}}, {'path': 'sklearn/ensemble/_hist_gradient_boosting/tests/test_gradient_boosting.py', 'status': 'modified', 'Loc': {"(None, 'test_early_stopping_on_test_set_with_warm_start', 650)": {'add': [661]}}}, {'path': 'sklearn/ensemble/_hist_gradient_boosting/tests/test_grower.py', 'status': 'modified', 'Loc': {"(None, 'test_grow_tree', 77)": {'add': [136]}, "(None, 'test_split_on_nan_with_infinite_values', 358)": {'mod': [396, 397]}}}, {'path': 'sklearn/ensemble/_hist_gradient_boosting/tests/test_splitting.py', 'status': 'modified', 'Loc': {"(None, 'test_histogram_split', 13)": {'add': [45, 50, 56], 'mod': [59]}, "(None, 'test_gradient_and_hessian_sanity', 72)": {'add': [108, 115, 121, 122], 'mod': [111, 117, 125, 128]}, "(None, 'test_split_indices', 172)": {'add': [208, 217], 'mod': [211, 219]}, "(None, 'test_min_gain_to_split', 239)": {'add': [265, 272], 'mod': [268, 274]}, "(None, 'test_splitting_missing_values', 368)": {'add': [402, 405, 410], 'mod': [412]}, '(None, None, None)': {'mod': [7]}}}]}


"scoring must return a number" error with custom scorer

#### Description

I'm encountering the same error (`ValueError: scoring must return a number, got [...] (<class 'numpy.core.memmap.memmap'>) instead.`) as #6147, despite running v0.17.1. This is because I'm creating my own scorer, following the example in this [article](http://bigdataexaminer.com/data-science/dealing-with-unbalanced-classes-svm-random-forests-and-decision-trees-in-python/).
#### Steps/Code to Reproduce

``` python
import pandas as pd
import numpy as np
from sklearn.cross_validation import cross_val_score
from sklearn.ensemble import RandomForestClassifier
from sklearn.datasets import make_classification
from functools import partial

def cutoff_predict(clf, X, cutoff):
    return (clf.predict_proba(X)[:, 1] > cutoff).astype(int)

def perc_diff_score(y, ypred, X=None):
    values = X[:,0]
    actual_value = np.sum(np.multiply(y, values))
    predict_value = np.sum(np.multiply(ypred, values))
    difference = predict_value - actual_value
    percent_diff = abs(difference * 100 / actual_value )
    return -1*percent_diff

def perc_diff_cutoff(clf, X, y, cutoff=None):
    ypred = cutoff_predict(clf, X, cutoff)
    return perc_diff_score(y, ypred, X)

def perc_diff_score_cutoff(cutoff):
    return partial(perc_diff_cutoff, cutoff=cutoff)

clf = RandomForestClassifier()
X_train, y_train = make_classification(n_samples=int(1e6), n_features=5, random_state=0)
values = abs(100000 * np.random.randn(len(X_train))).reshape((X_train.shape[0], 1))
X_train = np.append(values, X_train, 1)

cutoff = 0.1
validated = cross_val_score(clf, X_train, y_train, scoring=perc_diff_score_cutoff(cutoff),
                            verbose=3,
                            n_jobs=-1,
                            )
```
#### Expected Results

No error.
#### Actual Results

Same error as in #6147 :

```
/home/gillesa/anaconda2/lib/python2.7/site-packages/sklearn/cross_validation.pyc in _score(estimator=ExtraTreesClassifier(bootstrap=False, class_weig..., random_state=None, verbose=0, warm_start=False), X_test=memmap([[  0.,   9.,  56., ...,   1.,   0.,   0....      [  0.,   6.,  57., ...,   1.,   0.,   0.]]), y_test=memmap([0, 0, 0, ..., 0, 0, 0]), scorer=make_scorer(roc_auc_score, needs_threshold=True))
   1604         score = scorer(estimator, X_test)
   1605     else:
   1606         score = scorer(estimator, X_test, y_test)
   1607     if not isinstance(score, numbers.Number):
   1608         raise ValueError("scoring must return a number, got %s (%s) instead."
-> 1609                          % (str(score), type(score)))
   1610     return score
   1611
   1612
   1613 def _permutation_test_score(estimator, X, y, cv, scorer):

ValueError: scoring must return a number, got 0.671095795498 (<class 'numpy.core.memmap.memmap'>) instead.
```
#### Workaround

Updated `perc_diff_score()` as follows to add cast to `float`.:

``` python
def perc_diff_score(y, ypred, X=None):
    values = X[:,0]
    actual_value = np.sum(np.multiply(y, values))
    predict_value = np.sum(np.multiply(ypred, values))
    difference = predict_value - actual_value
    percent_diff = np.float(abs(difference * 100 / actual_value ))
    return -1*percent_diff
```
#### Versions

Darwin-15.4.0-x86_64-i386-64bit
Python 3.5.1 |Anaconda 4.0.0 (x86_64)| (default, Dec  7 2015, 11:24:55)
[GCC 4.2.1 (Apple Inc. build 5577)]import numpy; print("NumPy", numpy.**version**)
NumPy 1.11.0
SciPy 0.17.0
Scikit-Learn 0.17.1

{'base_commit': '417788c6a54c39614b82acf1a04b1f97f8a32199', 'files': [{'path': 'sklearn/cross_validation.py', 'status': 'modified', 'Loc': {"(None, '_score', 1645)": {'add': [1650]}}}, {'path': 'sklearn/model_selection/_validation.py', 'status': 'modified', 'Loc': {"(None, '_score', 298)": {'add': [303]}}}, {'path': 'sklearn/model_selection/tests/test_validation.py', 'status': 'modified', 'Loc': {'(None, None, None)': {'add': [5]}, "(None, 'test_cross_val_predict_with_method', 746)": {'add': [771]}}}]}