Comparing version 0.11.2 to 0.11.3
@@ -0,0 +0,0 @@ "use strict"; |
@@ -415,3 +415,3 @@ "use strict"; | ||
return { | ||
it: MAX - it, | ||
it: (maxit || MAX) - it, | ||
k: k, | ||
@@ -418,0 +418,0 @@ idxs: idxs, |
@@ -1,3 +0,3 @@ | ||
/*! skmeans 2019-09-13 */ | ||
/*! skmeans 2020-01-29 */ | ||
"use strict";!function e(i,f,s){function u(n,r){if(!f[n]){if(!i[n]){var t="function"==typeof require&&require;if(!r&&t)return t(n,!0);if(v)return v(n,!0);var o=new Error("Cannot find module '"+n+"'");throw o.code="MODULE_NOT_FOUND",o}var a=f[n]={exports:{}};i[n][0].call(a.exports,function(r){return u(i[n][1][r]||r)},a,a.exports,e,i,f,s)}return f[n].exports}for(var v="function"==typeof require&&require,r=0;r<s.length;r++)u(s[r]);return u}({1:[function(n,t,o){(function(){this.skmeans;var r=n("./main.js");void 0!==o&&(void 0!==t&&t.exports&&(o=t.exports=r),o.skmeans=r),"undefined"!=typeof window&&(window.skmeans=r)}).call(this)},{"./main.js":4}],2:[function(r,n,t){n.exports={eudist:function(r,n){for(var t=r.length,o=0,a=0;a<t;a++){var e=(r[a]||0)-(n[a]||0);o+=e*e}return o},mandist:function(r,n){for(var t=r.length,o=0,a=0,e=0;e<t;e++)o+=0<=(a=(r[e]||0)-(n[e]||0))?a:-a;return o},dist:function(r,n,t){var o=Math.abs(r-n);return t?o:o*o}}},{}],3:[function(r,n,t){var o=r("./distance.js"),j=o.eudist,w=o.dist;n.exports={kmrand:function(r,n){for(var t={},o=[],a=n<<2,e=r.length,i=0<r[0].length;o.length<n&&0<a--;){var f=r[Math.floor(Math.random()*e)],s=i?f.join("_"):"".concat(f);t[s]||(t[s]=!0,o.push(f))}if(o.length<n)throw new Error("Error initializating clusters");return o},kmpp:function(r,n,t){var o=t||(r[0].length?j:w),a=[],e=r.length,i=0<r[0].length,f=r[Math.floor(Math.random()*e)];i?f.join("_"):"".concat(f);for(a.push(f);a.length<n;){for(var s=[],u=a.length,v=0,c=[],h=0;h<e;h++){for(var d=1/0,l=0;l<u;l++){var p=o(r[h],a[l]);p<=d&&(d=p)}s[h]=d}for(var m=0;m<e;m++)v+=s[m];for(var g=0;g<e;g++)c[g]={i:g,v:r[g],pr:s[g]/v,cs:0};c.sort(function(r,n){return r.pr-n.pr}),c[0].cs=c[0].pr;for(var k=1;k<e;k++)c[k].cs=c[k-1].cs+c[k].pr;for(var x=Math.random(),M=0;M<e-1&&c[M++].cs<x;);a.push(c[M-1].v)}return a}}},{"./distance.js":2}],4:[function(r,n,t){var o=r("./distance.js"),a=r("./kinit.js"),H=o.eudist,I=(o.mandist,o.dist,a.kmrand),J=a.kmpp;function K(r,n,t){t=t||[];for(var o=0;o<r;o++)t[o]=n;return t}function P(r,n){for(var t=Array.isArray(r),o=this.centroids,a=o.length,e=1/0,i=0,f=0;f<a;f++){var s=n?n(r,o[f]):t?H(r,o[f]):Math.abs(r-o[f]);s<=e&&(e=s,i=f)}return{idx:i,centroid:o[i]}}n.exports=function(r,n,t,o,a){var e=[],i=[],f=[],s=[],u=!1,v=o||1e4,c=r.length,h=r[0].length,d=0<h,l=[];if(t)e="kmrand"==t?I(r,n):"kmpp"==t?J(r,n,a):t;else for(var p={},m=0;e.length<n;){var g=Math.floor(Math.random()*c);p[g]||(p[g]=!0,e[m++]=r[g])}do{K(n,0,l);for(var k=0;k<c;k++){for(var x=1/0,M=0,j=0;j<n;j++)(s=a?a(r[k],e[j]):d?H(r[k],e[j]):Math.abs(r[k]-e[j]))<=x&&(x=s,M=j);l[f[k]=M]++}var w=[];if(i=[],d)for(var b=0;b<n;b++)w[b]=K(h,0,w[b]),i[b]=e[b];else for(var y=0;y<n;y++)w[y]=0,i[y]=e[y];if(d){for(var q=0;q<n;q++)e[q]=[];for(var E=0;E<c;E++)for(var _=w[f[E]],O=r[E],A=0;A<h;A++)_[A]+=O[A];u=!0;for(var D=0;D<n;D++){for(var N=e[D],U=w[D],z=i[D],C=l[D],F=0;F<h;F++)N[F]=U[F]/C||0;if(u)for(var L=0;L<h;L++)if(z[L]!=N[L]){u=!1;break}}}else{for(var T=0;T<c;T++)w[f[T]]+=r[T];for(var B=0;B<n;B++)e[B]=w[B]/l[B]||0;u=!0;for(var G=0;G<n;G++)if(i[G]!=e[G]){u=!1;break}}u=u||--v<=0}while(!u);return{it:1e4-v,k:n,idxs:f,centroids:e,test:P}}},{"./distance.js":2,"./kinit.js":3}]},{},[1]); | ||
"use strict";!function e(i,f,s){function u(n,r){if(!f[n]){if(!i[n]){var t="function"==typeof require&&require;if(!r&&t)return t(n,!0);if(v)return v(n,!0);var o=new Error("Cannot find module '"+n+"'");throw o.code="MODULE_NOT_FOUND",o}var a=f[n]={exports:{}};i[n][0].call(a.exports,function(r){return u(i[n][1][r]||r)},a,a.exports,e,i,f,s)}return f[n].exports}for(var v="function"==typeof require&&require,r=0;r<s.length;r++)u(s[r]);return u}({1:[function(n,t,o){(function(){this.skmeans;var r=n("./main.js");void 0!==o&&(void 0!==t&&t.exports&&(o=t.exports=r),o.skmeans=r),"undefined"!=typeof window&&(window.skmeans=r)}).call(this)},{"./main.js":4}],2:[function(r,n,t){n.exports={eudist:function(r,n){for(var t=r.length,o=0,a=0;a<t;a++){var e=(r[a]||0)-(n[a]||0);o+=e*e}return o},mandist:function(r,n){for(var t=r.length,o=0,a=0,e=0;e<t;e++)o+=0<=(a=(r[e]||0)-(n[e]||0))?a:-a;return o},dist:function(r,n,t){var o=Math.abs(r-n);return t?o:o*o}}},{}],3:[function(r,n,t){var o=r("./distance.js"),j=o.eudist,w=o.dist;n.exports={kmrand:function(r,n){for(var t={},o=[],a=n<<2,e=r.length,i=0<r[0].length;o.length<n&&0<a--;){var f=r[Math.floor(Math.random()*e)],s=i?f.join("_"):"".concat(f);t[s]||(t[s]=!0,o.push(f))}if(o.length<n)throw new Error("Error initializating clusters");return o},kmpp:function(r,n,t){var o=t||(r[0].length?j:w),a=[],e=r.length,i=0<r[0].length,f=r[Math.floor(Math.random()*e)];i?f.join("_"):"".concat(f);for(a.push(f);a.length<n;){for(var s=[],u=a.length,v=0,c=[],h=0;h<e;h++){for(var d=1/0,l=0;l<u;l++){var p=o(r[h],a[l]);p<=d&&(d=p)}s[h]=d}for(var m=0;m<e;m++)v+=s[m];for(var g=0;g<e;g++)c[g]={i:g,v:r[g],pr:s[g]/v,cs:0};c.sort(function(r,n){return r.pr-n.pr}),c[0].cs=c[0].pr;for(var k=1;k<e;k++)c[k].cs=c[k-1].cs+c[k].pr;for(var x=Math.random(),M=0;M<e-1&&c[M++].cs<x;);a.push(c[M-1].v)}return a}}},{"./distance.js":2}],4:[function(r,n,t){var o=r("./distance.js"),a=r("./kinit.js"),H=o.eudist,I=(o.mandist,o.dist,a.kmrand),J=a.kmpp;function K(r,n,t){t=t||[];for(var o=0;o<r;o++)t[o]=n;return t}function P(r,n){for(var t=Array.isArray(r),o=this.centroids,a=o.length,e=1/0,i=0,f=0;f<a;f++){var s=n?n(r,o[f]):t?H(r,o[f]):Math.abs(r-o[f]);s<=e&&(e=s,i=f)}return{idx:i,centroid:o[i]}}n.exports=function(r,n,t,o,a){var e=[],i=[],f=[],s=[],u=!1,v=o||1e4,c=r.length,h=r[0].length,d=0<h,l=[];if(t)e="kmrand"==t?I(r,n):"kmpp"==t?J(r,n,a):t;else for(var p={},m=0;e.length<n;){var g=Math.floor(Math.random()*c);p[g]||(p[g]=!0,e[m++]=r[g])}do{K(n,0,l);for(var k=0;k<c;k++){for(var x=1/0,M=0,j=0;j<n;j++)(s=a?a(r[k],e[j]):d?H(r[k],e[j]):Math.abs(r[k]-e[j]))<=x&&(x=s,M=j);l[f[k]=M]++}var w=[];if(i=[],d)for(var b=0;b<n;b++)w[b]=K(h,0,w[b]),i[b]=e[b];else for(var y=0;y<n;y++)w[y]=0,i[y]=e[y];if(d){for(var q=0;q<n;q++)e[q]=[];for(var E=0;E<c;E++)for(var _=w[f[E]],O=r[E],A=0;A<h;A++)_[A]+=O[A];u=!0;for(var D=0;D<n;D++){for(var N=e[D],U=w[D],z=i[D],C=l[D],F=0;F<h;F++)N[F]=U[F]/C||0;if(u)for(var L=0;L<h;L++)if(z[L]!=N[L]){u=!1;break}}}else{for(var T=0;T<c;T++)w[f[T]]+=r[T];for(var B=0;B<n;B++)e[B]=w[B]/l[B]||0;u=!0;for(var G=0;G<n;G++)if(i[G]!=e[G]){u=!1;break}}u=u||--v<=0}while(!u);return{it:(o||1e4)-v,k:n,idxs:f,centroids:e,test:P}}},{"./distance.js":2,"./kinit.js":3}]},{},[1]); |
@@ -0,0 +0,0 @@ "use strict"; |
@@ -0,0 +0,0 @@ "use strict"; |
@@ -198,3 +198,3 @@ "use strict"; | ||
return { | ||
it: MAX - it, | ||
it: (maxit || MAX) - it, | ||
k: k, | ||
@@ -201,0 +201,0 @@ idxs: idxs, |
@@ -0,0 +0,0 @@ module.exports = { |
@@ -0,0 +0,0 @@ module.exports = function(grunt) { |
@@ -0,0 +0,0 @@ const |
@@ -175,3 +175,3 @@ /*jshint esversion: 6 */ | ||
return { | ||
it : MAX-it, | ||
it : (maxit || MAX) - it, | ||
k : k, | ||
@@ -178,0 +178,0 @@ idxs : idxs, |
{ | ||
"name": "skmeans", | ||
"version": "0.11.2", | ||
"version": "0.11.3", | ||
"description": "Super fast simple k-means and k-means++ clustering for unidimiensional and multidimensional data. Works in node and browser", | ||
@@ -5,0 +5,0 @@ "author": "David Gómez Matarrodona <solzimer@gmail.com>", |
@@ -0,0 +0,0 @@ # skmeans |
@@ -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"); |
@@ -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
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
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
108387