1.0.6 • Published 5 years ago

datarobot-ai v1.0.6

Weekly downloads
5
License
Apache-2.0
Repository
github
Last release
5 years ago

DataRobot AI 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 datarobot-ai
# or with yarn
$ yarn add datarobot-ai

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.

Get your API key at developers.datarobot.com

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 DATAROBOTAI_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 DataRobotAIClient = require('datarobot-ai');
const dr = new DataRobotAIClient({ key: 'fill-in-key-here' });

Once you have created the client, you can start to use it.

Basic Use

It only takes a couple calls to create a model, and then one more to get your predictions using DataRobot AI. Most of the operations in the API return a Promise and can be awaited or use callbacks with then and catch.

// create your AI
const ai = await dr.ais.create('Hello DataRobot');

//upload your dataset and learn now to predict the 'profit' column
await ai.learn('profit', '/path/to/data.csv');

// get predictions for the features from the file 'more-data.csv'
// the `predictions` results will predict the 'profit' values
const predictions = await ai.predict('profit', '/path/to/more-data.csv');

For more examples and information about the DataRobot AI API, see developers.datarobot.com/learn/clients/javascript

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.