Comparing version 0.5.1 to 0.5.2
10
main.js
/*jshint esversion: 6 */ | ||
const MAX = 10000; | ||
const abs = Math.abs; | ||
const sqrt = Math.sqrt; | ||
@@ -18,3 +16,3 @@ /** | ||
} | ||
return sqrt(sum); | ||
return Math.sqrt(sum); | ||
} | ||
@@ -30,3 +28,3 @@ | ||
for(let i=0;i<len;i++) { | ||
sum += abs((v1[i]||0) - (v2[i]||0)); | ||
sum += Math.abs((v1[i]||0) - (v2[i]||0)); | ||
} | ||
@@ -46,4 +44,2 @@ return sum; | ||
function skmeans(data,k,initial,maxit) { | ||
"use strict"; | ||
var ks = [], idxs = [], len = data.length; | ||
@@ -68,3 +64,3 @@ var conv = false, it = maxit || MAX; | ||
// Multidimensional or unidimensional | ||
var dist = multi? eudist(data[i],ks[j]) : abs(data[i]-ks[j]); | ||
var dist = multi? eudist(data[i],ks[j]) : Math.abs(data[i]-ks[j]); | ||
if(dist<min) { | ||
@@ -71,0 +67,0 @@ min = dist; |
{ | ||
"name": "skmeans", | ||
"version": "0.5.1", | ||
"version": "0.5.2", | ||
"description": "Super fast simple kmeans clustering for unidimiensional data", | ||
@@ -5,0 +5,0 @@ "author": "David Gómez Matarrodona <solzimer@gmail.com>", |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
22314
352