NeuralPSO
org.encog.neural.networks.training.pso

Class NeuralPSO

  • All Implemented Interfaces:
    MLTrain


    public class NeuralPSOextends BasicTraining
    Iteratively trains a population of neural networks by applying particle swarm optimisation (PSO). Contributed by: Geoffroy Noel https://github.com/goffer-looney References: James Kennedy and Russell C. Eberhart, Particle swarm optimization, Proceedings of the IEEE International Conference on Neural Networks, 1995, pp. 1942-1948
    • Constructor Detail

      • NeuralPSO

        public NeuralPSO(BasicNetwork network,         Randomizer randomizer,         CalculateScore calculateScore,         int populationSize)
        Constructor.
        Parameters:
        network - an initialised Encog network. The networks in the swarm will be created with the same topology as this network.
        randomizer - any type of Encog network weight initialisation object.
        calculateScore - any type of Encog network scoring/fitness object.
        populationSize - the swarm size.
      • NeuralPSO

        public NeuralPSO(BasicNetwork network,         MLDataSet trainingSet)
        Construct a PSO using a training set score function, 20 particles and the NguyenWidrowRandomizer randomizer.
        Parameters:
        network - The network to train. an initialised Encog network. The networks in the swarm will be created with the same topology as this network.
        trainingSet - The training set.
    • Method Detail

      • iteration

        public void iteration()
        Runs one PSO iteration over the whole population of networks.
      • pause

        public TrainingContinuation pause()
        Description copied from interface: MLTrain
        Pause the training to continue later.
        Returns:
        A training continuation object.
      • canContinue

        public boolean canContinue()
        Returns:
        True if the training can be paused, and later continued.
      • resume

        public void resume(TrainingContinuation state)
        Description copied from interface: MLTrain
        Resume training.
        Parameters:
        state - The training continuation object to use to continue.
      • setPopulationSize

        public void setPopulationSize(int populationSize)
        Set the swarm size.
        Parameters:
        populationSize - the swarm size
      • getPopulationSize

        public int getPopulationSize()
        Returns the swarm size.
        Returns:
        the swarm size.
      • setMaxVelocity

        public void setMaxVelocity(double maxVelocity)
        Sets the maximum velocity.
        Parameters:
        maxVelocity - Maximum velocity / Vmax
      • getMaxVelocity

        public double getMaxVelocity()
        Get the maximum velocity (Vmax)
        Returns:
        maximum velocity (Vmax)
      • setMaxPosition

        public void setMaxPosition(double maxPosition)
        Set the boundary of the search space (Xmax)
        Parameters:
        maxPosition - maximum value for a component (Xmax)
      • getMaxPosition

        public double getMaxPosition()
        Get the boundary of the search space (Xmax)
        Returns:
        the maximum value a component can take (Xmax)
      • setC1

        public void setC1(double c1)
        Sets the cognition coefficient (c1).
        Parameters:
        c1 - cognition coefficient (c1)
      • getC1

        public double getC1()
        Get the cognition coefficient (c1).
        Returns:
        the cognition coefficient (c1)
      • setC2

        public void setC2(double c2)
        Set the social coefficient (c2).
        Parameters:
        c2 - the social coefficient (c2)
      • getC2

        public double getC2()
        Get the social coefficient (c2).
        Returns:
        the social coefficient (c2)
      • setInertiaWeight

        public void setInertiaWeight(double inertiaWeight)
        Set the inertia weight (w)
        Parameters:
        inertiaWeight - the inertia weight (w)
      • getInertiaWeight

        public double getInertiaWeight()
        Get the inertia weight (w)
        Returns:
        the inertia weight (w)
      • getDescription

        public String getDescription()
        Get a description of all the current settings.
        Returns:
        a String describing all the current setting in a single line.
      • getMethod

        public MLMethod getMethod()
        Description copied from interface: MLTrain
        Get the current best machine learning method from the training.
        Returns:
        The best machine learningm method.
      • setInitialPopulation

        public void setInitialPopulation(BasicNetwork[] initialPopulation)
        Keep a reference to the passed population of networks. This population is not copied, it will evolve during training.
        Parameters:
        initialPopulation -
      • isMultiThreaded

        public boolean isMultiThreaded()
        Get the multi-threaded mode.
        Returns:
        true if PSO works in multi-threaded mode

SCaVis 1.7 © jWork.org