# [Solved] sklearn Logistic Regression “ValueError: Found array with dim 3. Estimator expected <= 2."

Hello Guys, How are you all? Hope You all Are Fine. Today I get the following error sklearn Logistic Regression “ValueError: Found array with dim 3. Estimator expected <= 2.” in python. So Here I am Explain to you all the possible solutions here.

## How sklearn Logistic Regression “ValueError: Found array with dim 3. Estimator expected <= 2.” Error Occurs?

Today I get the following error sklearn Logistic Regression “ValueError: Found array with dim 3. Estimator expected <= 2.” in python.

## How To Solve sklearn Logistic Regression “ValueError: Found array with dim 3. Estimator expected <= 2.” Error ?

1. How To Solve sklearn Logistic Regression “ValueError: Found array with dim 3. Estimator expected

To Solve sklearn Logistic Regression “ValueError: Found array with dim 3. Estimator expected <= 2.” Error scikit-learn expects 2d num arrays for the training dataset for a fit function. The dataset you are passing in is a 3d array you need to reshape the array into a 2d.

2. sklearn Logistic Regression “ValueError: Found array with dim 3. Estimator expected

To Solve sklearn Logistic Regression “ValueError: Found array with dim 3. Estimator expected <= 2.” Error scikit-learn expects 2d num arrays for the training dataset for a fit function. The dataset you are passing in is a 3d array you need to reshape the array into a 2d.

## Solution 1

scikit-learn expects 2d num arrays for the training dataset for a fit function. The dataset you are passing in is a 3d array you need to reshape the array into a 2d.

```nsamples, nx, ny = train_dataset.shape
d2_train_dataset = train_dataset.reshape((nsamples,nx*ny))```

## Solution 2

In LSTM, GRU, and TCN layers, the return_sequence in last layer before Dence Layer must set False . It is one of conditions that you encounter to this error message .

## Summery

It’s all About this issue. Hope all solution helped you a lot. Comment below Your thoughts and your queries. Also, Comment below which solution worked for you? Thank You.