Package org.encog.neural

Examples of org.encog.neural.NeuralNetworkError


    validateNeuron(fromLayer + 1, toNeuron);
    final int fromLayerNumber = getLayerCount() - fromLayer - 1;
    final int toLayerNumber = fromLayerNumber - 1;

    if (toLayerNumber < 0) {
      throw new NeuralNetworkError(
          "The specified layer is not connected to another layer: "
              + fromLayer);
    }

    final int weightBaseIndex
View Full Code Here


   * @param value The bias activation.
   */
  public final void setLayerBiasActivation(final int l,
        final double value) {
    if (!isLayerBiased(l)) {
      throw new NeuralNetworkError(
          "Error, the specified layer does not have a bias: " + l);
    }

    this.structure.requireFlat();
    final int layerNumber = getLayerCount() - l - 1;
View Full Code Here

    this.structure.requireFlat();
    final int fromLayerNumber = getLayerCount() - fromLayer - 1;
    final int toLayerNumber = fromLayerNumber - 1;

    if (toLayerNumber < 0) {
      throw new NeuralNetworkError(
          "The specified layer is not connected to another layer: "
              + fromLayer);
    }

    final int weightBaseIndex
View Full Code Here

   * @param targetLayer The target layer.
   * @param neuron The target neuron.
   */
  public final void validateNeuron(final int targetLayer, final int neuron) {
    if ((targetLayer < 0) || (targetLayer >= getLayerCount())) {
      throw new NeuralNetworkError("Invalid layer count: " + targetLayer);
    }

    if ((neuron < 0) || (neuron >= getLayerTotalNeuronCount(targetLayer))) {
      throw new NeuralNetworkError("Invalid neuron number: " + neuron);
    }
  }
View Full Code Here

   */
  public MLData compute(final MLData input) {
    final MLData result = new BasicMLData(this.outputCount);

    if (this.neurons.size() == 0) {
      throw new NeuralNetworkError(
"This network has not been evolved yet, it has no neurons in the NEAT synapse.");
    }

    int flushCount = 1;

View Full Code Here

   *            The new neuron count for this layer.
   */
  public final void changeNeuronCount(final int layer, final int neuronCount) {

    if (neuronCount == 0) {
      throw new NeuralNetworkError("Can't decrease to zero neurons.");
    }

    final int currentCount = this.network.getLayerNeuronCount(layer);

    // is there anything to do?
View Full Code Here

   *            The pattern to train for.
   */
  public final void addPattern(final MLData pattern) {

    if (pattern.size() != getNeuronCount()) {
      throw new NeuralNetworkError("Network with " + getNeuronCount()
          + " neurons, cannot learn a pattern of size "
          + pattern.size());
    }

    // Create a row matrix from the input, convert boolean to bipolar
View Full Code Here

  private void increaseNeuronCount(final int targetLayer,
      final int neuronCount) {

    // check for errors
    if (targetLayer > this.network.getLayerCount()) {
      throw new NeuralNetworkError("Invalid layer " + targetLayer);
    }

    if (neuronCount <= 0) {
      throw new NeuralNetworkError("Invalid neuron count " + neuronCount);
    }

    final int oldNeuronCount = this.network
        .getLayerNeuronCount(targetLayer);
    final int increaseBy = neuronCount - oldNeuronCount;

    if (increaseBy <= 0) {
      throw new NeuralNetworkError(
          "New neuron count is either a decrease or no change: "
              + neuronCount);
    }

    // access the flat network
View Full Code Here

    // check for errors
    this.network.validateNeuron(targetLayer, neuron);

    // don't empty a layer
    if (this.network.getLayerNeuronCount(targetLayer) <= 1) {
      throw new NeuralNetworkError(
          "A layer must have at least a single neuron.  If you want to remove the entire layer you must create a new network.");
    }

    // access the flat network
    final FlatNetwork flat = this.network.getStructure().getFlat();
View Full Code Here

   */
  public final void addWeight(final int fromNeuron, final int toNeuron,
      final double value) {
    final int index = (toNeuron * this.neuronCount) + fromNeuron;
    if (index >= this.weights.length) {
      throw new NeuralNetworkError("Out of range: fromNeuron:"
          + fromNeuron + ", toNeuron: " + toNeuron);
    }
    this.weights[index] += value;
  }
View Full Code Here

TOP

Related Classes of org.encog.neural.NeuralNetworkError

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.