README
DragonPanda API Client Library
Installation
This API client library is hosted on npm
and able to be installed using npm
or yarn
.
# with npm
$ npm install dragonpanda-api-client
# or with yarn
$ yarn add dragonpanda-api-client
The library is intended to be used only with node
at this time. You must provide it with an
API key and adding it to a web application would expose your API key to the world. There are
plans to make the API work with JWT for future use in web applications.
Getting Started
The first step in working with the client is creating a new instance of it. But first you need your API key. Once you have a key, you can provide it to the client either through an environment variable named DRAGONPANDA_API_KEY or directly in the source code when creating the client.
Either import
or require()
can be used to integrate the library with your code. The following
sample shows the usage with require
. In either case, once imported you need to create a new
client.
const DragonPandaClient = require('dragonpanada-api-client').default
const ai = new DragonPandaClient({ key: 'fill-in-key-here' });
Once you have created the client, you can start to use it.
Basic Use
It only take one call to create a model, and then one more to get your predictions using the
Dragon Panda client. Most of the operations in the API return a Promise
and can be await
ed or
use callbacks with then
and catch
.
// model the 'profit' column from the file 'data.csv'
const model = await ai.fit('/path/to/data.csv', 'profit');
// get predictions from the model with the file 'more-data.csv'
// the `predictions` results will predict the 'profit' values
const predictions = await ai.predict(model.id, '/path/to/more-data.csv');
Errors
Errors will be propagated back to the user either as exceptions when using await
, or as a reject
or catch
function of the promise.
Feedback
If you have client library feedback, the best way to reach us is in the forum: http://forum.staging.dragonpanda.net/c/client-libraries
If you find a bug, please file an issue: https://github.com/datarobot/dragonpandaclient-js/issues/new
Development
Fork the repository and send a pull request.