diff --git a/AUTHORS b/AUTHORS index 4f1a9fdc3fc..7ac622c350e 100644 --- a/AUTHORS +++ b/AUTHORS @@ -8,3 +8,4 @@ Google Inc. Anand Suresh +Brett Bergmann diff --git a/CONTRIBUTORS b/CONTRIBUTORS index 9e8cf519004..ed19363b12a 100644 --- a/CONTRIBUTORS +++ b/CONTRIBUTORS @@ -12,6 +12,7 @@ # Keep the list alphabetically sorted. Burcu Dogan +Brett Bergmann Johan Euphrosine Marco Ziccardi Patrick Costello diff --git a/lib/prediction/model.js b/lib/prediction/model.js index ebb6bc90e77..758c2b623ec 100644 --- a/lib/prediction/model.js +++ b/lib/prediction/model.js @@ -347,7 +347,10 @@ Model.prototype.query = function(input, callback) { var results = { winner: resp.outputLabel || resp.outputValue, - scores: resp.outputMulti + }; + + if (resp.outputMulti){ + results.scores = resp.outputMulti .sort(function(a, b) { return a.score < b.score ? 1 : a.score > b.score ? -1 : 0; }) diff --git a/test/prediction/model.js b/test/prediction/model.js index 6e65b324171..48add95d8cd 100644 --- a/test/prediction/model.js +++ b/test/prediction/model.js @@ -459,6 +459,7 @@ describe('Index', function() { }); delete apiResponseWithValue.outputLabel; + delete apiResponseWithValue.outputMulti; model.request = function(reqOpts, callback) { callback(null, apiResponseWithValue);