MCPcopy
hub / github.com/BrainJS/brain.js / _verifyIsInitialized

Method _verifyIsInitialized

src/neural-network-gpu.js:321–340  ·  view source on GitHub ↗

* * @param data * Verifies network sizes are initilaized * If they are not it will initialize them based off the data set.

(data)

Source from the content-addressed store, hash-verified

319 * If they are not it will initialize them based off the data set.
320 */
321 _verifyIsInitialized(data) {
322 if (this.sizes) return;
323
324 this.sizes = [];
325 if (!data[0].size) {
326 data[0].size = { input: data[0].input.length, output: data[0].output.length };
327 }
328
329 this.sizes.push(data[0].size.input);
330 if (!this.hiddenLayers) {
331 this.sizes.push(Math.max(3, Math.floor(data[0].size.input / 2)));
332 } else {
333 this.hiddenLayers.forEach(size => {
334 this.sizes.push(size);
335 });
336 }
337 this.sizes.push(data[0].size.output);
338
339 this._initialize();
340 }
341
342 /**
343 *

Callers 1

_prepTrainingMethod · 0.95

Calls 1

_initializeMethod · 0.95

Tested by

no test coverage detected