gaussianMixture
Advanced tools
Comparing version 0.5.0 to 0.5.1
@@ -107,3 +107,3 @@ 'use strict'; | ||
// If there is a separation prior: | ||
if (this.options.separationPrior && this.options.priorRelevance) { | ||
if (this.options.separationPrior && this.options.separationPriorRelevance) { | ||
var separationPrior = this.options.separationPrior; | ||
@@ -114,3 +114,3 @@ var priorMeans = _.range(this.nComponents).map(function (a) { return (a * separationPrior); }); | ||
for (k = 0; k < this.nComponents; k++) { | ||
alpha = this.weights[k] / (this.weights[k] + this.options.priorRelevance); | ||
alpha = this.weights[k] / (this.weights[k] + this.options.separationPriorRelevance); | ||
this.means[k] = center + alpha * (this.means[k] - center) + (1 - alpha) * (priorMeans[k] - priorCenter); | ||
@@ -128,4 +128,4 @@ } | ||
// If there is a variance prior: | ||
if (this.options.variancePrior && this.options.priorRelevance) { | ||
alpha = this.weights[k] / (this.weights[k] + this.options.priorRelevance); | ||
if (this.options.variancePrior && this.options.variancePriorRelevance) { | ||
alpha = this.weights[k] / (this.weights[k] + this.options.variancePriorRelevance); | ||
this.vars[k] = alpha * this.vars[k] + (1 - alpha) * this.options.variancePrior; | ||
@@ -132,0 +132,0 @@ } |
{ | ||
"name": "gaussianMixture", | ||
"version": "0.5.0", | ||
"version": "0.5.1", | ||
"description": "An implementation of a Gaussian Mixture class in one dimension, that allows to fit models with an Expectation Maximization algorithm.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -111,11 +111,11 @@ 'use strict'; | ||
variancePrior: 3, | ||
priorRelevance: 0.01 | ||
variancePriorRelevance: 0.01 | ||
}; | ||
var options2 = { | ||
variancePrior: 3, | ||
priorRelevance: 1 | ||
variancePriorRelevance: 1 | ||
}; | ||
var options3 = { | ||
variancePrior: 3, | ||
priorRelevance: 1000000 | ||
variancePriorRelevance: 1000000 | ||
}; | ||
@@ -140,11 +140,11 @@ var gmm = new GMM(3, undefined, [-1, 13, 25], [1, 1, 1], options); | ||
separationPrior: 3, | ||
priorRelevance: 0.01 | ||
separationPriorRelevance: 0.01 | ||
}; | ||
var options2 = { | ||
separationPrior: 3, | ||
priorRelevance: 1 | ||
separationPriorRelevance: 1 | ||
}; | ||
var options3 = { | ||
separationPrior: 3, | ||
priorRelevance: 1000000 | ||
separationPriorRelevance: 1000000 | ||
}; | ||
@@ -151,0 +151,0 @@ var gmm = new GMM(3, undefined, [-1, 13, 25], [1, 1, 1], options); |
18462