AI-PSO

 view release on metacpan or  search on metacpan

examples/NeuralNet/NeuralNet.h  view on Meta::CPAN

#ifndef NEURAL_NET
#define NEURAL_NET


///
/// \class TransferFunction NeuralNet.h NeuralNet
/// \brief defines a transfer function object
/// 
class NEURALNET_API TransferFunction
{
    public:

        ///
        /// \fn TransferFunction(double val)
        /// \brief constructor
        /// \param val a double
        ///
        TransferFunction(double val = 1)
        {
        }

examples/NeuralNet/NeuralNet.h  view on Meta::CPAN


        double m_value;        /// value on which to compute the transfer function
};



///
/// \class UnityGain NeuralNet.h NeuralNet
/// \brief defines a transfer function that passes its output as its input (good for input neurons)
///
class NEURALNET_API UnityGain : public TransferFunction
{
    public:
        
        ///
        /// \fn UnityGain(double val) 
        /// \brief constructor
        /// \param val a double
        ///
        UnityGain(double val = 1) : TransferFunction(val)
        {
        }

examples/NeuralNet/NeuralNet.h  view on Meta::CPAN

            return m_value = val;
        }
};



///
/// \class Logistic  NeuralNet.h NeuralNet
/// \brief defines the Logistic transfer function
///
class NEURALNET_API Logistic : public TransferFunction
{
    public:
        
        ///
        /// \fn Logistic()
        /// \brief constructor
        /// 
        Logistic(double val = 1) : TransferFunction(val)
        {
        }


examples/NeuralNet/NeuralNet.h  view on Meta::CPAN

        }
};


///
/// \class Neuron NeuralNet.h NeuralNet
/// \brief exported class which simulates a neruon within a Neural Net
///
class NEURALNET_API Neuron
{
    public:

        ///
        /// \fn Neuron()
        /// \brief constructor
        /// \note, add flag in constructor to choose what type of TransferFunction to use
        ///
        Neuron()
        {
            m_capacity = 1;
            m_numConnections = 0;

examples/NeuralNet/NeuralNet.h  view on Meta::CPAN




/// 
/// \class Input NeuralNet.h NeuralNet
/// \brief Simulates an input neuron in a Neural net.  This class extends Neuron
///            but allows for its value to be set directly and it also overrides 
///            the virtual value function so that it returns its value directly 
///            rather than passing though a transfer function.
///
class NEURALNET_API Input : public Neuron
{
    public:


        ///
        /// \fn Input(double value)
        /// \brief constructor
        ///
        Input(double value = 0) : Neuron()
        {
            m_value = value;
        }

examples/NeuralNet/NeuralNet.h  view on Meta::CPAN


    protected:
};



///
/// \class Hidden NeuralNet.h NeuralNet
/// \brief simulates a hidden Neuron
///
class NEURALNET_API Hidden : public Neuron
{

    public:

        ///
        /// \fn Hidden()
        /// \brief constructor which sets transfer function
        ///
        Hidden() : Neuron()
        {
//            delete xfer;
//            xfer = new Logistic();
        }

examples/NeuralNet/NeuralNet.h  view on Meta::CPAN

};



///
/// \class NeuralNet NeuralNet.h NeuralNet
/// \brief Simulates a NeuralNet made up of Neurons and Input Neurons
/// 
class NEURALNET_API NeuralNet 
{
    public:

        ///
        /// \fn NeuralNet(int numInputs, int numHidden)
        /// \brief constructor
        /// \param numInputs an int
        /// \param numHidden an int
        ///
        NeuralNet(int numInputs = 3, int numHidden = 2, const char *xferFunc = "Logistic") : m_numInputs(numInputs), m_numHidden(numHidden)
        {
            m_inputs = new Input[m_numInputs];



( run in 0.570 second using v1.01-cache-2.11-cpan-c6e0e5ac2a7 )