See the codelab TensorFlow.js — Making Predictions from 2D Data for an introduction to TenosrFlow.js and also to the use-case and the code here.
- Interactive generation of (parameterized) test data
- Interactive training and validation of (parameterized) Neural Network
- Ease of extension of interactive parameters (sliders) thanks to a high level of abstraction and automation
- Encapulation, reusability, and separation of concerns with a purely class-based code
- Immutable implementation of logic (but not data models)
- Samples of a decaying exponential function (with controllable sampling rate, noise, sparsity ...) are defined as
x
andy
vectors. - An Artificial Neural Network is trained to learn the dependency
y=f(x)
with controllable learning parameters. - The plots
x vs. y
andx vs. f(x)
are superimposed for a semi-quantitative assessment of the learning.
- Browser client
- Double-click on the file index.html (or open it with your browser of choice). No server is needed.
- Node.js client
- Run the command
npm install
and thennpm test
. - An example of this client is the GitHub Action of this project.
- Run the command
- Deno client
- Run the command
Deno test ./tests/javascript/deno/test.js --allow-read
. - An example of this client is the GitHub Action of this project.
- If the main client is a Deno-client, it is recommended that the main code be imported in the test file. The current implementation is based on the restriction to support 3 different clients.
- Run the command
The sliders for epochs
(250 vs. 400) and noise
(2.5% vs. 5%) provide a dynamic and user-defined compromise between accuracy and speed (Note that these stochastic results are reproducible only in a statistical sense).
In the function Controller.createSliders
, simply extend the local variable sliders
. For example to include a slider for sparsity
, the definition can be extended as follows:
const sliders = {
noisePercent: Controller.createSlider('Noise', 0, inputDataParameters.noisePercent * 2, sliderIndex++),
epochs: Controller.createSlider('Epoch', 100, inputDataParameters.epochs * 2, sliderIndex++),
sparsity: Controller.createSlider('Sparsity', 1, 6, sliderIndex++)
};
All other steps, including the setting of callbacks, will be done automatically.