MCPcopy
hub / github.com/tensorflow/playground / generateData

Function generateData

src/playground.ts:1067–1088  ·  view source on GitHub ↗
(firstTime = false)

Source from the content-addressed store, hash-verified

1065}
1066
1067function generateData(firstTime = false) {
1068 if (!firstTime) {
1069 // Change the seed.
1070 state.seed = Math.random().toFixed(5);
1071 state.serialize();
1072 userHasInteracted();
1073 }
1074 Math.seedrandom(state.seed);
1075 let numSamples = (state.problem === Problem.REGRESSION) ?
1076 NUM_SAMPLES_REGRESS : NUM_SAMPLES_CLASSIFY;
1077 let generator = state.problem === Problem.CLASSIFICATION ?
1078 state.dataset : state.regDataset;
1079 let data = generator(numSamples, state.noise / 100);
1080 // Shuffle the data in-place.
1081 shuffle(data);
1082 // Split into train and test data.
1083 let splitIndex = Math.floor(data.length * state.percTrainData / 100);
1084 trainData = data.slice(0, splitIndex);
1085 testData = data.slice(splitIndex);
1086 heatMap.updatePoints(trainData);
1087 heatMap.updateTestPoints(state.showTestData ? testData : []);
1088}
1089
1090let firstInteraction = true;
1091let parametersChanged = false;

Callers 2

makeGUIFunction · 0.85
playground.tsFile · 0.85

Calls 5

shuffleFunction · 0.90
userHasInteractedFunction · 0.85
serializeMethod · 0.80
updatePointsMethod · 0.80
updateTestPointsMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…