Package org.encog.neural

Examples of org.encog.neural.NeuralNetworkError


public class TestException extends TestCase {
  public void testExceptions()
  {
    NullPointerException npe = new NullPointerException();
    new MatrixError(npe);
    new NeuralNetworkError(npe);
    new BotError(npe);
    new BotError("test");
    new BrowseError(npe);
    new BrowseError("test");
  }
View Full Code Here


   */
  public TrainAdaline(final BasicNetwork network, final MLDataSet training,
      final double learningRate) {
    super(TrainingImplementationType.Iterative);
    if (network.getLayerCount() > 2) {
      throw new NeuralNetworkError(
          "An ADALINE network only has two layers.");
    }
    this.network = network;

    this.training = training;
View Full Code Here

   * If an error has been reported, then throw it as an exception.
   */
  private void reportErrors() {
    for (final TrainingJob job : this.queue) {
      if (job.getError() != null) {
        throw new NeuralNetworkError(job.getError());
      }
    }
  }
View Full Code Here

   * {@inheritDoc}
   */
  @Override
  public final void perform(final TrainingJob job) {
    if (!this.ready.get()) {
      throw new NeuralNetworkError(
          "Performer is already performing a job.");
    }

    this.ready.set(false);
    this.currentJob = job;
View Full Code Here

    super(populationSize);
    this.inputCount = inputCount;
    this.outputCount = outputCount;

    if (populationSize == 0) {
      throw new NeuralNetworkError(
          "Population must have more than zero genomes.");
    }

    // create the initial population
    for (int i = 0; i < populationSize; i++) {
View Full Code Here

      final MLData result = new BasicMLData(this.structure.getFlat()
          .getOutputCount());
      this.structure.getFlat().compute(input.getData(), result.getData());
      return result;
    } catch (final ArrayIndexOutOfBoundsException ex) {
      throw new NeuralNetworkError(
          "Index exception: there was likely a mismatch between layer sizes, or the size of the input presented to the network.",
          ex);
    }
  }
View Full Code Here

  @Override
  public final void decodeFromArray(final double[] encoded) {
    this.structure.requireFlat();
    final double[] weights = this.structure.getFlat().getWeights();
    if (weights.length != encoded.length) {
      throw new NeuralNetworkError(
          "Size mismatch, encoded array should be of length "
              + weights.length);
    }

    EngineArray.arrayCopy(encoded, weights);
View Full Code Here

  @Override
  public final void encodeToArray(final double[] encoded) {
    this.structure.requireFlat();
    final double[] weights = this.structure.getFlat().getWeights();
    if (weights.length != encoded.length) {
      throw new NeuralNetworkError(
          "Size mismatch, encoded array should be of length "
              + weights.length);
    }

    EngineArray.arrayCopy(weights, encoded);
View Full Code Here

   * @param l The layer.
   * @return The bias activation.
   */
  public final double getLayerBiasActivation(final int l) {
    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

    final int layerNumber = getLayerCount() - layer - 1;
    final int index = this.structure.getFlat().getLayerIndex()[layerNumber]
        + neuronNumber;
    final double[] output = this.structure.getFlat().getLayerOutput();
    if (index >= output.length) {
      throw new NeuralNetworkError("The layer index: " + index
          + " specifies an output index larger than the network has.");
    }
    return output[index];
  }
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.