Package org.encog.neural

Examples of org.encog.neural.NeuralNetworkError


    this.height = theHeight;
    this.width = theWidth;

    for (final MLDataPair pair : this) {
      if (!(pair.getInput() instanceof ImageNeuralData)) {
        throw new NeuralNetworkError(
            "Invalid class type found in ImageNeuralDataSet, only "
                + "ImageNeuralData items are allowed.");
      }

      final ImageNeuralData input = (ImageNeuralData) pair.getInput();
View Full Code Here


    } else if (rbfLayer.getName().equalsIgnoreCase("InverseMultiquadric")) {
      t = RBFEnum.InverseMultiquadric;
    } else if (rbfLayer.getName().equalsIgnoreCase("MexicanHat")) {
      t = RBFEnum.MexicanHat;
    } else {
      throw new NeuralNetworkError("Unknown RBF: " + rbfLayer.getName());
    }

    final ParamsHolder holder = new ParamsHolder(rbfLayer.getParams());

    final int rbfCount = holder.getInt("C", true, 0);
View Full Code Here

    } else if (pnnLayer.getName().equalsIgnoreCase("r")) {
      outmodel = PNNOutputMode.Regression;
    } else if (pnnLayer.getName().equalsIgnoreCase("u")) {
      outmodel = PNNOutputMode.Unsupervised;
    } else {
      throw new NeuralNetworkError("Unknown model: "
          + pnnLayer.getName());
    }

    final ParamsHolder holder = new ParamsHolder(pnnLayer.getParams());

    final String kernelStr = holder.getString("KERNEL", false, "gaussian");
   
    if (kernelStr.equalsIgnoreCase("gaussian")) {
      kernel = PNNKernelType.Gaussian;
    } else if (kernelStr.equalsIgnoreCase("reciprocal")) {
      kernel = PNNKernelType.Reciprocal;
    } else {
      throw new NeuralNetworkError("Unknown kernel: " + kernelStr);
    }
     
    final BasicPNN result = new BasicPNN(kernel, outmodel,
        inputCount, outputCount);
View Full Code Here

   * @param input
   *            NOT USED
   * @return NOT USED
   */
  public MLData compute(final MLData input) {
    throw new NeuralNetworkError(
        "Compute on BasicNetwork cannot be used, rather call"
            + " the compute(NeuralData) method on the BAMLogic.");

  }
View Full Code Here

    } else if (pnnLayer.getName().equalsIgnoreCase("r")) {
      outmodel = PNNOutputMode.Regression;
    } else if (pnnLayer.getName().equalsIgnoreCase("u")) {
      outmodel = PNNOutputMode.Unsupervised;
    } else {
      throw new NeuralNetworkError("Unknown model: "
          + pnnLayer.getName());
    }

    final ParamsHolder holder = new ParamsHolder(pnnLayer.getParams());

    final String kernelStr = holder.getString("KERNEL", false, "gaussian");
   
    if (kernelStr.equalsIgnoreCase("gaussian")) {
      kernel = PNNKernelType.Gaussian;
    } else if (kernelStr.equalsIgnoreCase("reciprocal")) {
      kernel = PNNKernelType.Reciprocal;
    } else {
      throw new NeuralNetworkError("Unknown kernel: " + kernelStr);
    }
     
    final BasicPNN result = new BasicPNN(kernel, outmodel,
        inputCount, outputCount);
View Full Code Here

    } else if (rbfLayer.getName().equalsIgnoreCase("InverseMultiquadric")) {
      t = RBFEnum.InverseMultiquadric;
    } else if (rbfLayer.getName().equalsIgnoreCase("MexicanHat")) {
      t = RBFEnum.MexicanHat;
    } else {
      throw new NeuralNetworkError("Unknown RBF: " + rbfLayer.getName());
    }

    final ParamsHolder holder = new ParamsHolder(rbfLayer.getParams());

    final int rbfCount = holder.getInt("C", true, 0);
View Full Code Here

   *            The new neuron count for this layer.
   */
  public 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

  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 int classify(final MLData input) {
    final BiPolarNeuralData input2 = new BiPolarNeuralData(this.f1Count);
    final BiPolarNeuralData output = new BiPolarNeuralData(this.f2Count);

    if (input.size() != input2.size()) {
      throw new NeuralNetworkError("Input array size does not match.");
    }

    for (int i = 0; i < input2.size(); i++) {
      input2.setData(i, input.getData(i) > 0);
    }
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.