Hey Fernando,

For my dataset #vectors < #features . It's weird why PCA would do that.
Anyways, thanks for your help. I'll try working around something.

Regards,
Deepak

On Thu, Apr 14, 2016 at 5:57 AM, Fernando J. Iglesias García <
[email protected]> wrote:

> Hi Deepak,
>
> It seems what happens is that Shogun LMNN is asking Shogun PCA to compute
> a transformation of dimension equal to #features (
> https://github.com/shogun-toolbox/shogun/blob/develop/src/shogun/metric/LMNNImpl.cpp#L327)
> while the current Shogun PCA makes a transformation of at most
> min(#features, #vectors) (
> https://github.com/shogun-toolbox/shogun/blob/develop/src/shogun/preprocessor/PCA.cpp#L100).
> So I am concluding that your data is probably #vectors < #features (let me
> know otherwise).
>
> I must dig more in why current Shogun PCA is doing that. Perhaps for the
> moment this can help you to get going further.
>
> Cheers,
> Fernando.
>
> On 13 April 2016 at 15:10, Heiko Strathmann <[email protected]>
> wrote:
>
>> Just wanted to make sure ;)
>> I guess Fernando can help better then
>>
>> 2016-04-12 22:03 GMT+01:00 Deepak Rishi <[email protected]>:
>>
>>> Fernando,
>>>
>>> This particular error only comes when the feature vector dimension size
>>> is more than the number of examples.
>>>
>>>
>>> Regards,
>>> Deepak
>>>
>>> On Tue, Apr 12, 2016 at 5:00 PM, Deepak Rishi <[email protected]>
>>> wrote:
>>>
>>>> Hello Heiko,
>>>>
>>>> Yes, that is taken into account by the metric learn package.
>>>>
>>>>
>>>> Regards,
>>>> Deepak
>>>>
>>>> On Tue, Apr 12, 2016 at 4:48 PM, Heiko Strathmann <
>>>> [email protected]> wrote:
>>>>
>>>>> Reminder: shogun interprets data as column vectors.
>>>>>
>>>>>
>>>>> On Tuesday, 12 April 2016, Deepak Rishi <[email protected]> wrote:
>>>>>
>>>>>> Hey Fernando,
>>>>>>
>>>>>> By setting use_pca=True, I still get the same error.  However,
>>>>>> setting it to False , the program runs. (though very slowly)
>>>>>> If i run the LMNN example from
>>>>>> http://all-umass.github.io/metric-learn/metric_learn.lmnn.html , it
>>>>>> runs fine without even setting the use_pca parameter.
>>>>>>
>>>>>> Would you have any advice on how to circumvent this problem?
>>>>>>
>>>>>> PS: my dataset shape is 500 x 6000.
>>>>>>
>>>>>> Regards,
>>>>>> Deepak
>>>>>>
>>>>>> On Tue, Apr 12, 2016 at 2:38 PM, Fernando J. Iglesias García <
>>>>>> [email protected]> wrote:
>>>>>>
>>>>>>> Hi Deepak,
>>>>>>>
>>>>>>> Then, there might be a problem (i.e. wrong dimension) with the
>>>>>>> matrix passed to initalise LMNN. I suggest you to try setting use_pca to
>>>>>>> True. That will make Shogun's LMNN to start using a matrix obtained by
>>>>>>> applying PCA.
>>>>>>>
>>>>>>> Modifying line 55 in your gist to
>>>>>>>
>>>>>>> lmnn = LMNN(k=3, learn_rate=1e-3, use_pca=True)
>>>>>>>
>>>>>>> should do it.
>>>>>>>
>>>>>>> Let me know how it goes.
>>>>>>>
>>>>>>> Cheers,
>>>>>>> Fernando.
>>>>>>>
>>>>>>> On 12 April 2016 at 18:52, Deepak Rishi <[email protected]> wrote:
>>>>>>>
>>>>>>>> Hi Fernando,
>>>>>>>>
>>>>>>>> The gist is at
>>>>>>>> https://gist.github.com/deerishi/e4ea6257e88ea924cc0fb091a5af1670 .
>>>>>>>>
>>>>>>>> I did not use the parameter use_pca. Nor did I call the PCA
>>>>>>>> function.
>>>>>>>>
>>>>>>>> @Chintak , have you used LMNN before?
>>>>>>>>
>>>>>>>>
>>>>>>>> Regards,
>>>>>>>> Deepak
>>>>>>>>
>>>>>>>> On Tue, Apr 12, 2016 at 4:33 AM, Fernando J. Iglesias García <
>>>>>>>> [email protected]> wrote:
>>>>>>>>
>>>>>>>>> Dear Deepak,
>>>>>>>>>
>>>>>>>>> Can you share in a gist, pastebin, or the like, a snippet with
>>>>>>>>> your relevant code? Particularly at this moment I am interested to 
>>>>>>>>> know
>>>>>>>>> whether you are using the parameter use_pca.
>>>>>>>>>
>>>>>>>>> Cheers,
>>>>>>>>> Fernando.
>>>>>>>>>
>>>>>>>>> On 12 April 2016 at 08:39, Deepak Rishi <[email protected]>
>>>>>>>>> wrote:
>>>>>>>>>
>>>>>>>>>> Hi everyone,
>>>>>>>>>>
>>>>>>>>>> I am using the python package metric_learn
>>>>>>>>>> http://all-umass.github.io/metric-learn/metric_learn.lmnn.html
>>>>>>>>>> for Large Margin Nearest Neighbour. It uses LMNN from Shogun if it is
>>>>>>>>>> installed. Since Shogun has a faster implementation for LMNN I 
>>>>>>>>>> decied to
>>>>>>>>>> use it.
>>>>>>>>>>
>>>>>>>>>> When I run my code for LMNN in python I get the error
>>>>>>>>>> "SystemError: [ERROR] In file
>>>>>>>>>> /home/drishi/shogun-4.1.0/src/shogun/preprocessor/PCA.cpp line 102: 
>>>>>>>>>> target
>>>>>>>>>> dimension should be less or equal to than minimum of N and D
>>>>>>>>>> "
>>>>>>>>>>
>>>>>>>>>> Any advice on why is this error occurring ?
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> Regards,
>>>>>>>>>> Deepak
>>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>
>>>>>>>
>>>>>>
>>>>
>>>
>>
>

Reply via email to