diff --git a/Demo/DemoConsoleApp/SM/SMDemoSettings.xml b/Demo/DemoConsoleApp/SM/SMDemoSettings.xml index f9c4626..d4dd113 100644 --- a/Demo/DemoConsoleApp/SM/SMDemoSettings.xml +++ b/Demo/DemoConsoleApp/SM/SMDemoSettings.xml @@ -1,129 +1,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/RCNet/Neural/Network/NonRecurrent/TrainedNetworkBuilder.cs b/RCNet/Neural/Network/NonRecurrent/TrainedNetworkBuilder.cs index 3315139..c0c6825 100644 --- a/RCNet/Neural/Network/NonRecurrent/TrainedNetworkBuilder.cs +++ b/RCNet/Neural/Network/NonRecurrent/TrainedNetworkBuilder.cs @@ -117,22 +117,37 @@ public static bool IsBetter(bool binaryOutput, TrainedNetwork candidate, Trained { if (binaryOutput) { - if (candidate.CombinedBinaryError < currentBest.CombinedBinaryError) + if(candidate.CombinedBinaryError > currentBest.CombinedBinaryError) + { + return false; + } + else if (candidate.CombinedBinaryError < currentBest.CombinedBinaryError) + { + return true; + } + //CombinedBinaryError is the same + else if (candidate.TestingBinErrorStat.BinValErrStat[0].Sum > currentBest.TestingBinErrorStat.BinValErrStat[0].Sum) + { + return false; + } + else if(candidate.TestingBinErrorStat.BinValErrStat[0].Sum < currentBest.TestingBinErrorStat.BinValErrStat[0].Sum) { return true; } - else if (candidate.CombinedBinaryError == currentBest.CombinedBinaryError && - (candidate.TestingBinErrorStat.BinValErrStat[0].Sum < currentBest.TestingBinErrorStat.BinValErrStat[0].Sum || - (candidate.TestingBinErrorStat.BinValErrStat[0].Sum == currentBest.TestingBinErrorStat.BinValErrStat[0].Sum && candidate.TrainingBinErrorStat.BinValErrStat[0].Sum < currentBest.TrainingBinErrorStat.BinValErrStat[0].Sum) - )) + //CombinedBinaryError is the same + //TestingBinErrorStat.BinValErrStat[0].Sum is the same + else if (candidate.TrainingBinErrorStat.BinValErrStat[0].Sum > currentBest.TrainingBinErrorStat.BinValErrStat[0].Sum) + { + return false; + } + else if (candidate.TrainingBinErrorStat.BinValErrStat[0].Sum < currentBest.TrainingBinErrorStat.BinValErrStat[0].Sum) { return true; } - else if (candidate.CombinedBinaryError == currentBest.CombinedBinaryError && - candidate.TestingBinErrorStat.BinValErrStat[0].Sum == currentBest.TestingBinErrorStat.BinValErrStat[0].Sum && - candidate.TrainingBinErrorStat.BinValErrStat[0].Sum == currentBest.TrainingBinErrorStat.BinValErrStat[0].Sum && - candidate.CombinedPrecisionError < currentBest.CombinedPrecisionError - ) + //CombinedBinaryError is the same + //TestingBinErrorStat.BinValErrStat[0].Sum is the same + //TrainingBinErrorStat.BinValErrStat[0].Sum is the same + else if (candidate.CombinedPrecisionError < currentBest.CombinedPrecisionError) { return true; } diff --git a/RCNet/Neural/Network/SM/PM/ReadoutUnitMapSettings.cs b/RCNet/Neural/Network/SM/PM/ReadoutUnitMapSettings.cs index 7548b65..6d4a4f6 100644 --- a/RCNet/Neural/Network/SM/PM/ReadoutUnitMapSettings.cs +++ b/RCNet/Neural/Network/SM/PM/ReadoutUnitMapSettings.cs @@ -103,6 +103,11 @@ public override bool ContainsOnlyDefaults //Methods + /// + /// Determines whether the predictor's origin is allowed + /// + /// Reservoir instance name + /// Pool name private bool IsAllowedPredictorOrigin(string resName, string poolName) { if(AllowedPoolsCfg != null) @@ -112,6 +117,10 @@ private bool IsAllowedPredictorOrigin(string resName, string poolName) return false; } + /// + /// Determines whether Predictor is allowed + /// + /// Predictor identificator private bool IsAllowedPredictorID(PredictorsProvider.PredictorID predictorID) { if(AllowedPredictorsCfg != null) @@ -121,6 +130,12 @@ private bool IsAllowedPredictorID(PredictorsProvider.PredictorID predictorID) return false; } + /// + /// Determines whether the Predictor's origin and Predictor are both allowed + /// + /// Reservoir instance name + /// Pool name + /// Predictor identificator public bool IsAllowedPredictor(string resName, string poolName, PredictorsProvider.PredictorID predictorID) { if(IsAllowedPredictorOrigin(resName, poolName)) @@ -130,6 +145,10 @@ public bool IsAllowedPredictor(string resName, string poolName, PredictorsProvid return false; } + /// + /// Determines whether given input field is allowed + /// + /// Name of the input field public bool IsAllowedInputField(string inputFieldName) { if(AllowedInputFieldsCfg != null) diff --git a/RCNet/Neural/Network/SM/Preprocessing/Input/InputEncoder.cs b/RCNet/Neural/Network/SM/Preprocessing/Input/InputEncoder.cs index 558f9e8..237a711 100644 --- a/RCNet/Neural/Network/SM/Preprocessing/Input/InputEncoder.cs +++ b/RCNet/Neural/Network/SM/Preprocessing/Input/InputEncoder.cs @@ -607,7 +607,6 @@ public List GetInputValuesPredictorsDescriptors() //Build descriptors List result = new List(_routedSteadyFieldIndexCollection.Count + _routedVaryingFieldCollection.Count * NumOfTimePoints); //Steady fields - foreach(int idx in _routedSteadyFieldIndexCollection) { result.Add(new PredictorDescriptor(((FeedingPatternedSettings)_encoderCfg.FeedingCfg).SteadyFieldsCfg.FieldCfgCollection[idx].Name)); diff --git a/Readme.md b/Readme.md index deb0311..d230813 100644 --- a/Readme.md +++ b/Readme.md @@ -42,7 +42,7 @@ Several examples show how to simply setup State Machine using State Machine Desi ### Data format for the demo application Input data is standardly located in the Data sub-folder relative to the location of the executable DemoConsoleApp.exe. Data is expected in csv format and data delimiter can be a tab, semicolon or comma character. * **Continuous feeding regime** requires a standard csv format, where the first line contains the names of the data fields and each next line contains the data. [Here](https://github.com/okozelsk/NET/blob/master/Demo/DemoConsoleApp/Data/TTOO.csv) is an example -* **Patterned feeding regime** requires specific logical csv format without colum names (header). Each data line contains values of repetitive pattern features followed by expected output values at the end. Values of repetitive pattern features can be organized in two ways: groupped [v1(t1),v2(t1),v1(t2),v2(t2),v1(t3),v2(t3)] or sequential [v1(t1),v1(t2),v1(t3),v2(t1),v2(t2),v2(t3)]. [Here](https://github.com/okozelsk/NET/blob/master/Demo/DemoConsoleApp/Data/LibrasMovement.csv) is an example +* **Patterned feeding regime** requires specific logical csv format without colum names (header). Each data line contains values of steady (optional) and repetitive pattern features followed by expected output values at the end. Values of repetitive pattern features can be organized in two ways: groupped [v1(t1),v2(t1),v1(t2),v2(t2),v1(t3),v2(t3)] or sequential [v1(t1),v1(t2),v1(t3),v2(t1),v2(t2),v2(t3)]. [Here](https://github.com/okozelsk/NET/blob/master/Demo/DemoConsoleApp/Data/LibrasMovement.csv) is an example ## Components overview