shaunbaker / predictionio-node-sdk Goto Github PK
View Code? Open in Web Editor NEWPredictionIO Node SDK
PredictionIO Node SDK
hi, at first thanks for this sdk!
i think using POST for retrieving recommendations is the wrong method according to the documentation (the same for similarity). using POST results in a 404 wich is not detected by the tests as there are no checks for correct statusCodes.
var prediction = require('predictionio')({
key: 'xxx',//add valid key here
baseUrl: 'http://127.0.0.1:8000/'
});
prediction.users.get('nonexistinguserid', function (err, res) {
console.log('err', err);
console.log('res', res);
});
Results in
null
{}
This is because the request is structured as http://127.0.0.1:8000//users/nonexistinguserid.json
with double //
and the response of the server is
{
//...
links: {},
text: 'Your request is not supported.',
body: {},
files: {},
buffered: true,
headers:
{ 'content-type': 'text/plain; charset=utf-8',
'access-control-allow-origin': '',
connection: 'close',
'content-length': '30' },
header:
{ 'content-type': 'text/plain; charset=utf-8',
'access-control-allow-origin': '',
connection: 'close',
'content-length': '30' },
statusCode: 404,
status: 404,
statusType: 4,
info: false,
ok: false,
redirect: false,
clientError: true,
serverError: false,
error:
{ [Error: cannot GET //users/14.json?pio_appkey=xxx (404)]
status: 404,
method: 'GET',
path: '//users/14.json?pio_appkey=xxx'
}
//...
}
any improvement in the near future for node.js in the docs online? noticed md file has some information but surprised to not see it online.
A couple of things...
Your documentation here https://github.com/ShaunBaker/PredictionIO-Node-SDK/blob/master/DOCS.md#fetch-user-recommendations
Is missing the pio_engine param. This is required and I didn't realize this until I used the call back method.
Which leads to the second issue, is there .then().catch() support? I see that on the items.recommendation function if there's an error you call defer.reject(err). That stops the process, but the error message is not accessible. Whats the best way to handle errors when using the promise approach?
There is a new version of PredictionIO, 0.8, with a complete new API.
This module no longer works with that version.
Thank you for your great work!
Do you expect this repository to become the 'official' PredictionIO Node SDK?
Kind of annoying to have to take sane data and run it through a prefixer, then run data that comes back through a prefix removal fn. Why does predictionIO do this? I've never seen anything like it in other dbs
/Users/joaoribeiro/Documents/Projects/imoglobe/node_modules/predictionio/lib/items.js:26
deferred.resolve(res.body)
^
TypeError: Cannot read property 'body' of undefined
at /Users/joaoribeiro/Documents/Projects/imoglobe/node_modules/predictionio/lib/items.js:26:29
at Request.callback (/Users/joaoribeiro/Documents/Projects/imoglobe/node_modules/predictionio/node_modules/superagent/lib/node/index.js:628:30)
at ClientRequest.<anonymous> (/Users/joaoribeiro/Documents/Projects/imoglobe/node_modules/predictionio/node_modules/superagent/lib/node/index.js:596:10)
at ClientRequest.EventEmitter.emit (events.js:95:17)
at Socket.socketErrorListener (http.js:1547:9)
at Socket.EventEmitter.emit (events.js:95:17)
at net.js:441:14
at process._tickCallback (node.js:415:13)
[nodemon] app crashed - waiting for file changes before starting...
Hi,
Thanks for starting this project.
I did a npm install for this SDK couple of days back and the version I have is 0.0.4.The implementation of prediction.items.similarity takes in parameter for pio_uid. However, as per the PredictionIO API endpoint specs, this should be pio_iid.
Can you please confirm?
Thanks,
Prakash
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.