Hello again, Since I need this now, I used the ``unique`` ideia by Andreas to fix locally, works perfectly. Should I still issue the pull request? Or are you going to do this Andreas?
-- Flavio On Wed, Oct 3, 2012 at 5:25 AM, Andreas Mueller <[email protected]> wrote: > Hi Flavio and Alex. > I think this should be fixed with ``unique`` which will make the code > easier and more general. > I'll fix it in a second, I have the commit that does it lying around > somewhere. > Cheers, > Andy > > On 10/03/2012 08:35 AM, Alexandre Gramfort wrote: >> hi Flavio, >> >> thanks for reporting the problem. Could you send us a pull request via github >> so we fix this easily? >> >> For guidelines see: >> >> http://scikit-learn.org/stable/developers/index.html >> >> best, >> Alex >> >> >> >> On Wed, Oct 3, 2012 at 12:52 AM, Flavio Vinicius <[email protected]> wrote: >>> Hello, >>> >>> Apparently there is a bug at: >>> >>> https://github.com/scikit-learn/scikit-learn/blob/master/sklearn/neighbors/classification.py >>> >>> The bug appears to be related to this commit >>> >>> https://github.com/scikit-learn/scikit-learn/commit/1af8520ecc042b1924aebb56745b663516e4a59b >>> >>> Basically, line 172 which does: >>> >>> pred_indices = pred_labels.copy() >>> >>> Creates pred_indices as a float array. This breaks indexing, since >>> integer arrays are required by numpy. Line 180 uses pred_indices to >>> index another array >>> >>> I don't really understand why this needs to be a copy, since all >>> indices will be overwritten in the loop right after it. With a change >>> to: >>> >>> pred_indices = np.array(pred_labels.shape, dtype='i') >>> >>> Everything works. >>> >>> The method appears to be unit tested. It may be related to passing >>> float arrays as labels, which I do (for no particular reason, just >>> loaded it up like this). >>> >>> -- >>> Flavio >>> >>> ------------------------------------------------------------------------------ >>> Don't let slow site performance ruin your business. Deploy New Relic APM >>> Deploy New Relic app performance management and know exactly >>> what is happening inside your Ruby, Python, PHP, Java, and .NET app >>> Try New Relic at no cost today and get our sweet Data Nerd shirt too! >>> http://p.sf.net/sfu/newrelic-dev2dev >>> _______________________________________________ >>> Scikit-learn-general mailing list >>> [email protected] >>> https://lists.sourceforge.net/lists/listinfo/scikit-learn-general >> ------------------------------------------------------------------------------ >> Don't let slow site performance ruin your business. Deploy New Relic APM >> Deploy New Relic app performance management and know exactly >> what is happening inside your Ruby, Python, PHP, Java, and .NET app >> Try New Relic at no cost today and get our sweet Data Nerd shirt too! >> http://p.sf.net/sfu/newrelic-dev2dev >> _______________________________________________ >> Scikit-learn-general mailing list >> [email protected] >> https://lists.sourceforge.net/lists/listinfo/scikit-learn-general > > > ------------------------------------------------------------------------------ > Don't let slow site performance ruin your business. Deploy New Relic APM > Deploy New Relic app performance management and know exactly > what is happening inside your Ruby, Python, PHP, Java, and .NET app > Try New Relic at no cost today and get our sweet Data Nerd shirt too! > http://p.sf.net/sfu/newrelic-dev2dev > _______________________________________________ > Scikit-learn-general mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/scikit-learn-general ------------------------------------------------------------------------------ Don't let slow site performance ruin your business. Deploy New Relic APM Deploy New Relic app performance management and know exactly what is happening inside your Ruby, Python, PHP, Java, and .NET app Try New Relic at no cost today and get our sweet Data Nerd shirt too! http://p.sf.net/sfu/newrelic-dev2dev _______________________________________________ Scikit-learn-general mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/scikit-learn-general
