/// <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); }
/// <summary> /// Creates configuration of group of analog neurons having specified analog activation. /// </summary> /// <param name="activationCfg">Activation function configuration</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> private AnalogNeuronGroupSettings CreateAnalogGroup(RCNetBaseSettings activationCfg, double maxAbsBias = 0d, double maxRetainmentStrength = 0d ) { //Bias configuration RandomValueSettings biasCfg = maxAbsBias == 0 ? null : new RandomValueSettings(-maxAbsBias, maxAbsBias); //Retainment configuration const double RetainmentDensity = 1d; RetainmentSettings retainmentCfg = maxRetainmentStrength == 0 ? null : new RetainmentSettings(RetainmentDensity, new URandomValueSettings(0, maxRetainmentStrength)); //Create neuron group configuration AnalogNeuronGroupSettings groupCfg = new AnalogNeuronGroupSettings(GetNeuronGroupName(activationCfg), 1d, activationCfg, AnalogNeuronGroupSettings.DefaultFiringThreshold, AnalogNeuronGroupSettings.DefaultThresholdMaxRefDeepness, biasCfg, retainmentCfg, null ); return(groupCfg); }