Example #1
0
        //private Vector lastWeights;
        //public Vector LastWeights
        //{
        //    get
        //    {
        //        return lastWeights;
        //    }
        //}
        /// <summary>
        /// Tworzy nowy perceptron na podstawie zadanego wektora wag
        /// </summary>
        public Perceptron(Vector weightVector)
        {
            if (weightVector == null)
            {
                throw new NullReferenceException("Przekazany wektor wag jest niezainicjowany");
            }

            weights = weightVector;
            outputFunctionDelegate = biasFunction;
        }
Example #2
0
        /// <summary>
        /// Konstruktor
        /// Tworzy wektor wag na podstawie wartości losowych 0.0 - 1.0
        /// </summary>
        public Perceptron(int dimension, int seed = 0)
        {
            weights = new Vector(dimension);
            Random r = seed == 0 ? new Random() : new Random(seed);
            for (int i = 0; i < weights.Dimension; i++)
            {
                weights[i] = r.NextDouble();
            }
            outputFunctionDelegate = biasFunction;

            //weights.round();
            //lastWeights = weights;
        }
Example #3
0
 /// <summary>
 /// Funkcja przeznaczona do zmiany typu funkcji wyjścia perceptronu
 /// </summary>
 public void setOutputFunctionType(PerceptronOutputFunctionType type)
 {
     switch (type)
     {
         case PerceptronOutputFunctionType.BiasFunction:
             {
                 outputFunctionDelegate = biasFunction;
             } break;
         case PerceptronOutputFunctionType.SigmoidalFunction:
             {
                 outputFunctionDelegate = sigmoidalFunction;
             } break;
     }
 }