build/modelscript.umd.js
function createCentroids(k) {
                var Centroid = [];
                var maxes = this.Observations.maxColumns();
                //console.log(maxes);

                for(var i = 1; i <= k; i++) {
                    var centroid = [];
                    for(var j = 1; j <= this.Observations.cols(); j++) {
                        centroid.push(Math.random() * maxes.e(j));
                    }

                    Centroid.push(centroid);
                }

                //console.log(centroid)

                return $M(Centroid);
            }
function createCentroids(k) {
                var Centroid = [];
                var maxes = this.Observations.maxColumns();
                //console.log(maxes);

                for(var i = 1; i <= k; i++) {
                    var centroid = [];
                    for(var j = 1; j <= this.Observations.cols(); j++) {
                        centroid.push(Math.random() * maxes.e(j));
                    }

                    Centroid.push(centroid);
                }

                //console.log(centroid)

                return $M(Centroid);
            }
function createCentroids ( k ) { var Centroid = [ ] ; var maxes = this . Observations . maxColumns ( ) ; //console.log(maxes); for ( var i = 1 ; i <= k ; i ++ ) { var centroid = [ ] ; for ( var j = 1 ; j <= this . Observations . cols ( ) ; j ++ ) { centroid . push ( Math . random ( ) * maxes . e ( j ) ) ; } Centroid . push ( centroid ) ; } //console.log(centroid) return $M ( Centroid ) ; }
create an initial centroid matrix with initial values between 0 and the max of feature data X.
create an initial centroid matrix with initial values between 0 and the max of feature data X .