/// <summary> /// Creates the reservoir structure configuration consisting of two interconnected pools. /// </summary> /// <param name="structName">The name of the reservoir structure.</param> /// <param name="pool1Name">The name of the first pool.</param> /// <param name="pool2Name">The name of the second pool.</param> private ReservoirStructureSettings CreateResStructCfg(string structName, string pool1Name, string pool2Name) { //Our pools will have the 5x5x5 cube shape each. So 125 neurons in each pool and 250 neurons in total. const int DimX = 5, DimY = 5, DimZ = 5; //Each pool will have random internal interconnection of the density = 0.05. In our case it means that //each neuron will receive synapses from 0.05 * 125 = 6 other randomly selected neurons. const double RandomInterconnectionDensity = 0.05; //Create pools PoolSettings pool1Cfg = CreateAnalogPoolCfg(pool1Name, DimX, DimY, DimZ, RandomInterconnectionDensity); PoolSettings pool2Cfg = CreateAnalogPoolCfg(pool2Name, DimX, DimY, DimZ, RandomInterconnectionDensity); //Pool to pool interconnection //Connections from Pool1 to Pool2. We use targetPoolDensity=1 and sourcePoolDensity=0.02, so each neuron from //Pool2 will be randomly connected to 125 * 0.02 = 3 neurons from Pool1 InterPoolConnSettings pool1To2ConnCfg = new InterPoolConnSettings(pool2Name, 1d, pool1Name, 0.02d); //Connections from Pool2 to Pool1. We use targetPoolDensity=1 and sourcePoolDensity=0.02, so each neuron from //Pool1 will be randomly connected to 125 * 0.02 = 3 neurons from Pool2 InterPoolConnSettings pool2To1ConnCfg = new InterPoolConnSettings(pool1Name, 1d, pool2Name, 0.02d); //Create the reservoir structure configuration ReservoirStructureSettings resStructCfg = new ReservoirStructureSettings(structName, new PoolsSettings(pool1Cfg, pool2Cfg), new InterPoolConnsSettings(pool1To2ConnCfg, pool2To1ConnCfg) ); return(resStructCfg); }
/// <summary> /// Builds the predictors mapper. /// </summary> private PredictorsMapper BuildPredictorsMapper() { if (NP == null) { //Neural preprocessor is bypassed -> no mapper return(null); } else { //Create empty instance of the mapper PredictorsMapper mapper = new PredictorsMapper(NP.OutputFeatureGeneralSwitchCollection); if (Config.MapperCfg != null) { //Routed input field names string[] routedInputFieldNames = Config.NeuralPreprocessorCfg.InputEncoderCfg.GetRoutedFieldNames().ToArray(); //Iterate all readout units foreach (string readoutUnitName in Config.ReadoutLayerCfg.OutputFieldNameCollection) { bool[] switches = new bool[NP.OutputFeatureGeneralSwitchCollection.Length]; //Exists specific mapping? ReadoutUnitMapSettings unitMap = Config.MapperCfg.GetMapCfg(readoutUnitName, false); if (unitMap != null) { //Initially disable all predictors switches.Populate(false); for (int i = 0; i < NP.PredictorDescriptorCollection.Count; i++) { if (!NP.PredictorDescriptorCollection[i].IsInputValue) { string reservoirInstanceName = Config.NeuralPreprocessorCfg.ReservoirInstancesCfg.ReservoirInstanceCfgCollection[NP.PredictorDescriptorCollection[i].ReservoirID].Name; ReservoirStructureSettings rss = Config.NeuralPreprocessorCfg.ReservoirStructuresCfg.GetReservoirStructureCfg(Config.NeuralPreprocessorCfg.ReservoirInstancesCfg.ReservoirInstanceCfgCollection[NP.PredictorDescriptorCollection[i].ReservoirID].StructureCfgName); string poolName = rss.PoolsCfg.PoolCfgCollection[NP.PredictorDescriptorCollection[i].PoolID].Name; switches[i] = unitMap.IsAllowedPredictor(reservoirInstanceName, poolName, (PredictorsProvider.PredictorID)NP.PredictorDescriptorCollection[i].PredictorID); } else { switches[i] = unitMap.IsAllowedInputField(NP.PredictorDescriptorCollection[i].InputFieldName); } } } else { //Allow all valid predictors NP.OutputFeatureGeneralSwitchCollection.CopyTo(switches, 0); } //Add mapping to mapper mapper.Add(readoutUnitName, switches); } } return(mapper); } }
//Constructor /// <summary> /// Creates an initialized instance. /// </summary> /// <param name="preprocessorCfg">The configuration of the neural preprocessor.</param> /// <param name="randomizerSeek">The random number generator initial seek.</param> public NeuralPreprocessor(NeuralPreprocessorSettings preprocessorCfg, int randomizerSeek) { _preprocessorCfg = (NeuralPreprocessorSettings)preprocessorCfg.DeepClone(); TotalNumOfHiddenNeurons = 0; /////////////////////////////////////////////////////////////////////////////////// //Input encoder _inputEncoder = new InputEncoder(_preprocessorCfg.InputEncoderCfg); /////////////////////////////////////////////////////////////////////////////////// //Reservoir instance(s) BootCycles = 0; //Random generator used for reservoir structure initialization Random rand = (randomizerSeek < 0 ? new Random() : new Random(randomizerSeek)); ReservoirCollection = new List <ReservoirInstance>(_preprocessorCfg.ReservoirInstancesCfg.ReservoirInstanceCfgCollection.Count); int reservoirInstanceID = 0; int defaultBootCycles = 0; foreach (ReservoirInstanceSettings reservoirInstanceCfg in _preprocessorCfg.ReservoirInstancesCfg.ReservoirInstanceCfgCollection) { ReservoirStructureSettings structCfg = _preprocessorCfg.ReservoirStructuresCfg.GetReservoirStructureCfg(reservoirInstanceCfg.StructureCfgName); ReservoirInstance reservoir = new ReservoirInstance(reservoirInstanceID++, structCfg, reservoirInstanceCfg, _inputEncoder, rand ); ReservoirCollection.Add(reservoir); TotalNumOfHiddenNeurons += reservoir.Size; defaultBootCycles = Math.Max(defaultBootCycles, reservoir.GetDefaultBootCycles()); } //Boot cycles setup if (_preprocessorCfg.InputEncoderCfg.FeedingCfg.FeedingType == InputEncoder.InputFeedingType.Continuous) { FeedingContinuousSettings feedingCfg = (FeedingContinuousSettings)preprocessorCfg.InputEncoderCfg.FeedingCfg; BootCycles = feedingCfg.BootCycles == FeedingContinuousSettings.AutoBootCyclesNum ? defaultBootCycles : feedingCfg.BootCycles; } else { BootCycles = 0; } //Output features _totalNumOfReservoirsPredictors = 0; _predictorsTimePointSlicesPlan = null; PredictorDescriptorCollection = null; OutputFeatureGeneralSwitchCollection = null; NumOfActivePredictors = 0; return; }
/// <summary> /// Creates the neural preprocessor configuration. /// </summary> /// <param name="resInstName">The reservoir instance name.</param> /// <param name="resStructName">The reservoir structure configuration name.</param> /// <param name="pool1Name">The name of the pool1.</param> /// <param name="pool2Name">The name of the pool2.</param> NeuralPreprocessorSettings CreatePreprocessorCfg(string resInstName, string resStructName, string pool1Name, string pool2Name) { //Create input configuration InputEncoderSettings inputCfg = CreateInputCfg(); //Create reservoir structure configuration ReservoirStructureSettings resStructCfg = CreateResStructCfg(resStructName, pool1Name, pool2Name); //Create reservoir instance configuration ReservoirInstanceSettings resInstCfg = CreateResInstCfg(resInstName, resStructName, pool1Name, pool2Name, 0, 1); //Create reservoir preprocessor configuration NeuralPreprocessorSettings preprocessorCfg = new NeuralPreprocessorSettings(inputCfg, new ReservoirStructuresSettings(resStructCfg), new ReservoirInstancesSettings(resInstCfg), NeuralPreprocessorSettings.DefaultPredictorsReductionRatio ); return(preprocessorCfg); }
//Methods /// <summary> /// Checks consistency /// </summary> protected override void Check() { if (MapperCfg != null && NeuralPreprocessorCfg == null) { throw new ArgumentException($"Mapper can not be specified when neural preprocessor is not defined.", "MapperCfg"); } if (MapperCfg != null) { foreach (ReadoutUnitMapSettings map in MapperCfg.MapCfgCollection) { ReadoutUnitSettings rus = ReadoutLayerCfg.ReadoutUnitsCfg.GetReadoutunitCfg(map.ReadoutUnitName); //Pools if (map.AllowedPoolsCfg != null) { foreach (AllowedPoolSettings aps in map.AllowedPoolsCfg.AllowedPoolCfgCollection) { ReservoirInstanceSettings ris = NeuralPreprocessorCfg.ReservoirInstancesCfg.GetReservoirInstanceCfg(aps.ReservoirInstanceName); ReservoirStructureSettings rss = NeuralPreprocessorCfg.ReservoirStructuresCfg.GetReservoirStructureCfg(ris.StructureCfgName); rss.PoolsCfg.GetPoolID(aps.PoolName); } } //Input fields if (map.AllowedInputFieldsCfg != null) { string[] routedFieldNames = NeuralPreprocessorCfg.InputEncoderCfg.GetRoutedFieldNames().ToArray(); foreach (AllowedInputFieldSettings aifs in map.AllowedInputFieldsCfg.AllowedInputFieldCfgCollection) { if (Array.IndexOf(routedFieldNames, aifs.Name) == -1) { throw new ArgumentException($"Specified input field {aifs.Name} to be allowed for readout unit {map.ReadoutUnitName} is not among fields routed to readout layer.", "MapperCfg"); } } } } } return; }
/// <summary> /// Creates the simplified configuration of the state machine following the pure LSM design. /// </summary> /// <param name="totalSize">The total number of hidden neurons.</param> /// <param name="spikingActivationCfg">The configuration of the spiking activation function.</param> /// <param name="excitabilityCfg">The homogenous excitability configuration.</param> /// <param name="inputConnectionDensity">The density of the input field connections to hidden neurons.</param> /// <param name="maxInputDelay">The maximum delay of an input synapse.</param> /// <param name="interconnectionDensity">The density of the hidden neurons recurrent interconnection.</param> /// <param name="maxInternalDelay">The maximum delay of an internal synapse.</param> /// <param name="steadyBias">The constant bias (0 means no bias).</param> /// <param name="predictorsProviderCfg">The configuration of the predictors provider.</param> public StateMachineSettings CreatePureLSMCfg(int totalSize, IActivationSettings spikingActivationCfg, HomogenousExcitabilitySettings excitabilityCfg, double inputConnectionDensity, int maxInputDelay, double interconnectionDensity, int maxInternalDelay, double steadyBias, PredictorsProviderSettings predictorsProviderCfg ) { //Check NP is not bypassed if (BypassedNP) { throw new InvalidOperationException("Neural preprocessor is bypassed thus LSM design can't be created."); } //Activation check if (ActivationFactory.CreateAF(spikingActivationCfg, new Random()).TypeOfActivation != ActivationType.Spiking) { throw new ArgumentException("Specified activation must be spiking.", "spikingActivationCfg"); } //One neuron group SpikingNeuronGroupSettings grp = CreateSpikingGroup(spikingActivationCfg, predictorsProviderCfg, excitabilityCfg, steadyBias); //Simple spiking pool PoolSettings poolCfg = new PoolSettings(BuildPoolName(ActivationContent.Spiking, 0), new ProportionsSettings(totalSize, 1, 1), new NeuronGroupsSettings(grp), new InterconnSettings(new RandomSchemaSettings(interconnectionDensity, 0d, false, false)) ); //Simple reservoir structure ReservoirStructureSettings resStructCfg = new ReservoirStructureSettings(BuildResStructName(ActivationContent.Spiking, 0), new PoolsSettings(poolCfg) ); //Input connections configuration List <InputConnSettings> inputConns = new List <InputConnSettings>(InputEncoderCfg.VaryingFieldsCfg.ExternalFieldsCfg.FieldCfgCollection.Count); foreach (ExternalFieldSettings fieldCfg in InputEncoderCfg.VaryingFieldsCfg.ExternalFieldsCfg.FieldCfgCollection) { InputConnSettings inputConnCfg = new InputConnSettings(fieldCfg.Name, poolCfg.Name, inputConnectionDensity, 0 ); inputConns.Add(inputConnCfg); } //Synapse general configuration SpikingSourceSTInputSettings spikingSourceSTInputSettings = new SpikingSourceSTInputSettings(new URandomValueSettings(0, 1), new PlasticitySTInputSettings(new NonlinearDynamicsSTInputSettings())); SpikingSourceSTExcitatorySettings spikingSourceSTExcitatorySettings = new SpikingSourceSTExcitatorySettings(new URandomValueSettings(0, 1), new PlasticitySTExcitatorySettings(new NonlinearDynamicsSTExcitatorySettings())); SpikingSourceSTInhibitorySettings spikingSourceSTInhibitorySettings = new SpikingSourceSTInhibitorySettings(new URandomValueSettings(0, 1), new PlasticitySTInhibitorySettings(new NonlinearDynamicsSTInhibitorySettings())); SynapseSTInputSettings synapseSTInputSettings = new SynapseSTInputSettings(Synapse.SynapticDelayMethod.Random, maxInputDelay, null, spikingSourceSTInputSettings); SynapseSTExcitatorySettings synapseSTExcitatorySettings = new SynapseSTExcitatorySettings(Synapse.SynapticDelayMethod.Random, maxInternalDelay, 4, null, spikingSourceSTExcitatorySettings); SynapseSTInhibitorySettings synapseSTInhibitorySettings = new SynapseSTInhibitorySettings(Synapse.SynapticDelayMethod.Random, maxInternalDelay, 1, null, spikingSourceSTInhibitorySettings); SynapseSTSettings synapseSTCfg = new SynapseSTSettings(synapseSTInputSettings, synapseSTExcitatorySettings, synapseSTInhibitorySettings); SynapseSettings synapseCfg = new SynapseSettings(synapseSTCfg, null); //Create reservoir instance ReservoirInstanceSettings resInstCfg = new ReservoirInstanceSettings(GetResInstName(ResDesign.PureLSM, 0), resStructCfg.Name, new InputConnsSettings(inputConns), synapseCfg ); //Build and return SM configuration return(new StateMachineSettings(new NeuralPreprocessorSettings(InputEncoderCfg, new ReservoirStructuresSettings(resStructCfg), new ReservoirInstancesSettings(resInstCfg) ), ReadoutLayerCfg )); }
/// <summary> /// Creates the simplified configuration of the state machine following the pure ESN design. /// </summary> /// <param name="totalSize">The total number of hidden neurons.</param> /// <param name="maxInputStrength">The max sum of weights of input synapses per an analog hidden neuron (see the constant DefaultAnalogMaxInputStrength).</param> /// <param name="inputConnectionDensity">The density of the input field connections to hidden neurons.</param> /// <param name="maxInputDelay">The maximum delay of an input synapse.</param> /// <param name="interconnectionDensity">The density of the hidden neurons recurrent interconnection.</param> /// <param name="maxInternalDelay">The maximum delay of an internal synapse.</param> /// <param name="maxAbsBias">The maximum absolute value of the bias (0 means no bias).</param> /// <param name="maxRetainmentStrength">The maximum retainment strength (0 means no retainment).</param> /// <param name="predictorsProviderCfg">The configuration of the predictors provider.</param> public StateMachineSettings CreatePureESNCfg(int totalSize, double maxInputStrength, double inputConnectionDensity, int maxInputDelay, double interconnectionDensity, int maxInternalDelay, double maxAbsBias, double maxRetainmentStrength, PredictorsProviderSettings predictorsProviderCfg ) { //Check NP is not bypassed if (BypassedNP) { throw new InvalidOperationException("Neural preprocessor is bypassed thus ESN design can't be created."); } //Default ESN activation IActivationSettings analogActivationCfg = new AFAnalogTanHSettings(); //One neuron group AnalogNeuronGroupSettings grp = CreateAnalogGroup(analogActivationCfg, predictorsProviderCfg, maxAbsBias, maxRetainmentStrength); //Simple analog pool PoolSettings poolCfg = new PoolSettings(BuildPoolName(ActivationContent.Analog, 0), new ProportionsSettings(totalSize, 1, 1), new NeuronGroupsSettings(grp), new InterconnSettings(new RandomSchemaSettings(interconnectionDensity)) ); //Simple reservoir structure ReservoirStructureSettings resStructCfg = new ReservoirStructureSettings(BuildResStructName(ActivationContent.Analog, 0), new PoolsSettings(poolCfg) ); //Input connections configuration List <InputConnSettings> inputConns = new List <InputConnSettings>(InputEncoderCfg.VaryingFieldsCfg.ExternalFieldsCfg.FieldCfgCollection.Count); foreach (ExternalFieldSettings fieldCfg in InputEncoderCfg.VaryingFieldsCfg.ExternalFieldsCfg.FieldCfgCollection) { InputConnSettings inputConnCfg = new InputConnSettings(fieldCfg.Name, poolCfg.Name, 0, inputConnectionDensity ); inputConns.Add(inputConnCfg); } //Synapse general configuration SynapseATInputSettings synapseATInputSettings = new SynapseATInputSettings(Synapse.SynapticDelayMethod.Random, maxInputDelay, new AnalogSourceSettings(new URandomValueSettings(0d, maxInputStrength))); SynapseATIndifferentSettings synapseATIndifferentSettings = new SynapseATIndifferentSettings(Synapse.SynapticDelayMethod.Random, maxInternalDelay); SynapseATSettings synapseATCfg = new SynapseATSettings(SynapseATSettings.DefaultSpectralRadiusNum, synapseATInputSettings, synapseATIndifferentSettings); SynapseSettings synapseCfg = new SynapseSettings(null, synapseATCfg); //Create reservoir instance ReservoirInstanceSettings resInstCfg = new ReservoirInstanceSettings(GetResInstName(ResDesign.PureESN, 0), resStructCfg.Name, new InputConnsSettings(inputConns), synapseCfg ); //Build and return SM configuration return(new StateMachineSettings(new NeuralPreprocessorSettings(InputEncoderCfg, new ReservoirStructuresSettings(resStructCfg), new ReservoirInstancesSettings(resInstCfg) ), ReadoutLayerCfg )); }
/// <summary> /// Creates StateMachine configuration following pure LSM design /// </summary> /// <param name="proportionsCfg">LSM pool proportions</param> /// <param name="aFnCfg">Spiking activation function configuration</param> /// <param name="hes">Homogenous excitability configuration</param> /// <param name="inputConnectionDensity">Density of the input field connections to hidden neurons</param> /// <param name="maxInputDelay">Maximum delay of input synapse</param> /// <param name="interconnectionDensity">Density of the hidden neurons interconnection</param> /// <param name="maxInternalDelay">Maximum delay of internal synapse</param> /// <param name="steadyBias">Constant bias (0 means bias is not required)</param> /// <param name="predictorsParamsCfg">Predictors parameters (use null for defaults)</param> /// <param name="allowedPredictor">Allowed predictor(s)</param> public StateMachineSettings CreatePureLSMCfg(ProportionsSettings proportionsCfg, RCNetBaseSettings aFnCfg, HomogenousExcitabilitySettings hes, double inputConnectionDensity, int maxInputDelay, double interconnectionDensity, int maxInternalDelay, double steadyBias, PredictorsParamsSettings predictorsParamsCfg, params PredictorsProvider.PredictorID[] allowedPredictor ) { //Activation check if (ActivationFactory.Create(aFnCfg, new Random()).TypeOfActivation != ActivationType.Spiking) { throw new ArgumentException("Specified activation must be spiking.", "aFnCfg"); } //One neuron group SpikingNeuronGroupSettings grp = CreateSpikingGroup(aFnCfg, hes, steadyBias); //Simple spiking pool PoolSettings poolCfg = new PoolSettings(GetPoolName(ActivationContent.Spiking, 0), proportionsCfg, new NeuronGroupsSettings(grp), new InterconnSettings(new RandomSchemaSettings(interconnectionDensity, 0d, false, false)) ); //Simple reservoir structure ReservoirStructureSettings resStructCfg = new ReservoirStructureSettings(GetResStructName(ActivationContent.Spiking, 0), new PoolsSettings(poolCfg) ); //Input connections configuration List <InputConnSettings> inputConns = new List <InputConnSettings>(InputCfg.VaryingFieldsCfg.ExternalFieldsCfg.FieldCfgCollection.Count); foreach (ExternalFieldSettings fieldCfg in InputCfg.VaryingFieldsCfg.ExternalFieldsCfg.FieldCfgCollection) { InputConnSettings inputConnCfg = new InputConnSettings(fieldCfg.Name, poolCfg.Name, inputConnectionDensity, 0 ); inputConns.Add(inputConnCfg); } //Synapse general configuration SynapseSTInputSettings synapseSTInputSettings = new SynapseSTInputSettings(Synapse.SynapticDelayMethod.Random, maxInputDelay); SynapseSTExcitatorySettings synapseSTExcitatorySettings = new SynapseSTExcitatorySettings(Synapse.SynapticDelayMethod.Random, maxInternalDelay); SynapseSTInhibitorySettings synapseSTInhibitorySettings = new SynapseSTInhibitorySettings(Synapse.SynapticDelayMethod.Random, maxInternalDelay); SynapseSTSettings synapseSTCfg = new SynapseSTSettings(synapseSTInputSettings, synapseSTExcitatorySettings, synapseSTInhibitorySettings); SynapseSettings synapseCfg = new SynapseSettings(synapseSTCfg, null); //Initially set all switches to false - all available predictors are forbidden bool[] predictorSwitches = new bool[PredictorsProvider.NumOfSupportedPredictors]; predictorSwitches.Populate(false); //Enable specified predictors foreach (PredictorsProvider.PredictorID predictorID in allowedPredictor) { predictorSwitches[(int)predictorID] = true; } //Create predictors configuration using default params PredictorsSettings predictorsCfg = new PredictorsSettings(predictorSwitches, predictorsParamsCfg); //Create reservoir instance ReservoirInstanceSettings resInstCfg = new ReservoirInstanceSettings(GetResInstName(ResDesign.PureLSM, 0), resStructCfg.Name, new InputConnsSettings(inputConns), synapseCfg, predictorsCfg ); //Build and return SM configuration return(new StateMachineSettings(new NeuralPreprocessorSettings(InputCfg, new ReservoirStructuresSettings(resStructCfg), new ReservoirInstancesSettings(resInstCfg) ), ReadoutCfg )); }
/// <summary> /// Creates StateMachine configuration following pure ESN design /// </summary> /// <param name="totalSize">Total number of hidden neurons</param> /// <param name="inputConnectionDensity">Density of the input field connections to hidden neurons</param> /// <param name="maxInputDelay">Maximum delay of input synapse</param> /// <param name="interconnectionDensity">Density of the hidden neurons interconnection</param> /// <param name="maxInternalDelay">Maximum delay of internal synapse</param> /// <param name="maxAbsBias">Maximum absolute value of the bias (0 means bias is not required)</param> /// <param name="maxRetainmentStrength">Maximum retainment strength (0 means retainment property is not required)</param> /// <param name="predictorsParamsCfg">Predictors parameters (use null for defaults)</param> /// <param name="allowedPredictor">Allowed predictor(s)</param> public StateMachineSettings CreatePureESNCfg(int totalSize, double inputConnectionDensity, int maxInputDelay, double interconnectionDensity, int maxInternalDelay, double maxAbsBias, double maxRetainmentStrength, PredictorsParamsSettings predictorsParamsCfg, params PredictorsProvider.PredictorID[] allowedPredictor ) { const double MaxInputWeightSum = 2.75d; //Default ESN activation RCNetBaseSettings aFnCfg = new TanHSettings(); //One neuron group AnalogNeuronGroupSettings grp = CreateAnalogGroup(aFnCfg, maxAbsBias, maxRetainmentStrength); //Simple analog pool PoolSettings poolCfg = new PoolSettings(GetPoolName(ActivationContent.Analog, 0), new ProportionsSettings(totalSize, 1, 1), new NeuronGroupsSettings(grp), new InterconnSettings(new RandomSchemaSettings(interconnectionDensity)) ); //Simple reservoir structure ReservoirStructureSettings resStructCfg = new ReservoirStructureSettings(GetResStructName(ActivationContent.Analog, 0), new PoolsSettings(poolCfg) ); //Input connections configuration List <InputConnSettings> inputConns = new List <InputConnSettings>(InputCfg.VaryingFieldsCfg.ExternalFieldsCfg.FieldCfgCollection.Count); double maxInpSynWeight = MaxInputWeightSum / InputCfg.VaryingFieldsCfg.ExternalFieldsCfg.FieldCfgCollection.Count; foreach (ExternalFieldSettings fieldCfg in InputCfg.VaryingFieldsCfg.ExternalFieldsCfg.FieldCfgCollection) { InputConnSettings inputConnCfg = new InputConnSettings(fieldCfg.Name, poolCfg.Name, 0, inputConnectionDensity ); inputConns.Add(inputConnCfg); } //Synapse general configuration AnalogSourceSettings asc = new AnalogSourceSettings(new URandomValueSettings(0, maxInpSynWeight)); SynapseATInputSettings synapseATInputSettings = new SynapseATInputSettings(Synapse.SynapticDelayMethod.Random, maxInputDelay, asc, null); SynapseATIndifferentSettings synapseATIndifferentSettings = new SynapseATIndifferentSettings(Synapse.SynapticDelayMethod.Random, maxInternalDelay); SynapseATSettings synapseATCfg = new SynapseATSettings(SynapseATSettings.DefaultSpectralRadiusNum, synapseATInputSettings, synapseATIndifferentSettings); SynapseSettings synapseCfg = new SynapseSettings(null, synapseATCfg); //Initially set all switches to false - all available predictors are forbidden bool[] predictorSwitches = new bool[PredictorsProvider.NumOfSupportedPredictors]; predictorSwitches.Populate(false); //Enable specified predictors foreach (PredictorsProvider.PredictorID predictorID in allowedPredictor) { predictorSwitches[(int)predictorID] = true; } //Create predictors configuration using default params PredictorsSettings predictorsCfg = new PredictorsSettings(predictorSwitches, predictorsParamsCfg); //Create reservoir instance ReservoirInstanceSettings resInstCfg = new ReservoirInstanceSettings(GetResInstName(ResDesign.PureESN, 0), resStructCfg.Name, new InputConnsSettings(inputConns), synapseCfg, predictorsCfg ); //Build and return SM configuration return(new StateMachineSettings(new NeuralPreprocessorSettings(InputCfg, new ReservoirStructuresSettings(resStructCfg), new ReservoirInstancesSettings(resInstCfg) ), ReadoutCfg )); }