Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
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 12 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.
Research
Security News
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.