From 92270ed000257e8dcc7ea687fc426b5207290dc3 Mon Sep 17 00:00:00 2001 From: Pierre Alexandre Tremblay Date: Sat, 11 Jul 2020 11:59:40 +0100 Subject: [PATCH] now with a smaller network (2 6 10) and gui to change the training params --- .../Examples/dataset/MLP-synth-control.scd | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/release-packaging/Examples/dataset/MLP-synth-control.scd b/release-packaging/Examples/dataset/MLP-synth-control.scd index acb251a..9988156 100644 --- a/release-packaging/Examples/dataset/MLP-synth-control.scd +++ b/release-packaging/Examples/dataset/MLP-synth-control.scd @@ -4,7 +4,9 @@ var trained = 0, entering = 0; var va = Array.fill(10,{0.5}); var input = Buffer.alloc(s,2); var output = Buffer.alloc(s,10); -var mlp = FluidMLPRegressor(s,[8, 6, 4],1,1000,0.01); +var maxIter = 1000; +var learnRate = 0.01; +var mlp = FluidMLPRegressor(s,[6],1,maxIter,learnRate); var entry = 0; ~inData = FluidDataSet(s,\indata); @@ -38,7 +40,7 @@ f.action = {arg x,y; //if trained, predict the point f.x f.y }); }; -c = Button(w, Rect(730,200,50, 20)).states_([["train", Color.red, Color.white], ["trained", Color.white, Color.grey]]).action_{ +c = Button(w, Rect(730,240,50, 20)).states_([["train", Color.red, Color.white], ["trained", Color.white, Color.grey]]).action_{ mlp.fit(~inData,~outData,{|x| trained = 1; c.value = 1; @@ -48,7 +50,12 @@ c = Button(w, Rect(730,200,50, 20)).states_([["train", Color.red, Color.white], d = Button(w, Rect(730,10,50, 20)).states_([["entry", Color.white, Color.grey], ["entry", Color.red, Color.white]]).action_{ entering = 1; }; -e = TextField(w,Rect(730,250,50,20)).string_(0.asString); +StaticText(w,Rect(732,260,50,20)).string_("Error:"); +e = TextField(w,Rect(730,280,50,20)).string_(0.asString); +StaticText(w,Rect(732,150,50,20)).string_("rate:"); +g = TextField(w,Rect(730,170,50,20)).string_(learnRate.asString).action_{|in|learnRate = in.value;}; +StaticText(w,Rect(732,190,50,20)).string_("maxIter:"); +h = TextField(w,Rect(730,210,50,20)).string_(maxIter.asString).action_{|in|maxIter = in.value;}; ) //2- the synth (CAREFUL - LOUD!)