Esempio n. 1
0
 /// <summary>
 /// Instanciates a new pattern.
 /// </summary>
 /// <param name="title">The name/title of the pattern.</param>
 /// <param name="input">The input pattern data (gets copied).</param>
 /// <param name="numberOfClasses">The count of output neurons.</param>
 /// <param name="classification">The position of the favoured output neuron in the output layer.</param>
 /// <param name="config">The network configuration instance (needed to generate an appropriate training vector)</param>
 public DoublePattern(string title, double[] input, int numberOfClasses, int classification, BasicConfig config)
     : base(title, classification)
 {
     _inputPattern = new double[input.Length];
     input.CopyTo(_inputPattern, 0);
     _outputTraining = new double[numberOfClasses];
     for(int i = 0; i < numberOfClasses; i++)
         OutputTraining[i] = config.ConvertOutput(i == classification);
 }
Esempio n. 2
0
        public Backend()
        {
            //Prepare the default configuration set.
            _node = new ConfigNode();
            _config = new BasicConfig(_node);

            _config.BiasNeuronEnable.Value = true;
            _config.LearningRate.Value = 0.3;
        }
Esempio n. 3
0
 void IConfigurable.Rebind(ConfigNode node)
 {
     _node = node;
     if (_config == null)
     {
         _config = new BasicConfig(node);
     }
     else
     {
         _config.Node = node;
     }
 }
Esempio n. 4
0
        double[] outTT = new double[16]; // X=True  Y=True

        #endregion Fields

        #region Constructors

        public Backend()
        {
            //Prepare the default configuration set.
            node = new ConfigNode();
            config = new BasicConfig(node);
            config.BiasNeuronEnable.Value = true;
            config.WeightDecayEnable.Value = true;
            config.FlatspotEliminationEnable.Value = true;
            config.BiasNeuronOutput.Value = 0.9d;
            config.LearningRate.Value = 0.3;
            config.WeightDecay.Value = 0.005;
            InitOutputs(1d,-1d);
        }
        public TrainingConfig(ConfigNode config)
        {
            _config = config;
            _gaussian = new NormalGenerator(0.0, 0.5);
            _basic = new BasicConfig(config);

            _autoTrainingEpochs = new ConfigItem<int>(_config, "AutoTrainingEpochs", 400);
            _autoTrainingAttempts = new ConfigItem<int>(_config, "AutoTrainingAttempts", 1);
            _autoTrainingPercentSuccessful = new ConfigItem<double>(_config, "AutoTrainingPercentSuccessful", 1.0);

            _shuffleSwapProbability = new ConfigItem<double>(_config, "ShuffleSwapProbability", 0.05);
            _shuffleNoiseSigma = new ConfigItem<double>(_config, "ShuffleNoiseSigma", 0.5);
            _shuffleEn = new ConfigItem<bool>(_config, "ShuffleEnable", false);
        }
Esempio n. 6
0
 void IConfigurable.Rebind(ConfigNode node)
 {
     _node = node;
     if(_config == null)
         _config = new BasicConfig(node);
     else
         _config.Node = node;
 }
 /// <summary>
 /// Create a double pattern based on this pattern.
 /// </summary>
 /// <param name="config">The configuration instance.</param>
 public DoublePattern ToDoublePattern(BasicConfig config)
 {
     double[] input = new double[_inputPattern.Length];
     double[] output = new double[_outputTraining.Length];
     for(int i = 0; i < input.Length; i++)
         input[i] = config.ConvertInput(_inputPattern[i]);
     for(int i = 0; i < output.Length; i++)
         output[i] = config.ConvertOutput(_outputTraining[i]);
     return new DoublePattern(Title, input, output, Classification);
 }
 /// <summary>
 /// Copy output training data to an array.
 /// </summary>
 /// <param name="vector">The target array.</param>
 /// <param name="config">The configuration instance.</param>
 public override void SyncTrainingTo(double[] vector, BasicConfig config)
 {
     for(int i = 0; i < _outputTraining.Length && i < vector.Length; i++)
         vector[i] = config.ConvertOutput(_outputTraining[i]);
 }
 /// <summary>
 /// Copy input pattern data to an array.
 /// </summary>
 /// <param name="vector">The target array.</param>
 /// <param name="config">The configuration instance.</param>
 public override void SyncInputTo(double[] vector, BasicConfig config)
 {
     for(int i = 0; i < _inputPattern.Length && i < vector.Length; i++)
         vector[i] = config.ConvertInput(_inputPattern[i]);
 }
Esempio n. 10
0
 /// <summary>
 /// Copy output training data from an array.
 /// </summary>
 /// <param name="vector">The target array.</param>
 /// <param name="config">The configuration instance.</param>
 public abstract void SyncTrainingFrom(double[] vector, BasicConfig config);
Esempio n. 11
0
 /// <summary>
 /// Copy input pattern data to an array.
 /// </summary>
 /// <param name="vector">The target array.</param>
 /// <param name="config">The configuration instance.</param>
 public abstract void SyncInputTo(double[] vector, BasicConfig config);
Esempio n. 12
0
 /// <summary>
 /// Create a boolean pattern based on this pattern.
 /// </summary>
 /// <param name="config">The configuration instance.</param>
 public BooleanPattern ToBooleanPattern(BasicConfig config)
 {
     bool[] input = new bool[_inputPattern.Length];
     bool[] output = new bool[_outputTraining.Length];
     for(int i = 0; i < input.Length; i++)
         input[i] = config.ConvertInput(_inputPattern[i]);
     for(int i = 0; i < output.Length; i++)
         output[i] = config.ConvertOutput(_outputTraining[i]);
     return new BooleanPattern(Title, input, output, Classification);
 }
Esempio n. 13
0
 /// <summary>
 /// Copy output training data to an array.
 /// </summary>
 /// <param name="vector">The target array.</param>
 /// <param name="config">The configuration instance.</param>
 public override void SyncTrainingTo(double[] vector, BasicConfig config)
 {
     _outputTraining.CopyTo(vector, 0);
 }
Esempio n. 14
0
 /// <summary>
 /// Copy output training data from an array.
 /// </summary>
 /// <param name="vector">The target array.</param>
 /// <param name="config">The configuration instance.</param>
 public override void SyncTrainingFrom(double[] vector, BasicConfig config)
 {
     vector.CopyTo(_outputTraining, 0);
 }
Esempio n. 15
0
 /// <summary>
 /// Copy input pattern data to an array.
 /// </summary>
 /// <param name="vector">The target array.</param>
 /// <param name="config">The configuration instance.</param>
 public override void SyncInputTo(double[] vector, BasicConfig config)
 {
     _inputPattern.CopyTo(vector, 0);
 }
Esempio n. 16
0
 /// <summary>
 /// Copy input pattern data from an array.
 /// </summary>
 /// <param name="vector">The target array.</param>
 /// <param name="config">The configuration instance.</param>
 public override void SyncInputFrom(double[] vector, BasicConfig config)
 {
     vector.CopyTo(_inputPattern, 0);
 }