Documentation of 'org.neuroph.core.NeuralNetwork' Java class
NeuralNetwork
org.neuroph.core

Class NeuralNetwork<L extends LearningRule>

    • Constructor Detail

      • NeuralNetwork

        public NeuralNetwork()
        Creates an instance of empty neural network.
    • Method Detail

      • addLayer

        public void addLayer(Layer layer)
        Adds layer to neural network
        Parameters:
        layer - layer to add
      • addLayer

        public void addLayer(int index,
                             Layer layer)
        Adds layer to specified index position in network
        Parameters:
        index - index position to add layer
        layer - layer to add
      • removeLayer

        public void removeLayer(Layer layer)
        Removes specified layer from network
        Parameters:
        layer - layer to remove
        Throws:
        java.lang.Exception
      • removeLayerAt

        public void removeLayerAt(int index)
        Removes layer at specified index position from net
        Parameters:
        index - int value represents index postion of layer which should be removed
      • getLayers

        public java.util.List<Layer> getLayers()
        Returns layers array
        Returns:
        array of layers
      • getLayerAt

        public Layer getLayerAt(int index)
        Returns layer at specified index
        Parameters:
        index - layer index position
        Returns:
        layer at specified index position
      • indexOf

        public int indexOf(Layer layer)
        Returns index position of the specified layer
        Parameters:
        layer - requested Layer object
        Returns:
        layer position index
      • getLayersCount

        public int getLayersCount()
        Returns number of layers in network
        Returns:
        number of layes in net
      • getOutput

        public double[] getOutput()
        Returns network output vector. Output vector is an array collection of Double values.
        Returns:
        network output vector
      • calculate

        public void calculate()
        Performs calculation on whole network
      • reset

        public void reset()
        Resets the activation levels for whole network
      • learn

        public void learn(DataSet trainingSet)
        Learn the specified training set
        Parameters:
        trainingSet - set of training elements to learn
      • learn

        public void learn(DataSet trainingSet,
                          L learningRule)
        Learn the specified training set, using specified learning rule
        Parameters:
        trainingSet - set of training elements to learn
        learningRule - instance of learning rule to use for learning
      • stopLearning

        public void stopLearning()
        Stops learning
      • pauseLearning

        public void pauseLearning()
        Pause the learning - puts learning thread in ca state. Makes sense only wen learning is done in new thread with learnInNewThread() method
      • resumeLearning

        public void resumeLearning()
        Resumes paused learning - notifies the learning rule to continue
      • randomizeWeights

        public void randomizeWeights()
        Randomizes connection weights for the whole network
      • randomizeWeights

        public void randomizeWeights(double minWeight,
                                     double maxWeight)
        Randomizes connection weights for the whole network within specified value range
      • randomizeWeights

        public void randomizeWeights(java.util.Random random)
        Randomizes connection weights for the whole network using specified random generator
      • randomizeWeights

        public void randomizeWeights(WeightsRandomizer randomizer)
        Randomizes connection weights for the whole network using specified randomizer
        Parameters:
        randomizer - random weight generator to use
      • getNetworkType

        public NeuralNetworkType getNetworkType()
        Returns type of this network
        Returns:
        network type
      • setNetworkType

        public void setNetworkType(NeuralNetworkType type)
        Sets type for this network
        Parameters:
        type - network type
      • getInputNeurons

        public java.util.List<Neuron> getInputNeurons()
        Returns input neurons
        Returns:
        input neurons
      • getInputsCount

        public int getInputsCount()
        Gets number of input neurons
        Returns:
        number of input neurons
      • setInputNeurons

        public void setInputNeurons(java.util.List<Neuron> inputNeurons)
        Sets input neurons
        Parameters:
        inputNeurons - array of input neurons
      • getOutputNeurons

        public java.util.List<Neuron> getOutputNeurons()
        Returns output neurons
        Returns:
        list of output neurons
      • getOutputsCount

        public int getOutputsCount()
      • setOutputNeurons

        public void setOutputNeurons(java.util.List<Neuron> outputNeurons)
        Sets output neurons
        Parameters:
        outputNeurons - output neurons collection
      • setOutputLabels

        public void setOutputLabels(java.lang.String[] labels)
        Sets labels for output neurons
        Parameters:
        labels - labels for output neurons
      • getLearningRule

        public L getLearningRule()
        Returns the learning algorithm of this network
        Returns:
        algorithm for network training
      • setLearningRule

        public void setLearningRule(L learningRule)
        Sets learning algorithm for this network
        Parameters:
        learningRule - learning algorithm for this network
      • getWeights

        public java.lang.Double[] getWeights()
        Returns all network weights as an double array
        Returns:
        network weights as an double array
      • setWeights

        public void setWeights(double[] weights)
        Sets network weights from the specified double array
        Parameters:
        weights - array of weights to set
      • isEmpty

        public boolean isEmpty()
      • createConnection

        public void createConnection(Neuron fromNeuron,
                                     Neuron toNeuron,
                                     double weightVal)
        Creates connection with specified weight value between specified neurons
        Parameters:
        fromNeuron - neuron to connect
        toNeuron - neuron to connect to
        weightVal - connection weight value
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • save

        public void save(java.lang.String filePath)
        Saves neural network into the specified file.
        Parameters:
        filePath - file path to save network into
      • load

        public static NeuralNetwork load(java.lang.String filePath)
        Deprecated. Use createFromFile method instead
        Loads neural network from the specified file.
        Parameters:
        filePath - file path to load network from
        Returns:
        loaded neural network as NeuralNetwork object
      • load

        public static NeuralNetwork load(java.io.InputStream inputStream)
        Loads neural network from the specified InputStream.
        Parameters:
        inputStream - input stream to load network from
        Returns:
        loaded neural network as NeuralNetwork object
      • createFromFile

        public static NeuralNetwork createFromFile(java.io.File file)
        Loads and return s neural network instance from specified file
        Parameters:
        file - neural network file
        Returns:
        neural network instance
      • createFromFile

        public static NeuralNetwork createFromFile(java.lang.String filePath)
      • addPlugin

        public void addPlugin(PluginBase plugin)
        Adds plugin to neural network
        Parameters:
        plugin - neural network plugin to add
      • getPlugin

        public <T extends PluginBase> T getPlugin(java.lang.Class<T> pluginClass)
        Returns the requested plugin
        Parameters:
        pluginClass - class of the plugin to get
        Returns:
        instance of specified plugin class
      • removePlugin

        public void removePlugin(java.lang.Class pluginClass)
        Removes the plugin with specified name
        Parameters:
        pluginClass - class of the plugin to remove
      • getLabel

        public java.lang.String getLabel()
        Get network label
        Returns:
        network label
      • setLabel

        public void setLabel(java.lang.String label)
        Set network label
        Parameters:
        label - network label to set

DMelt 3.0 © DataMelt by jWork.ORG

You see the box below because you did not login.