Exemplo n.º 1
0
        private double[,] error(TrainingData tmp)
        {
            double[,] y = VecToMatrix(tmp.output);
            var ysim = ForwardPropagation(tmp.input);

            return(Substract(y, ysim));
        }
Exemplo n.º 2
0
 public double[,] ForwardPropagation(params double[] data)
 {
     training_data        = new TrainingData(data, new double[] { });
     double[,] input_data = VecToMatrix(training_data.input);
     layers[0].values     = input_data;
     for (int i = 1; i < layers.Length; i++)
     {
         input_data       = Multiply(input_data, layers[i].perceptron.scales);
         input_data       = activate(input_data, layers[i].perceptron.activationFunction);
         layers[i].values = input_data;
     }
     return(input_data); //wynik propagacji w przod
 }
Exemplo n.º 3
0
        public static List <TrainingData> CSVReadXO()
        {
            Console.WriteLine("Wczytanie danych z pliku CSV");
            var list_of_data = new List <TrainingData>();

            var column1  = new List <string>();
            var column2  = new List <string>();
            var column3  = new List <string>();
            var column4  = new List <string>();
            var column5  = new List <string>();
            var column6  = new List <string>();
            var column7  = new List <string>();
            var column8  = new List <string>();
            var column9  = new List <string>();
            var column10 = new List <string>();

            using (var rd = new StreamReader(path))
            {
                while (!rd.EndOfStream)
                {
                    var splits = rd.ReadLine().Split(';');
                    column1.Add(splits[0]);
                    column2.Add(splits[1]);
                    column3.Add(splits[2]);
                    column4.Add(splits[3]);
                    column5.Add(splits[4]);
                    column6.Add(splits[5]);
                    column7.Add(splits[6]);
                    column8.Add(splits[7]);
                    column9.Add(splits[8]);
                    column10.Add(splits[9]);
                }
            }



            for (int i = 0; i < column1.Count(); i++)
            {
                var tr_data = new TrainingData(new double[] { double.Parse(column1[i]), double.Parse(column2[i]), double.Parse(column3[i]),

                                                              double.Parse(column4[i]), double.Parse(column5[i]), double.Parse(column6[i]),
                                                              double.Parse(column7[i]), double.Parse(column8[i]), double.Parse(column9[i]) },

                                               new double[] { double.Parse(column10[i]) });
                list_of_data.Add(tr_data);
            }

            return(list_of_data);
        }