> Hi Nelle, > > Thanks for your answer! In the MDS code, the precision is hard-wired to: > > res = 100 * np.finfo(np.float).resolution > > So I cannot change the precision without modifying the source. If I do > modify the source code, and lower the precision to 1e-8, I'm able to run MDS > successfully (yay!). > > As I mentioned in my email, my distance matrix was computed with sklearn, > which is precise up to 1e-9. I think the problem lies on MDS expecting > unrealistic high precisions in the distance matrix.
That's correct. When I wrote this piece of code, I used a similarity matrix which wasn't computed using sklearn, hence I didn't have the problem (and this also helped me spot some preprocessing problems in a paper :p). Could you provide a patch ? Thanks, N > > Best, > Jose > > > > > -- > José P. González-Brenes, Ph.D. > www.josepablogonzalez.com > > > > On Wed, Dec 11, 2013 at 6:13 PM, Nelle Varoquaux <[email protected]> > wrote: >> >> On 11 December 2013 23:30, José Pablo González <[email protected]> >> wrote: >> > Hello, >> > >> > I am new in sklearn, but so far I'm impressed. I think it is a great >> > library! >> > >> > I think I found a little bug in the Multidimensional Scaling Function. >> > It >> > expects "perfect" similarity matrices, which it's often not possible >> > with >> > real data. Moreover, sklearn's functions are unable to get the expected >> > precision. >> > >> > For example if I use sklearn to computea similarity matrix of euclidean >> > distances: >> > >> > similarities = euclidean_distances(data) >> > print np.abs(similarities - similarities.T).max() >> > # this outputs 5.26835606386e-09, which I'd it's precise enough >> > >> > >> > Unfortunately, when I try to calculate MDS: >> > mds = manifold.MDS(n_components=2, dissimilarity="precomputed", >> > n_jobs=1) >> > pos = mds.fit(similarities) >> > >> > I get a precision error. I have already tried casting to float64 as >> > suggested here, but it doesn't work either. There's no way to change >> > the >> > precision of this, only the convergence precision. >> > >> > Am I overlooking at something? >> >> Nope, this is indeed a problem from the MDS code. You can provide a >> fix for this by raising the precision required. >> Also, depending on the algorithm used to solve the MDS, a symmetric >> matrix should or shouldn't be required. I think in the case of the >> SMACOF algorithm (currently used in sklearn), it isn't even required. >> Someone should have a look at the litterature to check this (I should >> be able to in a couple of weeks). >> >> Cheers, >> N >> >> > >> > Thanks, >> > Jose >> > >> > >> > -- >> > José P. González-Brenes, Ph.D. >> > www.josepablogonzalez.com >> > >> > >> > >> > >> > ------------------------------------------------------------------------------ >> > Rapidly troubleshoot problems before they affect your business. Most IT >> > organizations don't have a clear picture of how application performance >> > affects their revenue. With AppDynamics, you get 100% visibility into >> > your >> > Java,.NET, & PHP application. Start your 15-day FREE TRIAL of >> > AppDynamics >> > Pro! >> > >> > http://pubads.g.doubleclick.net/gampad/clk?id=84349831&iu=/4140/ostg.clktrk >> > _______________________________________________ >> > Scikit-learn-general mailing list >> > [email protected] >> > https://lists.sourceforge.net/lists/listinfo/scikit-learn-general >> > >> >> >> ------------------------------------------------------------------------------ >> Rapidly troubleshoot problems before they affect your business. Most IT >> organizations don't have a clear picture of how application performance >> affects their revenue. With AppDynamics, you get 100% visibility into your >> Java,.NET, & PHP application. Start your 15-day FREE TRIAL of AppDynamics >> Pro! >> >> http://pubads.g.doubleclick.net/gampad/clk?id=84349831&iu=/4140/ostg.clktrk >> _______________________________________________ >> Scikit-learn-general mailing list >> [email protected] >> https://lists.sourceforge.net/lists/listinfo/scikit-learn-general > > > > ------------------------------------------------------------------------------ > Rapidly troubleshoot problems before they affect your business. Most IT > organizations don't have a clear picture of how application performance > affects their revenue. With AppDynamics, you get 100% visibility into your > Java,.NET, & PHP application. Start your 15-day FREE TRIAL of AppDynamics > Pro! > http://pubads.g.doubleclick.net/gampad/clk?id=84349831&iu=/4140/ostg.clktrk > _______________________________________________ > Scikit-learn-general mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/scikit-learn-general > ------------------------------------------------------------------------------ Rapidly troubleshoot problems before they affect your business. Most IT organizations don't have a clear picture of how application performance affects their revenue. With AppDynamics, you get 100% visibility into your Java,.NET, & PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro! http://pubads.g.doubleclick.net/gampad/clk?id=84349831&iu=/4140/ostg.clktrk _______________________________________________ Scikit-learn-general mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/scikit-learn-general
