Skip to content
This repository has been archived by the owner on May 11, 2023. It is now read-only.

Commit

Permalink
Issue #25 StateMachineDesigner 2nd level cluster computation, Crossva…
Browse files Browse the repository at this point in the history
…lidation element, Regression noncritical bugfix
  • Loading branch information
okozelsk committed Nov 29, 2020
1 parent 333e4d6 commit fbab7d7
Show file tree
Hide file tree
Showing 19 changed files with 529 additions and 427 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using System;
using RCNet.Neural.Activation;
using RCNet.Neural.Data.Coders.AnalogToSpiking;
using RCNet.Neural.Data.Filter;
using RCNet.Neural.Network.NonRecurrent;
using RCNet.Neural.Network.SM;
using RCNet.Neural.Network.SM.Preprocessing;
using RCNet.Neural.Network.SM.Preprocessing.Input;
Expand Down Expand Up @@ -43,10 +43,10 @@ public void Run()
new ExternalFieldSettings("coord_ordinate", new RealFeatureFilterSettings())
);
//Simplified readout layer configuration
ReadoutLayerSettings readoutCfg = StateMachineDesigner.CreateClassificationReadoutCfg(StateMachineDesigner.CreateSingleLayerRegrNet(new IdentitySettings(), 5, 400),
0.0825d,
1,
ReadoutLayerSettings readoutCfg = StateMachineDesigner.CreateClassificationReadoutCfg(new CrossvalidationSettings(0.0825d, CrossvalidationSettings.AutoFolds, 1),
StateMachineDesigner.CreateSingleLayerRegrNet(new IdentitySettings(), 5, 400),
"Hand movement",
new NetworkClusterSecondLevelCompSettings(new CrossvalidationSettings(0.25d, CrossvalidationSettings.AutoFolds, 2), StateMachineDesigner.CreateMultiLayerRegrNet(10, new LeakyReLUSettings(), 1, 5, 400)),
"curved swing",
"horizontal swing",
"vertical swing",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using RCNet.Neural.Activation;
using RCNet.Neural.Data.Coders.AnalogToSpiking;
using RCNet.Neural.Data.Filter;
using RCNet.Neural.Network.NonRecurrent;
using RCNet.Neural.Network.SM;
using RCNet.Neural.Network.SM.Preprocessing;
using RCNet.Neural.Network.SM.Preprocessing.Input;
Expand Down Expand Up @@ -95,10 +96,10 @@ public void Run(InputEncoder.SpikingInputEncodingRegime spikesEncodingRegime)
}

//Simplified readout layer configuration
ReadoutLayerSettings readoutCfg = StateMachineDesigner.CreateClassificationReadoutCfg(StateMachineDesigner.CreateMultiLayerRegrNet(10, new LeakyReLUSettings(), 2, 5, 400),
0.0825d,
1,
ReadoutLayerSettings readoutCfg = StateMachineDesigner.CreateClassificationReadoutCfg(new CrossvalidationSettings(0.0825d, 0, 1),
StateMachineDesigner.CreateMultiLayerRegrNet(10, new LeakyReLUSettings(), 2, 5, 400),
"Hand movement",
null,
"curved swing",
"horizontal swing",
"vertical swing",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using RCNet.Neural.Activation;
using RCNet.Neural.Data.Coders.AnalogToSpiking;
using RCNet.Neural.Data.Filter;
using RCNet.Neural.Network.NonRecurrent;
using RCNet.Neural.Network.SM;
using RCNet.Neural.Network.SM.Preprocessing;
using RCNet.Neural.Network.SM.Preprocessing.Input;
Expand Down Expand Up @@ -37,10 +38,13 @@ public void Run()
{
//Create StateMachine configuration
//Simplified readout layer configuration using FF-network having 2 hidden layers as the classifier
ReadoutLayerSettings readoutCfg = StateMachineDesigner.CreateClassificationReadoutCfg(StateMachineDesigner.CreateMultiLayerRegrNet(10, new LeakyReLUSettings(), 2, 5, 400),
0.0825d,
1,
ReadoutLayerSettings readoutCfg = StateMachineDesigner.CreateClassificationReadoutCfg(new CrossvalidationSettings(0.0825d, 0, 1),
StateMachineDesigner.CreateMultiLayerRegrNet(10, new LeakyReLUSettings(), 2, 5, 400),
"Hand movement",
new NetworkClusterSecondLevelCompSettings(new CrossvalidationSettings(0.25d, CrossvalidationSettings.AutoFolds, 2),
StateMachineDesigner.CreateMultiLayerRegrNet(10, new LeakyReLUSettings(), 1, 5, 400),
TrainedNetworkCluster.SecondLevelCompMode.SecondLevelOutputOnly
),
"curved swing",
"horizontal swing",
"vertical swing",
Expand Down
7 changes: 4 additions & 3 deletions Demo/DemoConsoleApp/Examples/TTOOForecastDesigner.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using RCNet.Neural.Activation;
using RCNet.Neural.Data.Coders.AnalogToSpiking;
using RCNet.Neural.Data.Filter;
using RCNet.Neural.Network.NonRecurrent;
using RCNet.Neural.Network.SM;
using RCNet.Neural.Network.SM.Preprocessing.Input;
using RCNet.Neural.Network.SM.Preprocessing.Neuron.Predictor;
Expand Down Expand Up @@ -33,9 +34,9 @@ public void Run()
new ExternalFieldSettings("Adj Close", new RealFeatureFilterSettings())
);
//Simplified readout layer configuration
ReadoutLayerSettings readoutCfg = StateMachineDesigner.CreateForecastReadoutCfg(StateMachineDesigner.CreateSingleLayerRegrNet(new IdentitySettings(), 2, 1000),
0.1d,
1,
ReadoutLayerSettings readoutCfg = StateMachineDesigner.CreateForecastReadoutCfg(new CrossvalidationSettings(0.1d, 0, 1),
StateMachineDesigner.CreateSingleLayerRegrNet(new IdentitySettings(), 2, 1000),
null,
"High",
"Low"
);
Expand Down
11 changes: 5 additions & 6 deletions Demo/DemoConsoleApp/Examples/TTOOForecastFromScratch.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using RCNet.Neural.Activation;
using RCNet.Neural.Data.Coders.AnalogToSpiking;
using RCNet.Neural.Data.Filter;
using RCNet.Neural.Network.NonRecurrent;
using RCNet.Neural.Network.NonRecurrent.FF;
using RCNet.Neural.Network.SM;
using RCNet.Neural.Network.SM.Preprocessing;
Expand Down Expand Up @@ -238,10 +239,10 @@ NeuralPreprocessorSettings CreatePreprocessorCfg(string resInstName, string resS
/// <summary>
/// Creates readout layer configuration
/// </summary>
/// <param name="testDataRatio">Specifies what part of available data to be used as test data</param>
/// <param name="foldDataRatio">Specifies what part of available data to be used as the fold data</param>
/// <param name="numOfAttempts">Number of regression attempts. Each readout network will try to learn numOfAttempts times</param>
/// <param name="numOfEpochs">Number of training epochs within an attempt</param>
ReadoutLayerSettings CreateReadoutLayerCfg(double testDataRatio, int numOfAttempts, int numOfEpochs)
ReadoutLayerSettings CreateReadoutLayerCfg(double foldDataRatio, int numOfAttempts, int numOfEpochs)
{
//For each output field we will use prediction of two networks
//First network having only Identity output neuron and associated the resilient back propagation trainer
Expand All @@ -262,12 +263,10 @@ ReadoutLayerSettings CreateReadoutLayerCfg(double testDataRatio, int numOfAttemp
ReadoutUnitSettings highReadoutUnitCfg = new ReadoutUnitSettings("High", new ForecastTaskSettings(new RealFeatureFilterSettings()));
ReadoutUnitSettings lowReadoutUnitCfg = new ReadoutUnitSettings("Low", new ForecastTaskSettings(new RealFeatureFilterSettings()));
//Create readout layer configuration
ReadoutLayerSettings readoutLayerCfg = new ReadoutLayerSettings(new ReadoutUnitsSettings(highReadoutUnitCfg,
ReadoutLayerSettings readoutLayerCfg = new ReadoutLayerSettings(new CrossvalidationSettings(foldDataRatio),
new ReadoutUnitsSettings(highReadoutUnitCfg,
lowReadoutUnitCfg
),
testDataRatio,
ReadoutLayerSettings.AutoFolds,
ReadoutLayerSettings.DefaultRepetitions,
defaultNetworksCfg
);
return readoutLayerCfg;
Expand Down
Loading

0 comments on commit fbab7d7

Please sign in to comment.