Hi Andy,

Thank you for the quick response.
I currently using version 0.15.2. Our arrays have dimensions [n_samples, x,
y, z]. Below are the two trace-backs I get for both train_test_split and
GrindSearchCV. They both end at the same line of code.

---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<ipython-input-11-014d4e2c8de5> in <module>()
     16
     17
---> 18 X_train_split, X_test_split, y_train_split, y_test_split =
train_test_split(X, y, test_size=0.5, random_state=3)
     19
     20

/home/david/anaconda/lib/python2.7/site-packages/sklearn/cross_validation.pyc
in train_test_split(*arrays, **options)
   1554         test_size = 0.25
   1555
-> 1556     arrays = check_arrays(*arrays, **options)
   1557     n_samples = _num_samples(arrays[0])
   1558     cv = ShuffleSplit(n_samples, test_size=test_size,

/home/david/anaconda/lib/python2.7/site-packages/sklearn/utils/validation.pyc
in check_arrays(*arrays, **options)
    285             if not allow_nd and array.ndim >= 3:
    286                 raise ValueError("Found array with dim %d. Expected
<= 2" %
--> 287                                  array.ndim)
    288
    289         if copy and array is array_orig:

ValueError: Found array with dim 3. Expected <= 2


---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<ipython-input-13-f0d4cd7e8e51> in <module>()
     29 model = MKSRegressionModel(continuousBasis)
     30 scoring = metrics.make_scorer(lambda a, b: -mse(a, b))
---> 31 gs = GridSearchCV(model, parameters_to_tune, cv=5,
scoring=scoring).fit(X_train, y_train)

/home/david/anaconda/lib/python2.7/site-packages/sklearn/grid_search.pyc in
fit(self, X, y)
    594
    595         """
--> 596         return self._fit(X, y, ParameterGrid(self.param_grid))
    597
    598

/home/david/anaconda/lib/python2.7/site-packages/sklearn/grid_search.pyc in
_fit(self, X, y, parameter_iterable)
    349         n_samples = _num_samples(X)
    350         X, y = check_arrays(X, y, allow_lists=True,
sparse_format='csr',
--> 351                             allow_nans=True)
    352
    353         if y is not None:

/home/david/anaconda/lib/python2.7/site-packages/sklearn/utils/validation.pyc
in check_arrays(*arrays, **options)
    285             if not allow_nd and array.ndim >= 3:
    286                 raise ValueError("Found array with dim %d. Expected
<= 2" %
--> 287                                  array.ndim)
    288
    289         if copy and array is array_orig:

ValueError: Found array with dim 3. Expected <= 2

Thanks,

David

On Thu, Dec 18, 2014 at 1:24 PM, Andy <t3k...@gmail.com> wrote:
>
>  Hi David.
>
> Sorry about the issue you are seeing.
> Which version of scikit-learn are you using, and what are the input types
> and shapes?
>
> I don't think that there are any requirements on the dimensions in current
> master.
> There was a refactoring of input validation that made that a bit tricky
> but I actually tried to remove constraints as much as possible
> in these two places.
>
> Cheers,
> Andy
>
>
> On 12/18/2014 01:11 PM, David Brough wrote:
>
>   Hi,
>
>  I am working on developing a python package that uses machine learning
> speed up the optimization of materials development (pymks.org). This
> package is built on top of sklearn. We have an example in our documentation
> where we have used train_test_split and GridSearchCV to search the
> parameter space (
> http://openmaterials.github.io/pymks/rst/cahn_hilliard_Legendre.html#optimizing-the-number-of-local-states).
>
>
>  This example was working when it was created this summer, but is now
> broken.It seems that the api for these two functions has changed. Why are
> the dimension of the input arrays for both the train_test_split and the
> GridSearchCV checked? It seems like the dimensions of the input arrays are
> irrelevant to those functions.
>
>  Thanks,
>
> David
>
>
> ------------------------------------------------------------------------------
> Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
> from Actuate! Instantly Supercharge Your Business Reports and Dashboards
> with Interactivity, Sharing, Native Excel Exports, App Integration & more
> Get technology previously reserved for billion-dollar corporations, 
> FREEhttp://pubads.g.doubleclick.net/gampad/clk?id=164703151&iu=/4140/ostg.clktrk
>
>
>
> _______________________________________________
> Scikit-learn-general mailing 
> listScikit-learn-general@lists.sourceforge.nethttps://lists.sourceforge.net/lists/listinfo/scikit-learn-general
>
>
>
>
> ------------------------------------------------------------------------------
> Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
> from Actuate! Instantly Supercharge Your Business Reports and Dashboards
> with Interactivity, Sharing, Native Excel Exports, App Integration & more
> Get technology previously reserved for billion-dollar corporations, FREE
>
> http://pubads.g.doubleclick.net/gampad/clk?id=164703151&iu=/4140/ostg.clktrk
> _______________________________________________
> Scikit-learn-general mailing list
> Scikit-learn-general@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/scikit-learn-general
>
>
------------------------------------------------------------------------------
Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
from Actuate! Instantly Supercharge Your Business Reports and Dashboards
with Interactivity, Sharing, Native Excel Exports, App Integration & more
Get technology previously reserved for billion-dollar corporations, FREE
http://pubads.g.doubleclick.net/gampad/clk?id=164703151&iu=/4140/ostg.clktrk
_______________________________________________
Scikit-learn-general mailing list
Scikit-learn-general@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/scikit-learn-general

Reply via email to