Пример #1
0
        /// <summary>
        /// Create an activation function object
        /// </summary>
        /// <param name="type"> The type of the activation function </param>
        /// <returns> An instant of an activation function object </returns>
        public static AActivationFunction CreateActivationFnCLass(ActivationType type)
        {
            AActivationFunction _activationFunction = null;

            Assembly assembly = Assembly.GetCallingAssembly();

            Type[] types = assembly.GetTypes();

            for (int i = 0; i < types.Length; i++)
            {
                if (types[i].IsSubclassOf(typeof(AActivationFunction)) && types[i].Name == type.ToString())
                {
                    _activationFunction = (AActivationFunction)System.Activator.CreateInstance(types[i]);
                    break;
                }
            }

            if (_activationFunction == null)
            {
                throw new ArgumentNullException("Activation Function ( Type not found )");
            }

            return(_activationFunction);
        }
		//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~//   
        
		/// /// <summary>
		/// Constructor of ANN
		/// </summary>
		/// <param name="classId">Identification of a class label</param>
		public ANN(int classId)
		{
			this._class_id = classId;
			this._previousError = _threshold = 0.1;//double.Epsilon; 
			this._hiddenLayers = new ArrayList();
			this._inputVector = new ArrayList();
			this._graphPoints = new ArrayList();
			this._minimum = -0.5;
			this._maximum = 0.5;
			this._learningRate = 0.9;
			this._momentum = 1;
			this._errorFn = 2;
			this._activationFnType = ActivationType.Sigmoud;
			this._activationFunction = CreateActivationFunction.CreateActivationFnCLass( this._activationFnType );
			
		}