
Research
/Security News
npm Author Qix Compromised via Phishing Email in Major Supply Chain Attack
npm author Qix’s account was compromised, with malicious versions of popular packages like chalk-template, color-convert, and strip-ansi published.
node-kmeans
Advanced tools
Node.js asynchronous implementation of the clustering algorithm k-means
Node.js asynchronous implementation of the clustering algorithm k-means
$ npm install node-kmeans
// Data source: LinkedIn
const data = [
{'company': 'Microsoft' , 'size': 91259, 'revenue': 60420},
{'company': 'IBM' , 'size': 400000, 'revenue': 98787},
{'company': 'Skype' , 'size': 700, 'revenue': 716},
{'company': 'SAP' , 'size': 48000, 'revenue': 11567},
{'company': 'Yahoo!' , 'size': 14000 , 'revenue': 6426 },
{'company': 'eBay' , 'size': 15000, 'revenue': 8700},
];
// Create the data 2D-array (vectors) describing the data
let vectors = new Array();
for (let i = 0 ; i < data.length ; i++) {
vectors[i] = [ data[i]['size'] , data[i]['revenue']];
}
const kmeans = require('node-kmeans');
kmeans.clusterize(vectors, {k: 4}, (err,res) => {
if (err) console.error(err);
else console.log('%o',res);
});
(a,b) => number
, default Euclidian DistanceAn array of objects (one for each cluster) with the following properties:
Philmod <philippe.modard@gmail.com>
FAQs
Node.js asynchronous implementation of the clustering algorithm k-means
The npm package node-kmeans receives a total of 1,542 weekly downloads. As such, node-kmeans popularity was classified as popular.
We found that node-kmeans 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
npm author Qix’s account was compromised, with malicious versions of popular packages like chalk-template, color-convert, and strip-ansi published.
Research
Four npm packages disguised as cryptographic tools steal developer credentials and send them to attacker-controlled Telegram infrastructure.
Security News
Ruby maintainers from Bundler and rbenv teams are building rv to bring Python uv's speed and unified tooling approach to Ruby development.