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.
Hierarchical clustering algorithms in JavaScript
npm install ml-hclust
Generate a clustering hierarchy.
Creates a new Hclust instance with the given parameters or the default ones.
Arguments
options
- Object with options for the algorithmOptions
name
: The name of the hierarchical cluster, it could be agnes
(default), diana
, birch
, cure
or chameleon
.sim
: The kind of distance or similarity to use between vectors, the default is euclidean
, but for a complete list see ml-distance.kind
: The kind of similarity to use between clusters, it could be single
(default), complete
, average
, centroid
or ward
Example
var HCL = require('ml-hclust');
// actually this are the default values
var options = {
name: 'agnes',
sim: 'euclidean',
kind: 'single'
};
var agnes = new HCL(options);
Creates the tree based in the data
points.
Arguments
data
: Array of points to be clustered.Example
var data = [[2,6], [3,4], [3,8]];
var myHcl = new HCL();
myHcl.cluster(data);
Returns L
level of the hierarchical clustering tree.
Arguments
L
- Level of the hierarchical tree.Example
// the clustering points
var agnesData = [[2,6], [3,4], [3,8], [4,5], [4,7], [6,2], [7,2], [7,4], [8,4], [8,5]];
// creates the hierarchical tree
var HC = new Hclust();
HC.cluster(agnesData);
// the array of clusters
var ansAgnes = HC.getLevel(3);
/*
[ [ [ 3, 4 ], [ 4, 5 ], [ 3, 8 ], [ 4, 7 ] ],
[ [ 6, 2 ], [ 7, 2 ] ],
[ [ 7, 4 ], [ 8, 4 ], [ 8, 5 ] ],
[ [ 2, 6 ] ] ]
*/
Exports the model to a JSON object that can be written to disk and reloaded
Returns a new Hclust instance based on the model
.
Arguments
model
- JSON object generated with Hclust.export()
$ npm install
$ npm test
FAQs
Hierarchical clustering algorithms
The npm package ml-hclust receives a total of 663 weekly downloads. As such, ml-hclust popularity was classified as not popular.
We found that ml-hclust demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 7 open source maintainers 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.