Exemplo n.º 1
0
        /*********************************************************************/

        /* Method: CreateTrainFromCallback
         * Creates the training data from a user supplied function.
         * As the training data are numerable (data 1, data 2...), the user must write
         * a function that receives the number of the training data set (input,output)
         * and returns the set.
         *
         * Parameters:
         *   dataCount      - The number of training data
         *   inputCount     - The number of inputs per training data
         *   outputCount    - The number of ouputs per training data
         *   callback       - The user suplied delegate
         *
         * Parameters for the user delegate:
         *   number      - The number of the training data set
         *   inputCount  - The number of inputs per training data
         *   outputCount - The number of ouputs per training data
         *   input       - The set of inputs
         *   output      - The set of desired outputs
         *
         * See also:
         *   <ReadTrainFromFile>, <NeuralNet::TrainOnData>,
         *   <fann_create_train_from_callback at http://libfann.github.io/fann/docs/files/fann_train-h.html#fann_create_train_from_callback>
         *
         *  This function appears in FANN >= 2.1.0
         */
        public void CreateTrainFromCallback(uint dataCount, uint inputCount, uint outputCount, DataCreateCallback callback)
        {
            InternalData = new FannWrapperDouble.training_data();
            Callback     = callback;
            RawCallback  = new data_create_callback(InternalCallback);
            fanndoublePINVOKE.training_data_create_train_from_callback(training_data.getCPtr(this.InternalData), dataCount, inputCount, outputCount, Marshal.GetFunctionPointerForDelegate(RawCallback));
        }
Exemplo n.º 2
0
 public training_data(training_data data) : this(fanndoublePINVOKE.new_training_data__SWIG_1(training_data.getCPtr(data)), true)
 {
     if (fanndoublePINVOKE.SWIGPendingException.Pending)
     {
         throw fanndoublePINVOKE.SWIGPendingException.Retrieve();
     }
 }
Exemplo n.º 3
0
 public void merge_train_data(training_data data)
 {
     fanndoublePINVOKE.training_data_merge_train_data(swigCPtr, training_data.getCPtr(data));
     if (fanndoublePINVOKE.SWIGPendingException.Pending)
     {
         throw fanndoublePINVOKE.SWIGPendingException.Retrieve();
     }
 }
Exemplo n.º 4
0
 public void descale_train(training_data data)
 {
     fanndoublePINVOKE.neural_net_descale_train(swigCPtr, training_data.getCPtr(data));
     if (fanndoublePINVOKE.SWIGPendingException.Pending)
     {
         throw fanndoublePINVOKE.SWIGPendingException.Retrieve();
     }
 }
Exemplo n.º 5
0
 public void cascadetrain_on_data(training_data data, uint max_neurons, uint neurons_between_reports, float desired_error)
 {
     fanndoublePINVOKE.neural_net_cascadetrain_on_data(swigCPtr, training_data.getCPtr(data), max_neurons, neurons_between_reports, desired_error);
     if (fanndoublePINVOKE.SWIGPendingException.Pending)
     {
         throw fanndoublePINVOKE.SWIGPendingException.Retrieve();
     }
 }
Exemplo n.º 6
0
        /* Constructor: TrainingData
           Reads a file that stores training data.

            See also:
                <ReadTrainFromFile>, <SetTrainData> or <CreateTrainFromCallback>
        */
        public TrainingData(string filename)
        {
            InternalData = new FannWrapperDouble.training_data();
            ReadTrainFromFile(filename);
            if (!ReadTrainFromFile(filename))
            {
                throw new ArgumentException("Cannot read data from \"{0}\"", filename);
            }
        }
Exemplo n.º 7
0
 /* Constructor: TrainingData
  * Reads a file that stores training data.
  *
  *  See also:
  *      <ReadTrainFromFile>, <SetTrainData> or <CreateTrainFromCallback>
  */
 public TrainingData(string filename)
 {
     InternalData = new FannWrapperDouble.training_data();
     ReadTrainFromFile(filename);
     if (!ReadTrainFromFile(filename))
     {
         throw new ArgumentException("Cannot read data from \"{0}\"", filename);
     }
 }
Exemplo n.º 8
0
        public bool set_scaling_params(training_data data, float new_input_min, float new_input_max, float new_output_min, float new_output_max)
        {
            bool ret = fanndoublePINVOKE.neural_net_set_scaling_params(swigCPtr, training_data.getCPtr(data), new_input_min, new_input_max, new_output_min, new_output_max);

            if (fanndoublePINVOKE.SWIGPendingException.Pending)
            {
                throw fanndoublePINVOKE.SWIGPendingException.Retrieve();
            }
            return(ret);
        }
Exemplo n.º 9
0
        public float test_data(training_data data)
        {
            float ret = fanndoublePINVOKE.neural_net_test_data(swigCPtr, training_data.getCPtr(data));

            if (fanndoublePINVOKE.SWIGPendingException.Pending)
            {
                throw fanndoublePINVOKE.SWIGPendingException.Retrieve();
            }
            return(ret);
        }
Exemplo n.º 10
0
        /* Constructor: TrainingData

            Copy constructor constructs a copy of the training data.
            Corresponds to the C API <fann_duplicate_train_data at http://libfann.github.io/fann/docs/files/fann_train-h.html#fann_duplicate_train_data> function.
        */
        public TrainingData(TrainingData data)
        {
            InternalData = new FannWrapperDouble.training_data(data.InternalData);
        }
Exemplo n.º 11
0
        /*********************************************************************/
        /* Method: CreateTrainFromCallback
           Creates the training data from a user supplied function.
           As the training data are numerable (data 1, data 2...), the user must write
           a function that receives the number of the training data set (input,output)
           and returns the set.

           Parameters:
             dataCount      - The number of training data
             inputCount     - The number of inputs per training data
             outputCount    - The number of ouputs per training data
             callback       - The user suplied delegate

           Parameters for the user delegate:
             number      - The number of the training data set
             inputCount  - The number of inputs per training data
             outputCount - The number of ouputs per training data
             input       - The set of inputs
             output      - The set of desired outputs

           See also:
             <ReadTrainFromFile>, <NeuralNet::TrainOnData>,
             <fann_create_train_from_callback at http://libfann.github.io/fann/docs/files/fann_train-h.html#fann_create_train_from_callback>

            This function appears in FANN >= 2.1.0
        */
        public void CreateTrainFromCallback(uint dataCount, uint inputCount, uint outputCount, DataCreateCallback callback)
        {
            InternalData = new FannWrapperDouble.training_data();
            Callback = callback;
            RawCallback = new data_create_callback(InternalCallback);
            fanndoublePINVOKE.training_data_create_train_from_callback(training_data.getCPtr(this.InternalData), dataCount, inputCount, outputCount, Marshal.GetFunctionPointerForDelegate(RawCallback));
        }
Exemplo n.º 12
0
        /* Constructor: TrainingData

            Default constructor creates an empty training data.
            Use <ReadTrainFromFile>, <SetTrainData> or <CreateTrainFromCallback> to initialize.
        */
        public TrainingData()
        {
            InternalData = new FannWrapperDouble.training_data();
        }
Exemplo n.º 13
0
 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(training_data obj)
 {
     return((obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr);
 }
Exemplo n.º 14
0
 /* Constructor: TrainingData
  *
  *  Copy constructor constructs a copy of the training data.
  *  Corresponds to the C API <fann_duplicate_train_data at http://libfann.github.io/fann/docs/files/fann_train-h.html#fann_duplicate_train_data> function.
  */
 public TrainingData(TrainingData data)
 {
     InternalData = new FannWrapperDouble.training_data(data.InternalData);
 }
Exemplo n.º 15
0
 /* Constructor: TrainingData
  *
  *  Default constructor creates an empty training data.
  *  Use <ReadTrainFromFile>, <SetTrainData> or <CreateTrainFromCallback> to initialize.
  */
 public TrainingData()
 {
     InternalData = new FannWrapperDouble.training_data();
 }