Anomaly Detection with the BigML Dashboard

6.5 Consuming Anomaly Scores

You can fully used single and batch anomaly scores via the BigML API and bindings. The following subsections explain both tools.

6.5.1 Using Anomaly Scores Via the BigML API

You can perform all the scores actions explained in this document such as creating, configuring, retrieving, listing, updating, and deleting scores via the BigML API.

The example below shows how to create a batch anomaly score with the definition of the input data after the BIGML_AUTH environment variable that contains your authentication credentials is properly set:

curl "https://bigml.io/batchanomalyscore?$BIGML_AUTH" \
     -X POST \
     -H 'content-type: application/json' \
     -d '{"anomaly": "anomaly/5423625af0a5ea3eea000028",
          "dataset": "dataset/54222a14f0a5eaaab000000c"}'

For more information on using anomaly scores through the BigML API, please refer to anomaly scores REST API documentation.

6.5.2 Using Anomaly Scores Via the BigML bindings

You can also create, configure, retrieve, list, update, and delete single and batch anomaly scores via BigML bindings which are libraries aimed to make it easier to use the BigML API from your language of choice. BigML offers bindings in multiple languages including Python, Node.js Java, Swift and Objective-C. You can find below an example to create an anomaly score with the Python bindings.

from bigml.api import BigML
api = BigML()
prediction = api.create_anomaly_score("anomaly/50650bdf3c19201b64000020",
                                      {"salary": 20000, "age": 25})

For more information on BigML bindings, please refer to the bindings page.