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

前端 未结 2 846
情深已故
情深已故 2020-11-30 05:20

I attempt to solve this problem 6 in this notebook. The question is to train a simple model on this data using 50, 100, 1000 and 5000 training samples by using the LogisticR

相关标签:
2条回答
  • 2020-11-30 05:54

    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))
    
    0 讨论(0)
  • 2020-11-30 06:11

    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 .

    0 讨论(0)
提交回复
热议问题