Interesting, I didn't know that!

The problem is not inconsistency - sort without function is consistent - it
always sorts by ALPHABETIC order:
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort

> [2,3,21].sort()
[ 2, 21, 3 ]

So, please add a comment line for the line you wrote.

Thanks,
Erel



On Fri, Nov 29, 2013 at 11:16 AM, vaskonov <notifications@github.com> wrote:

> In classifiers/multilabel/Threshold.js:
>
> > +		
> > +		this.multiclassClassifier.trainBatch(dataset);
> > +
> > +		var scoresVector = [];
> > +
> > +		list_of_scores = [];
> > +
> > +		for (var i=0; i<validset.length; ++i)
> > +		{
> > + 			var scoresVector = this.multiclassClassifier.classify(validset[i].input, false, true);
> > + 			validset[i].score = scoresVector
> > + 			validset[i].output =  multilabelutils.normalizeClasses(validset[i].output);
> > + 			list_of_scores = list_of_scores.concat(multilabelutils.getvalue(scoresVector))
> > + 		}	
> > +
> > +		list_of_scores = _.sortBy(list_of_scores, function(num){ return num; });
>
> good point
> from w3schools: array.sort(sortfunction)
>
> without sortfunction it's inconsistent
>
> for example,
> [1,2,8,3,5,9,3,-2].sort()
> [ -2, 1, 2, 3, 3, 5, 8, 9 ] - asc order
>
> [-4,-67,-1,-2,-6].sort()
> [ -1, -2, -4, -6, -67 ] - desc order
>
> for us it doesn't matter
> I just wanted it to be consistent
>
> If you still prefer sort() let me know, I will change it
>
> —
> Reply to this email directly or view it on GitHub<https://github.com/erelsgl/limdu/pull/3/files#r7997507>
> .
>