Quickstart
Get up and running with the Akkio API quickly using one of our convenient libraries.
Node.js
Python

Installation

npm install akkio --save

Usage

1
const akkio = require('akkio')('your API key');
2
// get your API key at https://app.akk.io/team-settings
3
4
5
(async () => {
6
// create a new dataset
7
let newDataset = await akkio.createDataset('my new dataset');
8
9
// populate it with some toy data
10
let rows = [];
11
for (var i = 0; i < 1000; i++) {
12
let x = Math.random();
13
rows.push({
14
'x': x,
15
'value larger than 0.5': x > 0.5,
16
});
17
}
18
await akkio.addRowsToDataset(newDataset.dataset_id, rows);
19
20
// train a model
21
let model = await akkio.createModel(newDataset.dataset_id, ['value larger than 0.5'], [], {
22
duration: 1
23
});
24
25
// field importance
26
for (let field in model.field_importance) {
27
console.log('field:', field, 'importance:', model.field_importance[field]);
28
}
29
30
// model stats
31
for (let field of model.stats) {
32
for (let outcome of field) {
33
console.log(outcome);
34
}
35
}
36
37
// use the trained model to make predictions
38
let predictions = await akkio.makePrediction(model.model_id, [{
39
'x': 0.25
40
}, {
41
'x': 0.75
42
}], {
43
explain: true
44
});
45
console.log(predictions);
46
47
})();
Copied!
Installation
pip install akkio

Usage

1
import akkio
2
akkio.api_key = 'YOUR-API-KEY-HERE'
3
# get your API key at https://app.akk.io/team-settings
4
5
models = akkio.get_models()['models']
6
for model in models:
7
print(model)
8
9
datasets = akkio.get_datasets()['datasets']
10
for dataset in datasets:
11
print(dataset)
12
13
new_dataset = akkio.create_dataset('python api test')
14
print(new_dataset)
15
16
# create a toy dataset
17
import random
18
rows = []
19
for i in range(1000):
20
rows.append({
21
'x': random.random()
22
})
23
rows[-1]['y'] = rows[-1]['x'] > 0.5
24
25
akkio.add_rows_to_dataset(new_dataset['dataset_id'], rows)
26
27
new_model = akkio.create_model(new_dataset['dataset_id'], ['y'], [], {'duration': 1})
28
print(new_model)
29
prediction = akkio.make_prediction(new_model['model_id'], [{'x': 0.1}, {'x':0.7}], explain=True)
30
print(prediction)
Copied!
Last modified 8mo ago
Copy link