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.
AGNES (AGglomerative NESting): Continuously merge nodes that have the least dissimilarity.
Arguments
data
: Array of points to be clustered, are an array of arrays, as [[x1,y1],[x2,y2], ... ]. Optionally the data input can be a distance matrix. In such case, the option isDistanceMatrix
has to be set to true (by default false).options
: Is an object with the parameters sim
and kind
, where sim
is a distance function between vectors (the default function is the euclidean), and kind
is the string name for the function to calculate distance between clusters, and it could be single
(default), complete
, average
, centroid
or ward
Returns a phylogram (a dendogram with weights) and change the leaves values for the values in input
, if it's given.
Example 1
var hclust = require('ml-hclust')
var data = [[2,6], [3,4], [3,8]];
var HC = new hclust.agnes(data);
var dend1 = HC.getDendogram();
var dend2 = HC.getDendogram([{a:1},{b:2},{c:3}]);
Example 2
var hclust = require('ml-hclust')
//A distance matrix.
var distance = [[0, 1, 2], [1, 0, 2], [2, 2, 0]];
var HC = new hclust.agnes(data, {source:'distance'});
Returns at least N clusters based in the clustering tree if it's possible
DIANA (Divisive ANAlysis): The process starts at the root with all the points as one cluster and recursively splits the higher level clusters to build the dendrogram.
Arguments
data
: Array of points to be clustered, are an array of arrays, as [[x1,y1],[x2,y2], ... ]options
: Is an object with the parameters sim
and kind
, where sim
is a distance function between vectors (the default function is the euclidean), and kind
is the string name for the function to calculate distance between clusters, and it could be single
(default), complete
, average
, centroid
or ward
Returns a phylogram (a dendogram with weights) and change the leaves values for the values in input
, if it's given.
Example
var hclust = require('ml-hclust')
var data = [[2,6], [3,4], [3,8]];
var HC = new hclust.diana(data);
var dend1 = HC.getDendogram();
var dend2 = HC.getDendogram([{a:1},{b:2},{c:3}]);
Returns at least N clusters based in the clustering tree if it's possible
BIRCH (Balanced Iterative Reducing and Clustering using Hierarchies): Incrementally construct a CF (Clustering Feature) tree, a hierarchical data structure for multiphase clustering
CURE (Clustering Using REpresentatives):
$ 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.