build/modelscript.umd.js
function examplesBaggingWithReplacement(trainingSet, trainingValue, seed) {
              var engine = random.engines.mt19937();
              var distribution = random.integer(0, trainingSet.rows - 1);
              if (seed === undefined) {
                engine = engine.autoSeed();
              } else if (Number.isInteger(seed)) {
                engine = engine.seed(seed);
              } else {
                throw new RangeError(`Expected seed must be undefined or integer not ${seed}`);
              }

              var Xr = new Array(trainingSet.rows);
              var yr = new Array(trainingSet.rows);

              for (var i = 0; i < trainingSet.rows; ++i) {
                var index = distribution(engine);
                Xr[i] = trainingSet[index];
                yr[i] = trainingValue[index];
              }

              return {
                X: new Matrix$1(Xr),
                y: yr
              };
            }
function examplesBaggingWithReplacement(trainingSet, trainingValue, seed) {
              var engine = random.engines.mt19937();
              var distribution = random.integer(0, trainingSet.rows - 1);
              if (seed === undefined) {
                engine = engine.autoSeed();
              } else if (Number.isInteger(seed)) {
                engine = engine.seed(seed);
              } else {
                throw new RangeError(`Expected seed must be undefined or integer not ${seed}`);
              }

              var Xr = new Array(trainingSet.rows);
              var yr = new Array(trainingSet.rows);

              for (var i = 0; i < trainingSet.rows; ++i) {
                var index = distribution(engine);
                Xr[i] = trainingSet[index];
                yr[i] = trainingValue[index];
              }

              return {
                X: new Matrix$1(Xr),
                y: yr
              };
            }
function examplesBaggingWithReplacement ( trainingSet , trainingValue , seed ) { var engine = random . engines . mt19937 ( ) ; var distribution = random . integer ( 0 , trainingSet . rows - 1 ) ; if ( seed === undefined ) { engine = engine . autoSeed ( ) ; } else if ( Number . isInteger ( seed ) ) { engine = engine . seed ( seed ) ; } else { throw new RangeError ( ` ${ seed } ` ) ; } var Xr = new Array ( trainingSet . rows ) ; var yr = new Array ( trainingSet . rows ) ; for ( var i = 0 ; i < trainingSet . rows ; ++ i ) { var index = distribution ( engine ) ; Xr [ i ] = trainingSet [ index ] ; yr [ i ] = trainingValue [ index ] ; } return { X : new Matrix$1 ( Xr ) , y : yr } ; }
Select n with replacement elements on the training set and values, where n is the size of the training set.
@ignore
@param {Matrix} trainingSet
@param {Array} trainingValue
@param {number} seed - seed for the random selection, must be a 32-bit integer.
@return {object} with new X and y.
Select n with replacement elements on the training set and values where n is the size of the training set .