Beispiel #1
0
        /// <summary>
        /// Creates configuration of the group of analog neurons having a TanH activation.
        /// </summary>
        /// <param name="groupName">The name of the group</param>
        /// <param name="relShare">The relative share. It determines how big part of the pool neurons will be occupied by this neuron group.</param>
        private AnalogNeuronGroupSettings CreateTanHGroup(string groupName, double relShare)
        {
            //Each neuron within the group will have its own constant bias
            //selected from the range -0.05 to 0.05 using gaussian (normal) distribution
            RandomValueSettings biasCfg = new RandomValueSettings(-0.05, 0.05, false, new GaussianDistrSettings(0, 1));
            //We want retainment property to be set for every neuron within the group
            const double RetainmentDensity = 1d;
            //Each neuron will have its own constant retainment strength
            //selected from the range 0 to 0.75 using uniform distribution
            URandomValueSettings retainmentStrengthCfg = new URandomValueSettings(0, 0.75);
            RetainmentSettings   retainmentCfg         = new RetainmentSettings(RetainmentDensity, retainmentStrengthCfg);
            //Predictors configuration
            //We will use the Activation and ActivationPower predictors
            PredictorsProviderSettings predictorsCfg = new PredictorsProviderSettings(new PredictorActivationSettings(),
                                                                                      new PredictorActivationPowerSettings()
                                                                                      );



            //Create the neuron group configuration
            AnalogNeuronGroupSettings groupCfg = new AnalogNeuronGroupSettings(groupName,
                                                                               relShare,
                                                                               new AFAnalogTanHSettings(),
                                                                               predictorsCfg,
                                                                               AnalogNeuronGroupSettings.DefaultFiringThreshold,
                                                                               AnalogNeuronGroupSettings.DefaultThresholdMaxRefDeepness,
                                                                               biasCfg,
                                                                               retainmentCfg
                                                                               );

            return(groupCfg);
        }
Beispiel #2
0
 //Constructors
 /// <summary>
 /// Creates an initialized instance.
 /// </summary>
 /// <param name="density">Specifies the ratio of the neurons having the Retainment property.</param>
 /// <param name="strengthCfg">The configuration of the retainment strength.</param>
 public RetainmentSettings(double density, URandomValueSettings strengthCfg)
 {
     Density     = density;
     StrengthCfg = (URandomValueSettings)strengthCfg.DeepClone();
     Check();
     return;
 }
 //Constructors
 /// <summary>
 /// Creates an initialized instance.
 /// </summary>
 /// <remarks>
 /// The arguments are in RandomValue form to allow their dynamic random initialization within the specified ranges.
 /// </remarks>
 /// <param name="timeScale">The membrane time scale (ms).</param>
 /// <param name="resistance">The membrane resistance (Mohm).</param>
 /// <param name="restV">The membrane rest potential (mV).</param>
 /// <param name="resetV">The membrane reset potential (mV).</param>
 /// <param name="rheobaseV">The membrane rheobase threshold (mV).</param>
 /// <param name="firingThresholdV">The membrane firing threshold (mV).</param>
 /// <param name="sharpnessDeltaT">The sharpness of membrane potential change (mV).</param>
 /// <param name="adaptationVoltageCoupling">The adaptation voltage coupling (nS).</param>
 /// <param name="adaptationTimeConstant">The adaptation time constant (ms).</param>
 /// <param name="adaptationSpikeTriggeredIncrement">The spike triggered adaptation increment (pA).</param>
 /// <param name="solverMethod">The ODE numerical solver method to be used.</param>
 /// <param name="solverCompSteps">The number of computation sub-steps of the ODE numerical solver.</param>
 /// <param name="stimuliDuration">The duration of the membrane stimulation (ms).</param>
 public AFSpikingAdExpIFSettings(URandomValueSettings timeScale                         = null,
                                 URandomValueSettings resistance                        = null,
                                 RandomValueSettings restV                              = null,
                                 RandomValueSettings resetV                             = null,
                                 RandomValueSettings rheobaseV                          = null,
                                 RandomValueSettings firingThresholdV                   = null,
                                 URandomValueSettings sharpnessDeltaT                   = null,
                                 URandomValueSettings adaptationVoltageCoupling         = null,
                                 URandomValueSettings adaptationTimeConstant            = null,
                                 URandomValueSettings adaptationSpikeTriggeredIncrement = null,
                                 ODENumSolver.Method solverMethod                       = ActivationFactory.DefaultSolverMethod,
                                 int solverCompSteps    = ActivationFactory.DefaultSolverCompSteps,
                                 double stimuliDuration = ActivationFactory.DefaultStimuliDuration
                                 )
 {
     TimeScale                         = URandomValueSettings.CloneOrCreate(timeScale, TypicalTimeScale);
     Resistance                        = URandomValueSettings.CloneOrCreate(resistance, TypicalResistance);
     RestV                             = RandomValueSettings.CloneOrCreate(restV, TypicalRestV);
     ResetV                            = RandomValueSettings.CloneOrCreate(resetV, TypicalResetV);
     RheobaseV                         = RandomValueSettings.CloneOrCreate(rheobaseV, TypicalRheobaseV);
     FiringThresholdV                  = RandomValueSettings.CloneOrCreate(firingThresholdV, TypicalFiringThresholdV);
     SharpnessDeltaT                   = URandomValueSettings.CloneOrCreate(sharpnessDeltaT, TypicalSharpnessDeltaT);
     AdaptationVoltageCoupling         = URandomValueSettings.CloneOrCreate(adaptationVoltageCoupling, TypicalAdaptationVoltageCoupling);
     AdaptationTimeConstant            = URandomValueSettings.CloneOrCreate(adaptationTimeConstant, TypicalAdaptationTimeConstant);
     AdaptationSpikeTriggeredIncrement = URandomValueSettings.CloneOrCreate(adaptationSpikeTriggeredIncrement, TypicalAdaptationSpikeTriggeredIncrement);
     SolverMethod                      = solverMethod;
     SolverCompSteps                   = solverCompSteps;
     StimuliDuration                   = stimuliDuration;
     Check();
     return;
 }
Beispiel #4
0
 //Constructors
 /// <summary>
 /// Creates an initialized instance
 /// </summary>
 /// <param name="recoveryTimeScale">Time scale of the recovery variable</param>
 /// <param name="recoverySensitivity">Sensitivity of the recovery variable to the subthreshold fluctuations of the membrane potential</param>
 /// <param name="recoveryReset">After-spike reset of the recovery variable</param>
 /// <param name="restV">Membrane rest potential (mV)</param>
 /// <param name="resetV">Membrane reset potential (mV)</param>
 /// <param name="firingThresholdV">Membrane firing threshold (mV)</param>
 /// <param name="refractoryPeriods">Number of after spike computation cycles while an input stimuli is ignored (ms)</param>
 /// <param name="solverMethod">ODE numerical solver method</param>
 /// <param name="solverCompSteps">ODE numerical solver computation steps of the time step</param>
 /// <param name="stimuliDuration">Duration of the stimulation</param>
 public IzhikevichIFSettings(URandomValueSettings recoveryTimeScale   = null,
                             URandomValueSettings recoverySensitivity = null,
                             URandomValueSettings recoveryReset       = null,
                             RandomValueSettings restV            = null,
                             RandomValueSettings resetV           = null,
                             RandomValueSettings firingThresholdV = null,
                             int refractoryPeriods            = ActivationFactory.DefaultRefractoryPeriods,
                             ODENumSolver.Method solverMethod = ActivationFactory.DefaultSolverMethod,
                             int solverCompSteps    = ActivationFactory.DefaultSolverCompSteps,
                             double stimuliDuration = ActivationFactory.DefaultStimuliDuration
                             )
 {
     RecoveryTimeScale   = URandomValueSettings.CloneOrDefault(recoveryTimeScale, TypicalRecoveryTimeScale);
     RecoverySensitivity = URandomValueSettings.CloneOrDefault(recoverySensitivity, TypicalRecoverySensitivity);
     RecoveryReset       = URandomValueSettings.CloneOrDefault(recoveryReset, TypicalRecoveryReset);
     RestV             = RandomValueSettings.CloneOrDefault(restV, TypicalRestV);
     ResetV            = RandomValueSettings.CloneOrDefault(resetV, TypicalResetV);
     FiringThresholdV  = RandomValueSettings.CloneOrDefault(firingThresholdV, TypicalFiringThresholdV);
     RefractoryPeriods = refractoryPeriods;
     SolverMethod      = solverMethod;
     SolverCompSteps   = solverCompSteps;
     StimuliDuration   = stimuliDuration;
     Check();
     return;
 }
Beispiel #5
0
 //Constructors
 /// <summary>
 /// Creates an initialized instance.
 /// </summary>
 /// <remarks>
 /// The arguments are in RandomValue form to allow their dynamic random initialization within the specified ranges.
 /// </remarks>
 /// <param name="timeScale">The membrane time scale (ms).</param>
 /// <param name="resistance">The membrane resistance (Mohm).</param>
 /// <param name="restV">The membrane rest potential (mV).</param>
 /// <param name="resetV">The membrane reset potential (mV).</param>
 /// <param name="rheobaseV">The membrane rheobase threshold (mV).</param>
 /// <param name="firingThresholdV">The membrane firing threshold (mV).</param>
 /// <param name="sharpnessDeltaT">The sharpness of membrane potential change (mV).</param>
 /// <param name="refractoryPeriods">The number of after-spike computation cycles while an input stimuli to be ignored (cycles).</param>
 /// <param name="solverMethod">The ODE numerical solver method to be used.</param>
 /// <param name="solverCompSteps">The number of computation sub-steps of the ODE numerical solver.</param>
 /// <param name="stimuliDuration">The duration of the membrane stimulation (ms).</param>
 public AFSpikingExpIFSettings(URandomValueSettings timeScale       = null,
                               URandomValueSettings resistance      = null,
                               RandomValueSettings restV            = null,
                               RandomValueSettings resetV           = null,
                               RandomValueSettings rheobaseV        = null,
                               RandomValueSettings firingThresholdV = null,
                               URandomValueSettings sharpnessDeltaT = null,
                               int refractoryPeriods            = ActivationFactory.DefaultRefractoryPeriods,
                               ODENumSolver.Method solverMethod = ActivationFactory.DefaultSolverMethod,
                               int solverCompSteps    = ActivationFactory.DefaultSolverCompSteps,
                               double stimuliDuration = ActivationFactory.DefaultStimuliDuration
                               )
 {
     TimeScale         = URandomValueSettings.CloneOrCreate(timeScale, TypicalTimeScale);
     Resistance        = URandomValueSettings.CloneOrCreate(resistance, TypicalResistance);
     RestV             = RandomValueSettings.CloneOrCreate(restV, TypicalRestV);
     ResetV            = RandomValueSettings.CloneOrCreate(resetV, TypicalResetV);
     RheobaseV         = RandomValueSettings.CloneOrCreate(rheobaseV, TypicalRheobaseV);
     FiringThresholdV  = RandomValueSettings.CloneOrCreate(firingThresholdV, TypicalFiringThresholdV);
     SharpnessDeltaT   = URandomValueSettings.CloneOrCreate(sharpnessDeltaT, TypicalSharpnessDeltaT);
     RefractoryPeriods = refractoryPeriods;
     SolverMethod      = solverMethod;
     SolverCompSteps   = solverCompSteps;
     StimuliDuration   = stimuliDuration;
     Check();
     return;
 }
Beispiel #6
0
        /// <summary>
        /// Creates an instance and initializes it from given xml element.
        /// </summary>
        /// <param name="elem">Xml element containing the initialization settings</param>
        public SoftExponentialSettings(XElement elem)
        {
            //Validation
            XElement activationSettingsElem = Validate(elem, XsdTypeName);

            //Parsing
            Alpha = URandomValueSettings.LoadOrDefault(activationSettingsElem, "alpha", TypicalAlpha);
            return;
        }
Beispiel #7
0
        /// <summary>
        /// Creates an initialized instance.
        /// </summary>
        /// <param name="elem">A xml element containing the configuration data.</param>
        public AFAnalogElliotSettings(XElement elem)
        {
            //Validation
            XElement activationSettingsElem = Validate(elem, XsdTypeName);

            //Parsing
            Slope = URandomValueSettings.LoadOrCreate(activationSettingsElem, "slope", TypicalSlope);
            return;
        }
Beispiel #8
0
        /// <summary>
        /// Creates an instance and initializes it from given xml element.
        /// </summary>
        /// <param name="elem">Xml element containing the initialization settings</param>
        public LeakyReLUSettings(XElement elem)
        {
            //Validation
            XElement activationSettingsElem = Validate(elem, XsdTypeName);

            //Parsing
            NegSlope = URandomValueSettings.LoadOrDefault(activationSettingsElem, "negSlope", TypicalNegSlope);
            return;
        }
Beispiel #9
0
        /// <summary>
        /// Creates an initialized instance.
        /// <param name="elem">A xml element containing the configuration data.</param>
        /// </summary>
        public AFAnalogISRUSettings(XElement elem)
        {
            //Validation
            XElement activationSettingsElem = Validate(elem, XsdTypeName);

            //Parsing
            Alpha = URandomValueSettings.LoadOrCreate(activationSettingsElem, "alpha", TypicalAlpha);
            return;
        }
 //Constructors
 /// <summary>
 /// Creates an initialized instance
 /// </summary>
 /// <param name="weightCfg">Synapse's weight settings</param>
 /// <param name="plasticityCfg">Synapse's plasticity configuration</param>
 public SpikingSourceSTExcitatorySettings(URandomValueSettings weightCfg = null,
                                          PlasticitySTExcitatorySettings plasticityCfg = null
                                          )
 {
     WeightCfg     = weightCfg == null ? new URandomValueSettings(DefaultMinWeight, DefaultMaxWeight) : (URandomValueSettings)weightCfg.DeepClone();
     PlasticityCfg = plasticityCfg == null ? new PlasticitySTExcitatorySettings() : (PlasticitySTExcitatorySettings)plasticityCfg.DeepClone();
     Check();
     return;
 }
Beispiel #11
0
        /// <summary>
        /// Creates an initialized instance.
        /// </summary>
        /// <param name="elem">A xml element containing the configuration data.</param>
        public AnalogSourceSettings(XElement elem)
        {
            //Validation
            XElement settingsElem = Validate(elem, XsdTypeName);
            //Parsing
            XElement weightSettingsElem = settingsElem.Elements("weight").FirstOrDefault();

            WeightCfg = weightSettingsElem == null ? new URandomValueSettings(DefaultMinWeight, DefaultMaxWeight) : new URandomValueSettings(weightSettingsElem);
            Check();
            return;
        }
Beispiel #12
0
 /// <summary>
 /// Fills given array with random unsigned doubles.
 /// </summary>
 /// <param name="rand"></param>
 /// <param name="array">Array to be filled</param>
 /// <param name="settings">Encapsulated settings</param>
 /// <param name="count">Specifies how many elements of Array to be filled</param>
 public static void Fill(this Random rand, double[] array, URandomValueSettings settings, int count = -1)
 {
     if (count < 0)
     {
         count = array.Length;
     }
     for (int i = 0; i < count; i++)
     {
         array[i] = rand.NextDouble(settings);
     }
     return;
 }
Beispiel #13
0
        /// <summary>
        /// Creates an initialized instance.
        /// </summary>
        /// <param name="elem">A xml element containing the configuration data.</param>
        public RetainmentSettings(XElement elem)
        {
            //Validation
            XElement settingsElem = Validate(elem, XsdTypeName);

            //Parsing
            //Density
            Density = double.Parse(settingsElem.Attribute("density").Value, CultureInfo.InvariantCulture);
            //Strength
            StrengthCfg = new URandomValueSettings(settingsElem.Elements("strength").First());
            Check();
            return;
        }
Beispiel #14
0
        /// <summary>
        /// Returns a random double value according to the specified configuration.
        /// </summary>
        /// <param name="randomValueCfg">The random unsigned value configuration.</param>
        /// <param name="rand"></param>
        public static double NextDouble(this Random rand, URandomValueSettings randomValueCfg)
        {
            double value;

            switch (randomValueCfg.DistrType)
            {
            case RandomCommon.DistributionType.Uniform:
                value = rand.NextRangedUniformDouble(randomValueCfg.Min, randomValueCfg.Max);
                break;

            case RandomCommon.DistributionType.Gaussian:
                if (randomValueCfg.DistrCfg != null)
                {
                    UGaussianDistrSettings gaussianCfg = randomValueCfg.DistrCfg as UGaussianDistrSettings;
                    value = rand.NextRangedGaussianDouble(gaussianCfg.Mean, gaussianCfg.StdDev, randomValueCfg.Min, randomValueCfg.Max);
                }
                else
                {
                    throw new ArgumentException($"A specific configuration of the Gaussian distribution is missing.", "randomValueCfg");
                }
                break;

            case RandomCommon.DistributionType.Exponential:
                if (randomValueCfg.DistrCfg != null)
                {
                    UExponentialDistrSettings exponentialCfg = randomValueCfg.DistrCfg as UExponentialDistrSettings;
                    value = rand.NextRangedExponentialDouble(exponentialCfg.Mean, randomValueCfg.Min, randomValueCfg.Max);
                }
                else
                {
                    throw new ArgumentException($"A specific configuration of the Exponential distribution is missing.", "randomValueCfg");
                }
                break;

            case RandomCommon.DistributionType.Gamma:
                if (randomValueCfg.DistrCfg != null)
                {
                    GammaDistrSettings gammaCfg = randomValueCfg.DistrCfg as GammaDistrSettings;
                    value = rand.NextRangedGammaDouble(gammaCfg.Alpha, gammaCfg.Beta, randomValueCfg.Min, randomValueCfg.Max);
                }
                else
                {
                    throw new ArgumentException($"A specific configuration of the Gamma distribution is missing.", "randomValueCfg");
                }
                break;

            default:
                throw new ArgumentException($"Unknown distribution type: {randomValueCfg.DistrType}.", "randomValueCfg");
            }
            return(value);
        }
Beispiel #15
0
        /// <summary>
        /// Returns random unsigned double according to specified settings.
        /// </summary>
        /// <param name="rand"></param>
        /// <param name="settings">Encapsulated settings</param>
        public static double NextDouble(this Random rand, URandomValueSettings settings)
        {
            double value;

            switch (settings.DistrType)
            {
            case RandomCommon.DistributionType.Uniform:
                value = rand.NextRangedUniformDouble(settings.Min, settings.Max);
                break;

            case RandomCommon.DistributionType.Gaussian:
                if (settings.DistrCfg != null)
                {
                    UGaussianDistrSettings gaussianCfg = settings.DistrCfg as UGaussianDistrSettings;
                    value = rand.NextFilterredGaussianDouble(gaussianCfg.Mean, gaussianCfg.StdDev, settings.Min, settings.Max);
                }
                else
                {
                    throw new InvalidOperationException($"Configuration of Gaussian distribution is missing");
                }
                break;

            case RandomCommon.DistributionType.Exponential:
                if (settings.DistrCfg != null)
                {
                    UExponentialDistrSettings exponentialCfg = settings.DistrCfg as UExponentialDistrSettings;
                    value = rand.NextFilterredExponentialDouble(exponentialCfg.Mean, settings.Min, settings.Max);
                }
                else
                {
                    throw new InvalidOperationException($"Configuration of Exponential distribution is missing");
                }
                break;

            case RandomCommon.DistributionType.Gamma:
                if (settings.DistrCfg != null)
                {
                    GammaDistrSettings gammaCfg = settings.DistrCfg as GammaDistrSettings;
                    value = rand.NextFilterredGammaDouble(gammaCfg.Alpha, gammaCfg.Beta, settings.Min, settings.Max);
                }
                else
                {
                    throw new InvalidOperationException($"Configuration of Gamma distribution is missing");
                }
                break;

            default:
                throw new InvalidOperationException($"Unknown distribution type {settings.DistrType}.");
            }
            return(value);
        }
Beispiel #16
0
        /// <summary>
        /// Creates an initialized instance.
        /// </summary>
        /// <param name="elem">A xml element containing the configuration data.</param>
        public AFSpikingSimpleIFSettings(XElement elem)
        {
            //Validation
            XElement activationSettingsElem = Validate(elem, XsdTypeName);

            //Parsing
            Resistance        = URandomValueSettings.LoadOrCreate(activationSettingsElem, "resistance", TypicalResistance);
            DecayRate         = URandomValueSettings.LoadOrCreate(activationSettingsElem, "decayRate", TypicalDecayRate);
            ResetV            = URandomValueSettings.LoadOrCreate(activationSettingsElem, "resetV", TypicalResetV);
            FiringThresholdV  = URandomValueSettings.LoadOrCreate(activationSettingsElem, "firingThresholdV", TypicalFiringThresholdV);
            RefractoryPeriods = int.Parse(activationSettingsElem.Attribute("refractoryPeriods").Value, CultureInfo.InvariantCulture);
            Check();
            return;
        }
Beispiel #17
0
 //Constructors
 /// <summary>
 /// Creates an initialized instance.
 /// </summary>
 /// <remarks>
 /// The arguments are in RandomValue form to allow their dynamic random initialization within the specified ranges.
 /// </remarks>
 /// <param name="resistance">The membrane resistance (Mohm).</param>
 /// <param name="decayRate">The membrane potential decay rate.</param>
 /// <param name="resetV">The membrane reset potential (mV).</param>
 /// <param name="firingThresholdV">The membrane firing threshold (mV).</param>
 /// <param name="refractoryPeriods">The number of after-spike computation cycles while an input stimuli to be ignored (cycles).</param>
 public AFSpikingSimpleIFSettings(URandomValueSettings resistance       = null,
                                  URandomValueSettings decayRate        = null,
                                  URandomValueSettings resetV           = null,
                                  URandomValueSettings firingThresholdV = null,
                                  int refractoryPeriods = 1
                                  )
 {
     Resistance        = URandomValueSettings.CloneOrCreate(resistance, TypicalResistance);
     DecayRate         = URandomValueSettings.CloneOrCreate(decayRate, TypicalDecayRate);
     ResetV            = URandomValueSettings.CloneOrCreate(resetV, TypicalResetV);
     FiringThresholdV  = URandomValueSettings.CloneOrCreate(firingThresholdV, TypicalFiringThresholdV);
     RefractoryPeriods = refractoryPeriods;
     Check();
     return;
 }
Beispiel #18
0
        /// <summary>
        /// Creates an instance and initializes it from given xml element.
        /// </summary>
        /// <param name="elem">Xml element containing the initialization settings</param>
        public LeakyIFSettings(XElement elem)
        {
            //Validation
            XElement activationSettingsElem = Validate(elem, XsdTypeName);

            //Parsing
            TimeScale         = URandomValueSettings.LoadOrDefault(activationSettingsElem, "timeScale", TypicalTimeScale);
            Resistance        = URandomValueSettings.LoadOrDefault(activationSettingsElem, "resistance", TypicalResistance);
            RestV             = RandomValueSettings.LoadOrDefault(activationSettingsElem, "restV", TypicalRestV);
            ResetV            = RandomValueSettings.LoadOrDefault(activationSettingsElem, "resetV", TypicalResetV);
            FiringThresholdV  = RandomValueSettings.LoadOrDefault(activationSettingsElem, "firingThresholdV", TypicalFiringThresholdV);
            RefractoryPeriods = int.Parse(activationSettingsElem.Attribute("refractoryPeriods").Value, CultureInfo.InvariantCulture);
            SolverMethod      = (ODENumSolver.Method)Enum.Parse(typeof(ODENumSolver.Method), activationSettingsElem.Attribute("solverMethod").Value, true);
            SolverCompSteps   = int.Parse(activationSettingsElem.Attribute("solverCompSteps").Value, CultureInfo.InvariantCulture);
            StimuliDuration   = double.Parse(activationSettingsElem.Attribute("stimuliDuration").Value, CultureInfo.InvariantCulture);
            Check();
            return;
        }
Beispiel #19
0
        /// <summary>
        /// Creates an initialized instance.
        /// </summary>
        /// <param name="elem">A xml element containing the configuration data.</param>
        public AFSpikingIzhikevichIFSettings(XElement elem)
        {
            //Validation
            XElement activationSettingsElem = Validate(elem, XsdTypeName);

            //Parsing
            RecoveryTimeScale   = URandomValueSettings.LoadOrCreate(activationSettingsElem, "recoveryTimeScale", TypicalRecoveryTimeScale);
            RecoverySensitivity = URandomValueSettings.LoadOrCreate(activationSettingsElem, "recoverySensitivity", TypicalRecoverySensitivity);
            RecoveryReset       = URandomValueSettings.LoadOrCreate(activationSettingsElem, "recoveryReset", TypicalRecoveryReset);
            RestV             = RandomValueSettings.LoadOrCreate(activationSettingsElem, "restV", TypicalRestV);
            ResetV            = RandomValueSettings.LoadOrCreate(activationSettingsElem, "resetV", TypicalResetV);
            FiringThresholdV  = RandomValueSettings.LoadOrCreate(activationSettingsElem, "firingThresholdV", TypicalFiringThresholdV);
            RefractoryPeriods = int.Parse(activationSettingsElem.Attribute("refractoryPeriods").Value, CultureInfo.InvariantCulture);
            SolverMethod      = (ODENumSolver.Method)Enum.Parse(typeof(ODENumSolver.Method), activationSettingsElem.Attribute("solverMethod").Value, true);
            SolverCompSteps   = int.Parse(activationSettingsElem.Attribute("solverCompSteps").Value, CultureInfo.InvariantCulture);
            StimuliDuration   = double.Parse(activationSettingsElem.Attribute("stimuliDuration").Value, CultureInfo.InvariantCulture);
            Check();
            return;
        }
        /// <summary>
        /// Creates an initialized instance.
        /// </summary>
        /// <param name="elem">A xml element containing the configuration data.</param>
        public AFSpikingAdExpIFSettings(XElement elem)
        {
            //Validation
            XElement activationSettingsElem = Validate(elem, XsdTypeName);

            //Parsing
            TimeScale                         = URandomValueSettings.LoadOrCreate(activationSettingsElem, "timeScale", TypicalTimeScale);
            Resistance                        = URandomValueSettings.LoadOrCreate(activationSettingsElem, "resistance", TypicalResistance);
            RestV                             = RandomValueSettings.LoadOrCreate(activationSettingsElem, "restV", TypicalRestV);
            ResetV                            = RandomValueSettings.LoadOrCreate(activationSettingsElem, "resetV", TypicalResetV);
            RheobaseV                         = RandomValueSettings.LoadOrCreate(activationSettingsElem, "rheobaseV", TypicalRheobaseV);
            FiringThresholdV                  = RandomValueSettings.LoadOrCreate(activationSettingsElem, "firingThresholdV", TypicalFiringThresholdV);
            SharpnessDeltaT                   = URandomValueSettings.LoadOrCreate(activationSettingsElem, "sharpnessDeltaT", TypicalSharpnessDeltaT);
            AdaptationVoltageCoupling         = URandomValueSettings.LoadOrCreate(activationSettingsElem, "adaptationVoltageCoupling", TypicalAdaptationVoltageCoupling);
            AdaptationTimeConstant            = URandomValueSettings.LoadOrCreate(activationSettingsElem, "adaptationTimeConstant", TypicalAdaptationTimeConstant);
            AdaptationSpikeTriggeredIncrement = URandomValueSettings.LoadOrCreate(activationSettingsElem, "adaptationSpikeTriggeredIncrement", TypicalAdaptationSpikeTriggeredIncrement);
            SolverMethod                      = (ODENumSolver.Method)Enum.Parse(typeof(ODENumSolver.Method), activationSettingsElem.Attribute("solverMethod").Value, true);
            SolverCompSteps                   = int.Parse(activationSettingsElem.Attribute("solverCompSteps").Value, CultureInfo.InvariantCulture);
            StimuliDuration                   = double.Parse(activationSettingsElem.Attribute("stimuliDuration").Value, CultureInfo.InvariantCulture);
            Check();
            return;
        }
Beispiel #21
0
 //Constructors
 /// <summary>
 /// Creates an initialized instance
 /// </summary>
 /// <param name="timeScale">Membrane time scale (ms)</param>
 /// <param name="resistance">Membrane resistance (Mohm)</param>
 /// <param name="restV">Membrane rest potential (mV)</param>
 /// <param name="resetV">Membrane reset potential (mV)</param>
 /// <param name="firingThresholdV">Membrane firing threshold (mV)</param>
 /// <param name="refractoryPeriods">Number of after spike computation cycles while an input stimuli is ignored (ms)</param>
 /// <param name="solverMethod">ODE numerical solver method</param>
 /// <param name="solverCompSteps">ODE numerical solver computation steps of the time step</param>
 /// <param name="stimuliDuration">Duration of the stimulation</param>
 public LeakyIFSettings(URandomValueSettings timeScale       = null,
                        URandomValueSettings resistance      = null,
                        RandomValueSettings restV            = null,
                        RandomValueSettings resetV           = null,
                        RandomValueSettings firingThresholdV = null,
                        int refractoryPeriods            = ActivationFactory.DefaultRefractoryPeriods,
                        ODENumSolver.Method solverMethod = ActivationFactory.DefaultSolverMethod,
                        int solverCompSteps    = ActivationFactory.DefaultSolverCompSteps,
                        double stimuliDuration = ActivationFactory.DefaultStimuliDuration
                        )
 {
     TimeScale         = URandomValueSettings.CloneOrDefault(timeScale, TypicalTimeScale);
     Resistance        = URandomValueSettings.CloneOrDefault(resistance, TypicalResistance);
     RestV             = RandomValueSettings.CloneOrDefault(restV, TypicalRestV);
     ResetV            = RandomValueSettings.CloneOrDefault(resetV, TypicalResetV);
     FiringThresholdV  = RandomValueSettings.CloneOrDefault(firingThresholdV, TypicalFiringThresholdV);
     RefractoryPeriods = refractoryPeriods;
     SolverMethod      = solverMethod;
     SolverCompSteps   = solverCompSteps;
     StimuliDuration   = stimuliDuration;
     Check();
     return;
 }
 //Constructors
 /// <summary>
 /// Creates an initialized instance.
 /// </summary>
 /// <param name="negSlope">The negative slope</param>
 public AFAnalogLeakyReLUSettings(URandomValueSettings negSlope = null)
 {
     NegSlope = URandomValueSettings.CloneOrCreate(negSlope, TypicalNegSlope);
     return;
 }
Beispiel #23
0
 //Constructors
 /// <summary>
 /// Creates an initialized instance.
 /// </summary>
 /// <param name="alpha">The Alpha</param>
 public AFAnalogSoftExponentialSettings(URandomValueSettings alpha = null)
 {
     Alpha = URandomValueSettings.CloneOrCreate(alpha, TypicalAlpha);
     return;
 }
Beispiel #24
0
 /// <summary>
 /// The copy constructor.
 /// </summary>
 /// <param name="source">The source instance.</param>
 public AFAnalogElliotSettings(AFAnalogElliotSettings source)
 {
     Slope = (URandomValueSettings)source.Slope.DeepClone();
     return;
 }
Beispiel #25
0
 //Constructors
 /// <summary>
 /// Creates an initialized instance.
 /// </summary>
 /// <param name="slope">The slope of the curve.</param>
 public AFAnalogElliotSettings(URandomValueSettings slope = null)
 {
     Slope = URandomValueSettings.CloneOrCreate(slope, TypicalSlope);
     return;
 }
Beispiel #26
0
 //Constructors
 /// <summary>
 /// Creates an initialized instance.
 /// </summary>
 /// <param name="weightCfg">The configuration of the synapse's weight.</param>
 public AnalogSourceSettings(URandomValueSettings weightCfg = null)
 {
     WeightCfg = weightCfg == null ? new URandomValueSettings(DefaultMinWeight, DefaultMaxWeight) : (URandomValueSettings)weightCfg.DeepClone();
     Check();
     return;
 }
Beispiel #27
0
 //Constructors
 /// <summary>
 /// Creates an initialized instance
 /// </summary>
 /// <param name="slope">Slope of the curve</param>
 public ElliotSettings(URandomValueSettings slope = null)
 {
     Slope = URandomValueSettings.CloneOrDefault(slope, TypicalSlope);
     return;
 }
Beispiel #28
0
 /// <summary>
 /// Copy constructor
 /// </summary>
 /// <param name="source">Source instance</param>
 public SoftExponentialSettings(SoftExponentialSettings source)
 {
     Alpha = (URandomValueSettings)source.Alpha.DeepClone();
     return;
 }
Beispiel #29
0
 //Constructors
 /// <summary>
 /// Creates an initialized instance
 /// </summary>
 /// <param name="alpha">The Alpha</param>
 public SoftExponentialSettings(URandomValueSettings alpha = null)
 {
     Alpha = URandomValueSettings.CloneOrDefault(alpha, TypicalAlpha);
     return;
 }
 /// <summary>
 /// The copy constructor.
 /// </summary>
 /// <param name="source">The source instance.</param>
 public AFAnalogLeakyReLUSettings(AFAnalogLeakyReLUSettings source)
 {
     NegSlope = (URandomValueSettings)source.NegSlope.DeepClone();
     return;
 }