/// <summary> /// Runs the example code. /// </summary> public void Run() { //Create StateMachine configuration //Simplified input configuration InputEncoderSettings inputCfg = StateMachineDesigner.CreateInputCfg(new FeedingContinuousSettings(FeedingContinuousSettings.AutoBootCyclesNum), true, new ExternalFieldSettings("High", new RealFeatureFilterSettings()), new ExternalFieldSettings("Low", new RealFeatureFilterSettings()), new ExternalFieldSettings("Adj Close", new RealFeatureFilterSettings()) ); //Simplified readout layer configuration ReadoutLayerSettings readoutCfg = StateMachineDesigner.CreateForecastReadoutCfg(StateMachineDesigner.CreateSingleLayerRegrNet(new IdentitySettings(), 2, 1000), 0.1d, 1, "High", "Low" ); //Create designer instance StateMachineDesigner smd = new StateMachineDesigner(inputCfg, readoutCfg); //Create pure ESN fashioned StateMachine configuration StateMachineSettings stateMachineCfg = smd.CreatePureESNCfg(250, 1, 0, 0.2d, 0, 0.1d, 0.75d, null, PredictorsProvider.PredictorID.Activation, PredictorsProvider.PredictorID.ActivationSquare); //Display StateMachine xml configuration string xmlConfig = stateMachineCfg.GetXml(true).ToString(); _log.Write("StateMachine configuration xml:"); _log.Write("-------------------------------"); _log.Write(xmlConfig); _log.Write(string.Empty); _log.Write("Pres Enter to continue (StateMachine training)..."); _log.Write(string.Empty); Console.ReadLine(); //Instantiation and training _log.Write("StateMachine training:"); _log.Write("----------------------"); _log.Write(string.Empty); //StateMachine instance StateMachine stateMachine = new StateMachine(stateMachineCfg); //StateMachine training TrainStateMachine(stateMachine, ".\\Data\\TTOO.csv", out double[] predictionInputVector); //Forecast ReadoutLayer.ReadoutData readoutData = stateMachine.ComputeReadoutData(predictionInputVector); _log.Write(" Forecast next High and Low (real values are High=6.58$ and Low=5.99$):", false); _log.Write(stateMachine.RL.GetForecastReport(readoutData.DataVector, 6)); _log.Write(string.Empty); return; }
/// <summary> /// Runs the example code. /// </summary> public void Run() { //Create StateMachine configuration //Simplified input configuration InputEncoderSettings inputCfg = StateMachineDesigner.CreateInputCfg(new FeedingPatternedSettings(1, true, RCNet.Neural.Data.InputPattern.VariablesSchema.Groupped), false, new ExternalFieldSettings("coord_abcissa", new RealFeatureFilterSettings()), new ExternalFieldSettings("coord_ordinate", new RealFeatureFilterSettings()) ); //Simplified readout layer configuration ReadoutLayerSettings readoutCfg = StateMachineDesigner.CreateClassificationReadoutCfg(StateMachineDesigner.CreateSingleLayerRegrNet(new IdentitySettings(), 5, 400), 0.0825d, 1, "Hand movement", "curved swing", "horizontal swing", "vertical swing", "anti-clockwise arc", "clockwise arc", "circle", "horizontal straight-line", "vertical straight-line", "horizontal zigzag", "vertical zigzag", "horizontal wavy", "vertical wavy", "face-up curve", "face-down curve", "tremble" ); //Create designer instance StateMachineDesigner smd = new StateMachineDesigner(inputCfg, readoutCfg); //Create pure ESN fashioned StateMachine configuration StateMachineSettings stateMachineCfg = smd.CreatePureESNCfg(150, 0.25d, 5, 0.1d, 0, 0, 0, null, PredictorsProvider.PredictorID.FiringCount ); //Display StateMachine xml configuration string xmlConfig = stateMachineCfg.GetXml(true).ToString(); _log.Write("StateMachine configuration xml:"); _log.Write("-------------------------------"); _log.Write(xmlConfig); _log.Write(string.Empty); _log.Write("Pres Enter to continue (StateMachine training and verification)..."); _log.Write(string.Empty); Console.ReadLine(); //Instantiation and training _log.Write("StateMachine training:"); _log.Write("----------------------"); _log.Write(string.Empty); //StateMachine instance StateMachine stateMachine = new StateMachine(stateMachineCfg); //StateMachine training TrainStateMachine(stateMachine, ".\\Data\\LibrasMovement_train.csv", out _); _log.Write(string.Empty); //StateMachine verification _log.Write("StateMachine verification:"); _log.Write("--------------------------"); _log.Write(string.Empty); VerifyStateMachine(stateMachine, ".\\Data\\LibrasMovement_verify.csv", null, out _); _log.Write(string.Empty); return; }
/// <summary> /// Runs the example code. /// </summary> public void Run() { //Create StateMachine configuration //Simplified input configuration InputEncoderSettings inputCfg = StateMachineDesigner.CreateInputCfg(new FeedingPatternedSettings(1, true, RCNet.Neural.Data.InputPattern.VariablesSchema.Groupped), false, new ExternalFieldSettings("coord_abcissa", new RealFeatureFilterSettings(), true, new SpikeCodeSettings(15, 1e-3, true, true, true, false)), new ExternalFieldSettings("coord_ordinate", new RealFeatureFilterSettings(), true, new SpikeCodeSettings(15, 1e-3, true, true, true, false)) ); //Simplified readout layer configuration ReadoutLayerSettings readoutCfg = StateMachineDesigner.CreateClassificationReadoutCfg(StateMachineDesigner.CreateSingleLayerRegrNet(new ElliotSettings(), 5, 400), 0.0825d, 1, "Hand movement", "curved swing", "horizontal swing", "vertical swing", "anti-clockwise arc", "clockwise arc", "circle", "horizontal straight-line", "vertical straight-line", "horizontal zigzag", "vertical zigzag", "horizontal wavy", "vertical wavy", "face-up curve", "face-down curve", "tremble" ); //Create designer instance StateMachineDesigner smd = new StateMachineDesigner(inputCfg, readoutCfg); //Create pure LSM fashioned StateMachine configuration StateMachineSettings stateMachineCfg = smd.CreatePureLSMCfg(new ProportionsSettings(60, 1, 1), //Proportions (it also determines total size) new AdExpIFSettings(), //Activation //new ExpIFSettings(null, null, null, null, null, null, null, 0), //Activation new HomogenousExcitabilitySettings(0.75, 0.75, 0.25), 1d, //Input connection density 0, //Input max delay 0.1d, //Interconnection density 0, //Internal synapses max delay 0, //Steady bias null, PredictorsProvider.PredictorID.FiringFadingSum ); //Display StateMachine xml configuration string xmlConfig = stateMachineCfg.GetXml(true).ToString(); _log.Write("StateMachine configuration xml:"); _log.Write("-------------------------------"); _log.Write(xmlConfig); _log.Write(string.Empty); _log.Write("Pres Enter to continue (StateMachine training and verification)..."); _log.Write(string.Empty); Console.ReadLine(); //Instantiation and training _log.Write("StateMachine training:"); _log.Write("----------------------"); _log.Write(string.Empty); //StateMachine instance StateMachine stateMachine = new StateMachine(stateMachineCfg); //StateMachine training TrainStateMachine(stateMachine, ".\\Data\\LibrasMovement_train.csv", out _); _log.Write(string.Empty); //StateMachine verification _log.Write("StateMachine verification:"); _log.Write("--------------------------"); _log.Write(string.Empty); VerifyStateMachine(stateMachine, ".\\Data\\LibrasMovement_verify.csv", null, out _); _log.Write(string.Empty); return; }