Class: Example

Example

Class that represents a training example (e.g. time serie of vectors that represents a gesture). If no parameters are given, the dimensions will be guessed from the first added element after instantiation of the class and after each call to clear. If parameters are given, they will be used to strictly check any new element, anytime.

Constructor

new Example(inputDimensionopt, outputDimensionopt)

Parameters:
Name Type Attributes Default Description
inputDimension Number <optional>
null

If defined, definitive input dimension that will be checked to validate any new element added.

outputDimension Number <optional>
null

If defined, definitive output dimension that will be checked to validate any new element added.

Source:
Example
import * as mano from 'mano-js/client';

const example = new mano.Example();
const trainingSet = new mano.TrainingSet();

example.setLabel('test');
example.addElement([0, 1, 2, 3]);
const rapidMixJsonExample = example.toJSON();

trainingSet.addExample(rapidMixJsonExample);

Methods

addElement(inputVector, outputVectoropt)

Add an element to the current example.

Parameters:
Name Type Attributes Default Description
inputVector Array.Number | Float32Array | Float64Array

The input part of the element to add.

outputVector Array.Number | Float32Array | Float64Array <optional>
null

The output part of the element to add.

Source:
Throws:

An error if inputVector or outputVector dimensions mismatch.

clear()

Clear the internal variables so that we are ready to record a new example.

Source:

setLabel(label)

Set the example's current label.

Parameters:
Name Type Description
label String

The new label to assign to the class.

Source:

toJSON() → {Object}

Get the example in rapid-mix JSON format.

Source:
Returns:

A rapid-mix compliant example object.

Type
Object