Uses 911K of libraries. Click here for Pure Java version (5524L/28K).
!7 cmodule PerceptronSpike > DynPrintLogAndEnabled { switchable int nExamples = 2000; L<Perceptron.Example> examples; transient Perceptron perceptron; switchable double c = 1; switchable bool randomizeC = false; switchable bool startWithRandomWeights = true; // function to be learned double f(double x) { ret x * 0.7 + 40; } start-thread { if (l(examples) != nExamples) setField(examples := repF(nExamples, () -> { int x = rand(640), y = rand(360); ret new Perceptron.Example(new double[] {x, y}, y > f(x)); })); perceptron = new Perceptron; copyAllFields(module(), perceptron); for ping (Double error : perceptron.trainingIterator()) { if (deleted) ret; if (!enabled) continue with sleepSeconds(1); if (error != null) perceptron.printWithWeights(); } } }
Began life as a copy of #1026916
download show line numbers debug dex old transpilations
Travelled to 7 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt, xrpafgyirdlv
No comments. add comment
Snippet ID: | #1026920 |
Snippet name: | Perceptron Spike, compacted [learn 3 weights, OK] |
Eternal ID of this version: | #1026920/8 |
Text MD5: | 0b9c20e705a125f225deead1d32f6f8d |
Transpilation MD5: | 75a9e73475b3f9ca08a967fa81f83e0c |
Author: | stefan |
Category: | javax |
Type: | JavaX source code (Dynamic Module) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2020-02-02 19:35:08 |
Source code size: | 897 bytes / 32 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 260 / 621 |
Version history: | 7 change(s) |
Referenced in: | -