[scikit-learn] GridsearchCV

Sebastian Raschka se.raschka at gmail.com
Thu Mar 16 00:30:44 EDT 2017


Sklearn estimators typically assume 2d inputs (as numpy arrays) with shape=[n_samples, n_features]. 

> list of Np.ndarrays of shape (6,3,3)

I assume you mean a 3D tensor (3D numpy array) with shape=[n_samples, n_pixels, n_pixels]? What you could do is to reshape it before you put it in, i.e., 

data_ary = your_ary.reshape(n_samples, -1).shape

then, you need to add a line at the beginning your CNN class that does the reverse, i.e., data_ary.reshape(6, n_pixels, n_pixels).shape. Numpy’s reshape typically returns view objects, so that these additional steps shouldn’t be “too” expensive.

Best,
Sebastian



> On Mar 16, 2017, at 12:00 AM, Carlton Banks <noflaco at gmail.com> wrote:
> 
> Hi… 
> 
> I currently trying to optimize my CNN model using gridsearchCV, but seem to have some problems feading my input data.. 
> 
> My training data is stored as a list of Np.ndarrays of shape (6,3,3) and my output is stored as a list of np.array with one entry. 
> 
> Why am I having problems parsing my data to it?
> 
> best regards 
> Carl B. 
> _______________________________________________
> scikit-learn mailing list
> scikit-learn at python.org
> https://mail.python.org/mailman/listinfo/scikit-learn



More information about the scikit-learn mailing list