# @coda/ml

# gmmTrain

 gmmTrain(options: Object, source: Stream): Stream

Train a Gaussian Mixture Model for recognition from a stream of recording events.

WARNING

The XMM Training operators (gmmTrain, hmmTrain, hhmmTrain) use a web worker for training. Make sure to copy the file @coda/ml/dist/xmm.worker.js to the root of your application.

Parameter Type Default Description
options Object {} Training parameters
options.gaussians Number 3 Number of gaussian components
options.regularizationAbs Number 0.01 Absolute regularization
options.regularizationRel Number 0.1 Relative regularization
options.covarianceMode String 'full' Type of covariance matrix
source Stream Source stream (recording events)

Returns Stream Stream of model parameters

Example

// Generate a smooth random signal
a = periodic(20)
.rand({ size: 2 })
.biquad({ f0: 2 })
.plot({ legend: 'Data Stream' });

// Setup a data recorder
b = a.recorder({ name: 'data' });

// Dynamically train when changes occur in the recorder
model = b.gmmTrain({ gaussians: 3 });

// Perform real-time recognition
c = a.gmmPredict({ model })
  .plot({ fill: 'bottom', stacked: true, legend: 'GMM-based recognition' });

# gmmPredict

 gmmPredict(options: Object, source: Stream): Stream

Real-time recognition using GMMsThe operator applies to the same data stream as the one used for training, and the model
parameters should be passed as a stream (model argument) generated by the gmmTrain
operator.

TODO

More details here...

Parameter Type Default Description
options Object {} Recognizer options
options.model Stream null Stream of model parameters obtained through
<a
  href="/ api / gmmTrain"
  target=""
>
  gmmTrain
</a>.|

|options.likelihoodWindow|string|1|Size of the likelihood smoothing window| |options.output|string|'smoothedLogLikelihoods'|Type of output data.| |source|Stream||input data stream| Returns Stream

Example

// Generate a smooth random signal
a = periodic(20)
.rand({ size: 2 })
.biquad({ f0: 2 })
.plot({ legend: 'Data Stream' });

// Setup a data recorder
b = a.recorder({ name: 'data' });

// Dynamically train when changes occur in the recorder
model = b.gmmTrain({ gaussians: 3 });

// Perform real-time recognition
c = a.gmmPredict({ model })
  .plot({ fill: 'bottom', stacked: true, legend: 'GMM-based recognition' });

# hmmTrain

 hmmTrain(options: Object, source: Stream): Stream

Train a Hidden Markov Model for recognition from a stream of recording events

WARNING

The XMM Training operators (gmmTrain, hmmTrain, hhmmTrain) use a web worker for training. Make sure to copy the file @coda/ml/dist/xmm.worker.js to the root of your application.

Parameter Type Default Description
options Object {} Training parameters
options.states Number 5 Number of hidden states
options.gaussians Number 1 Number of gaussian components per state
options.regularizationAbs Number 0.01 Absolute regularization
options.regularizationRel Number 0.1 Relative regularization
options.covarianceMode String 'full' Type of covariance matrix
source Stream Source stream (recording events)

Returns Stream Stream of model parameters

Example

// Generate a smooth random signal
a = periodic(20)
.rand({ size: 2 })
.biquad({ f0: 2 })
.plot({ legend: 'Data Stream' });

// Setup a data recorder
b = a.recorder({ name: 'data' });

// Dynamically train when changes occur in the recorder
model = b.hmmTrain({ states: 5 });

// Perform real-time recognition
c = a.hmmPredict({ model })
  .plot({ fill: 'bottom', stacked: true, legend: 'HMM-based recognition' });

# hmmPredict

 hmmPredict(options: Object, source: Stream): Stream

Real-time recognition using HMMsThe operator applies to the same data stream as the one used for training, and the model
parameters should be passed as a stream (model argument) generated by the hmmTrain
operator.

TODO

More details here...

Parameter Type Default Description
options Object {} Recognizer options
options.model Stream null Stream of model parameters obtained through
<a
  href="/ api / hmmTrain"
  target=""
>
  hmmTrain
</a>.|

|options.likelihoodWindow|string|1|Size of the likelihood smoothing window| |options.output|string|'smoothedLogLikelihoods'|Type of output data.| |source|Stream||input data stream| Returns Stream

Example

// Generate a smooth random signal
a = periodic(20)
.rand({ size: 2 })
.biquad({ f0: 2 })
.plot({ legend: 'Data Stream' });

// Setup a data recorder
b = a.recorder({ name: 'data' });

// Dynamically train when changes occur in the recorder
model = b.hmmTrain({ states: 5 });

// Perform real-time recognition
c = a.hmmPredict({ model })
  .plot({ fill: 'bottom', stacked: true, legend: 'HMM-based recognition' });

# hhmmTrain

 hhmmTrain(options: Object, source: Stream): Stream

Train a Hierarchical Hidden Markov Model for recognition from a stream of recording events.

WARNING

The XMM Training operators (gmmTrain, hmmTrain, hhmmTrain) use a web worker for training. Make sure to copy the file @coda/ml/dist/xmm.worker.js to the root of your application.

Parameter Type Default Description
options Object {} Training parameters
options.states Number 5 Number of hidden states
options.gaussians Number 1 Number of gaussian components per state
options.regularizationAbs Number 0.01 Absolute regularization
options.regularizationRel Number 0.1 Relative regularization
options.covarianceMode String 'full' Type of covariance matrix
source Stream Source stream (recording events)

Returns Stream Stream of model parameters

Example

// Generate a smooth random signal
a = periodic(20)
.rand({ size: 2 })
.biquad({ f0: 2 })
.plot({ legend: 'Data Stream' });

// Setup a data recorder
b = a.recorder({ name: 'data' });

// Dynamically train when changes occur in the recorder
model = b.hhmmTrain({ states: 5 });

// Perform real-time recognition
c = a.hhmmPredict({ model })
  .plot({ fill: 'bottom', stacked: true, legend: 'HMM-based recognition' });

# hhmmPredict

 hhmmPredict(options: Object, source: Stream): Stream

Real-time recognition using Hierarchical HMMsThe operator applies to the same data stream as the one used for training, and the model
parameters should be passed as a stream (model argument) generated by the hhmmTrain
operator.

TODO

More details here...

Parameter Type Default Description
options Object {} Recognizer options
options.model Stream null Stream of model parameters obtained through
<a
  href="/ api / hhmmTrain"
  target=""
>
  hhmmTrain
</a>.|

|options.likelihoodWindow|string|1|Size of the likelihood smoothing window| |options.output|string|'smoothedLogLikelihoods'|Type of output data.| |source|Stream||input data stream| Returns Stream

Example

// Generate a smooth random signal
a = periodic(20)
.rand({ size: 2 })
.biquad({ f0: 2 })
.plot({ legend: 'Data Stream' });

// Setup a data recorder
b = a.recorder({ name: 'data' });

// Dynamically train when changes occur in the recorder
model = b.hhmmTrain({ states: 5 });

// Perform real-time recognition
c = a.hhmmPredict({ model })
  .plot({ fill: 'bottom', stacked: true, legend: 'HMM-based recognition' });

# pcaTrain

 pcaTrain(source: Stream): Stream

Estimate Principal Component Analysis from a set of recordings

Parameter Type Default Description
source Stream Recorder source

Returns Stream

# pcaPredict

 pcaPredict(pcaParamStream: Stream, source: Stream): Stream

Compute real-time PCA projection from a data stream.

Parameter Type Default Description
pcaParamStream Stream PCA Parameter stream (from pcaTrain)
source Stream input data stream

Returns Stream

# scaleTrain

 scaleTrain(source: Stream): Stream

Return the extremum values of a recorder stream

Parameter Type Default Description
source Stream Recorder source

Returns Stream Scalar stream (WHAT ?????? {"type":"linkReference","identifier":"min, max","referenceType":"shortcut","children":[{"type":"text","value":"min, max","position":{"start":{"line":1,"column":17,"offset":16},"end":{"line":1,"column":25,"offset":24},"indent":[]}}],"position":{"start":{"line":1,"column":16,"offset":15},"end":{"line":1,"column":26,"offset":25},"indent":[]}})

# scalePredict

 scalePredict(minmaxstream: Stream, source: Stream): Stream

Compute real-time scaling from a data stream.

Parameter Type Default Description
minmaxstream Stream stream of extremum values (from scaleTrain)
source Stream input data stream

Returns Stream