Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@

Google Inc.
Anand Suresh
Brett Bergmann
1 change: 1 addition & 0 deletions CONTRIBUTORS
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
# Keep the list alphabetically sorted.

Burcu Dogan <jbd@google.com>
Brett Bergmann <me@brettbergmann.com>
Johan Euphrosine <proppy@google.com>
Marco Ziccardi <marco.ziccard@gmail.com>
Patrick Costello <pcostell@google.com>
Expand Down
5 changes: 4 additions & 1 deletion lib/prediction/model.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
})
Expand Down
1 change: 1 addition & 0 deletions test/prediction/model.js
Original file line number Diff line number Diff line change
Expand Up @@ -459,6 +459,7 @@ describe('Index', function() {
});

delete apiResponseWithValue.outputLabel;
delete apiResponseWithValue.outputMulti;

model.request = function(reqOpts, callback) {
callback(null, apiResponseWithValue);
Expand Down