Comparing version
@@ -0,0 +0,0 @@ "use strict"; |
@@ -0,0 +0,0 @@ "use strict"; |
@@ -0,0 +0,0 @@ module.exports = { |
@@ -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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
176825
182.25%22
4.76%3927
452.32%5
-16.67%1
Infinity%