Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

skmeans

Package Overview
Dependencies
Maintainers
1
Versions
32
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

skmeans - npm Package Compare versions

Comparing version 0.9.4 to 0.9.5

package-lock.json

0

browser.js

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ module.exports = {

11

Gruntfile.js

@@ -31,8 +31,9 @@ module.exports = function(grunt) {

},
build: {
src: 'dist/skmeans.js',
dest: 'dist/skmeans.min.js'
}
dist : {
files: {
'dist/skmeans.min.js' : ['dist/skmeans.js']
}
}
},
clean: ['dist/skmeans.js','skmeans.js.map']
clean: ['dist/*.js','dist/*.map']
});

@@ -39,0 +40,0 @@

@@ -0,0 +0,0 @@ const

@@ -0,0 +0,0 @@ /*jshint esversion: 6 */

{
"name": "skmeans",
"version": "0.9.4",
"description": "Super fast simple kmeans clustering for unidimiensional and multidimensional data. Works in node and browser",
"version": "0.9.5",
"description": "Super fast simple k-means and k-means++ clustering for unidimiensional and multidimensional data. Works in node and browser",
"author": "David Gómez Matarrodona <solzimer@gmail.com>",

@@ -13,2 +13,4 @@ "url": "https://github.com/owner/project/issues",

"k-means",
"k-means++",
"kmeans++",
"kmeans",

@@ -15,0 +17,0 @@ "simple",

# skmeans
Super fast simple k-means implementation for unidimiensional and multidimensional data. Works on nodejs and browser.
Super fast simple k-means and [k-means++](https://en.wikipedia.org/wiki/K-means%2B%2B) implementation for unidimiensional and multidimensional data. Works on nodejs and browser.

@@ -5,0 +5,0 @@ ## Installation

@@ -0,0 +0,0 @@ const skmeans = require("../main.js");

const skmeans = require("../main.js");
const data1 = [];
const data1 = require("./data/well-separated.js");
const data2 = require("./data/random_pts.js");
const MAX = 1000;
for(let i=0;i<2000;i++) {
var r = Math.random();
if(r>=0 && r<0.33) data1.push([r,r*2]);
else if(r>=0.33 && r<0.66) data1.push([r+4,2*(r+4)]);
else data1.push([r+9,2*(r+9)]);
function testCentroids(ks) {
ks.forEach(k=>{
k.forEach(v=>{
if(v==0) {
console.error(`Centroid on 0 ${k}`);
process.exit(1);
}
})
})
}

@@ -17,2 +21,3 @@

var res = skmeans(data1,3);
testCentroids(res.centroids);
its += res.it;

@@ -25,2 +30,3 @@ }

var res = skmeans(data1,3,"kmrand");
testCentroids(res.centroids);
its += res.it;

@@ -33,2 +39,3 @@ }

var res = skmeans(data1,3,"kmpp");
testCentroids(res.centroids);
its += res.it;

@@ -42,2 +49,3 @@ }

var res = skmeans(data2,16);
testCentroids(res.centroids);
its += res.it;

@@ -50,2 +58,3 @@ }

var res = skmeans(data2,16,"kmrand");
testCentroids(res.centroids);
its += res.it;

@@ -58,4 +67,5 @@ }

var res = skmeans(data2,16,"kmpp");
testCentroids(res.centroids);
its += res.it;
}
console.log("skmeans kmpp\t\t=>",its/MAX);

@@ -0,0 +0,0 @@ const skmeans = require("../main.js");

@@ -0,0 +0,0 @@ const skmeans = require("../main.js");

@@ -0,0 +0,0 @@ const skmeans = require("../main.js");

@@ -0,0 +0,0 @@ const skmeans = require("../main.js");

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc