Security News
pnpm 10.0.0 Blocks Lifecycle Scripts by Default
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.
gaussianMixture
Advanced tools
An implementation of a Gaussian Mixture class in one dimension, that allows to fit models with an Expectation Maximization algorithm.
This module implements a 1D Gaussian Mixture class that allows to fit a distribution of points along a one dimensional axis.
var GMM = require('gaussianMixture')
var nComponents = 3
var weights = [0.3, 0.2, 0.5]
var means = [1, 7, 15]
var vars = [1, 2, 1]
var gmm = new GMM(nComponents, weights, means, vars)
gmm.sample(10) // return 10 datapoints from the mixture
data = [1.2, 1.3, 7.4, 1.4, 14.3, 15.3, 1.0, 7.2]
gmm.optimize(data) // updates weights, means and variances with the EM algorithm given the data.
console.log(gmm.means); // >> [1.225, 7.3, 14.8]
Optionally, define an options object and pass it at instantiation:
var options = {
variancePrior: // Float,
separationPrior: // Float,
priorRelevance: // Positive float.
};
var gmm = new GMM(nComponents, weights, means, vars, options);
The variance prior allows you to define a prior for the variance of all components (assumed the same). This prior will be mixed in the maximization step of the EM optimization with a relevance score equal to options.priorRelevance
.
Similarly, the separation prior allows you to define a prior for the difference between consecutive gaussian mixture means. This prior is mixed with the sale options.priorRelevance
score.
The mixing weight alpha
for component i
is alpha = weights[i] / (weights[i] + options.priorRelevance)
.
FAQs
An implementation of a Gaussian Mixture class in one dimension, that allows to fit models with an Expectation Maximization algorithm.
The npm package gaussianMixture receives a total of 2 weekly downloads. As such, gaussianMixture popularity was classified as not popular.
We found that gaussianMixture demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.
Product
Socket now supports uv.lock files to ensure consistent, secure dependency resolution for Python projects and enhance supply chain security.
Research
Security News
Socket researchers have discovered multiple malicious npm packages targeting Solana private keys, abusing Gmail to exfiltrate the data and drain Solana wallets.