in src/playground.ts [1067:1088]
function generateData(firstTime = false) {
if (!firstTime) {
// Change the seed.
state.seed = Math.random().toFixed(5);
state.serialize();
userHasInteracted();
}
Math.seedrandom(state.seed);
let numSamples = (state.problem === Problem.REGRESSION) ?
NUM_SAMPLES_REGRESS : NUM_SAMPLES_CLASSIFY;
let generator = state.problem === Problem.CLASSIFICATION ?
state.dataset : state.regDataset;
let data = generator(numSamples, state.noise / 100);
// Shuffle the data in-place.
shuffle(data);
// Split into train and test data.
let splitIndex = Math.floor(data.length * state.percTrainData / 100);
trainData = data.slice(0, splitIndex);
testData = data.slice(splitIndex);
heatMap.updatePoints(trainData);
heatMap.updateTestPoints(state.showTestData ? testData : []);
}