I assume you have checked that combine_train_test_dataset produces data of
the correct dimensions in both X and y.

I would be very surprised if the problem were not in PAA, so check it
again: make sure that you test that PAA().fit(X1).transform(X2) gives the
transformation of X2. The error seems to suggest it is returning an array
of X1's size.

On 28 April 2015 at 05:11, Jitesh Khandelwal <jk231...@gmail.com> wrote:

> Hi Andreas,
>
> Thanks for your response.
>
> No, PAA does not change the number of samples. It just reduces the number
> of features.
>
> For example if the input matrix is X and X.shape = (100, 100) and the
> n_components = 10 in PAA, then the resultant X.shape = (100, 10).
>
> Yes, I did try using PAA in the ipython shell (without the grid search) on
> the same dataset and it does the transformation as expected.
>
> Another interesting observation is that the dataset that I have used in
> the code has dimensions (56, 256) and also 37 + 19 = 56. Does this provide
> any insight about the error?
>
>
> [image: --]
> Jitesh Khandelwal
> <http://about.me/jitesh.khandelwal?promo=email_sig>
> [image: http://]about.me/jitesh.khandelwal
> <http://about.me/jitesh.khandelwal?promo=email_sig>
>
>
> On Tue, Apr 28, 2015 at 12:26 AM, Andreas Mueller <t3k...@gmail.com>
> wrote:
>
>>  Does PAA by any chance change the number of samples?
>> The error is:
>> ValueError: Found array with dim 37. Expected 19
>>
>> Interestingly that happens only in the scoring.
>>
>> Does it work without the grid-search?
>>
>>
>>
>> On 04/27/2015 07:14 AM, Jitesh Khandelwal wrote:
>>
>>  Hi all,
>>
>>  I am trying to use grid search to evaluate some decomposition
>> techniques of my own. I have implemented some custom transformers such as
>> PAA, DFT, DWT as shown in the code below.
>>
>>  I am getting a strange "ValueError" when run the below code and I am
>> unable to figure out the origin of the problem.
>>
>>  I have pasted the code below and attached the error log file.
>>
>>  Any suggestions on how can I move forward from here would be helpful.
>>
>>  Thanks.
>>
>>  Code:
>> =======================================================
>>  from sklearn.pipeline import Pipeline
>> from sklearn.grid_search import GridSearchCV
>> from sklearn.neighbors import KNeighborsClassifier
>>
>>  from time_series.decomposition import PAA, DFT, DWT, ShapeX
>> from prepare_data import combine_train_test_dataset
>>
>>  knn = KNeighborsClassifier()
>> paa = PAA()
>>
>>  pipe = Pipeline([
>>     ('paa', paa),
>>     ('knn', knn)
>> ])
>>
>>  n_components = [1,2,4,5,10,20,40]
>> n_neighbors = range(1,11)
>> metrics = ['euclidean']
>>
>>  datadir = "../keogh_datasets/Coffee"
>> X,y = combine_train_test_dataset(datadir)
>>
>>  model_tunning = GridSearchCV(pipe, {
>>         'paa__n_components': n_components,
>>         'knn__n_neighbors': n_neighbors,
>>         'knn__metric': metrics,
>>     },
>>     n_jobs=-1)
>>
>>  model_tunning.fit(X,y)
>>
>>  print model_tunning.best_score_
>> print model_tunning.best_params_
>> =======================================================
>>
>>
>>
>> ------------------------------------------------------------------------------
>> One dashboard for servers and applications across Physical-Virtual-Cloud
>> Widest out-of-the-box monitoring support with 50+ applications
>> Performance metrics, stats and reports that give you Actionable Insights
>> Deep dive visibility with transaction tracing using APM 
>> Insight.http://ad.doubleclick.net/ddm/clk/290420510;117567292;y
>>
>>
>>
>> _______________________________________________
>> Scikit-learn-general mailing 
>> listScikit-learn-general@lists.sourceforge.nethttps://lists.sourceforge.net/lists/listinfo/scikit-learn-general
>>
>>
>>
>>
>> ------------------------------------------------------------------------------
>> One dashboard for servers and applications across Physical-Virtual-Cloud
>> Widest out-of-the-box monitoring support with 50+ applications
>> Performance metrics, stats and reports that give you Actionable Insights
>> Deep dive visibility with transaction tracing using APM Insight.
>> http://ad.doubleclick.net/ddm/clk/290420510;117567292;y
>> _______________________________________________
>> Scikit-learn-general mailing list
>> Scikit-learn-general@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/scikit-learn-general
>>
>>
>
>
> ------------------------------------------------------------------------------
> One dashboard for servers and applications across Physical-Virtual-Cloud
> Widest out-of-the-box monitoring support with 50+ applications
> Performance metrics, stats and reports that give you Actionable Insights
> Deep dive visibility with transaction tracing using APM Insight.
> http://ad.doubleclick.net/ddm/clk/290420510;117567292;y
> _______________________________________________
> Scikit-learn-general mailing list
> Scikit-learn-general@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/scikit-learn-general
>
>
------------------------------------------------------------------------------
One dashboard for servers and applications across Physical-Virtual-Cloud 
Widest out-of-the-box monitoring support with 50+ applications
Performance metrics, stats and reports that give you Actionable Insights
Deep dive visibility with transaction tracing using APM Insight.
http://ad.doubleclick.net/ddm/clk/290420510;117567292;y
_______________________________________________
Scikit-learn-general mailing list
Scikit-learn-general@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/scikit-learn-general

Reply via email to