ibm-watson-cognitive Train a custom classifier


Training a custom classifier requires a corpus of images organized into groups. In this example, I have a bunch of images of apples in one ZIP file, a bunch of images of bananas in another ZIP file, and a third group of images of things that are not fruits for a negative set. Once a custom classifier is created, it will be in state training and you'll have to use the classifier ID to check if it is ready (using the 'Get information about a specific custom classifier' example).

'use strict';

let watson = require('watson-developer-cloud');
let fs = require('fs');

var visualRecognition = watson.visual_recognition({
  version: 'v3',
  api_key: process.env.API_KEY,

let custom_classifier = {
  apple_positive_examples: fs.createReadStream('./'),
  banana_positive_examples: fs.createReadStream('./'),
  negative_examples: fs.createReadStream('./'),
  name: 'The Name of My Classifier'

visualRecognition.createClassifier(custom_classifier, function(error, results) {