public RadialBasisFunctionNetwork(int _inputCount, int _outputCount, int _rbfCount, List <TeachedRBF> _teachedRBFs, List <OutputLayerWeights> _outputLayerWeights, char[] _classesNames)
        {
            inputCount          = _inputCount;
            outputCount         = _outputCount;
            rbfCount            = _rbfCount;
            rbf_teached         = new RBF_teachInfo[rbfCount];
            outputLayer_weights = new double[rbfCount, outputCount];
            int i = 0;

            foreach (TeachedRBF teachedRBF in _teachedRBFs)
            {
                RBF_teachInfo rbf = new RBF_teachInfo();
                rbf.standardDeviation = teachedRBF.StandartDeviation;
                rbf.expectations      = Serializer.DeserializeFromString(teachedRBF.Expectation);
                rbf_teached[i++]      = rbf;
            }
            i = 0;
            outputLayer_weights = new double[rbfCount, outputCount];
            for (i = 0; i < rbfCount; i++)
            {
                for (int j = 0; j < outputCount; j++)
                {
                    outputLayer_weights[i, j] = Serializer.DeserializeFromString(_outputLayerWeights[i].OutputLayerWeight)[j];
                }
            }
            classesNames   = _classesNames;
            iterationCount = 0;
        }
        private void TeachRBFNeurons(Dictionary <char, List <double[]> > classes)
        {
            List <RBF_teachInfo> RBFs = new List <RBF_teachInfo>();

            foreach (List <double[]> matchClass in classes.Values)
            {
                foreach (double[] match in matchClass)
                {
                    RBF_teachInfo rbf = new RBF_teachInfo();
                    rbf.expectations = match;
                    RBFs.Add(rbf);
                }
            }
            rbfCount    = RBFs.Count;
            rbf_teached = RBFs.ToArray();
            if (rbfCount == 1)
            {
                double sko = 0;
                for (int k = 0; k < inputCount; k++)
                {
                    sko += Math.Pow((rbf_teached[0].expectations[k]), 2);
                }
                rbf_teached[0].standardDeviation = Math.Sqrt(sko);
                return;
            }

            List <double>[] deviations = new List <double> [rbfCount];
            for (int i = 0; i < deviations.Length; i++)
            {
                deviations[i] = new List <double>();
            }
            for (int i = 0; i < rbfCount; i++)
            {
                for (int j = i + 1; j < rbfCount; j++)
                {
                    double sko = 0;
                    for (int k = 0; k < inputCount; k++)
                    {
                        sko += Math.Pow((rbf_teached[i].expectations[k] - rbf_teached[j].expectations[k]), 2);
                    }
                    sko = Math.Sqrt(sko);

                    deviations[i].Add(sko);
                    deviations[j].Add(sko);
                }
            }
            for (int i = 0; i < rbfCount; i++)
            {
                rbf_teached[i].standardDeviation = deviations[i].Min();
            }
        }