Package org.encog.neural

Examples of org.encog.neural.NeuralNetworkError


  /**
   * Throw an error if there is no flat network.
   */
  public final void requireFlat() {
    if (this.flat == null) {
      throw new NeuralNetworkError(
          "Must call finalizeStructure before using this network.");
    }
  }
View Full Code Here


      final MLMethod network) {
    if (network instanceof MLEncodable) {
      ((MLEncodable) network).decodeFromArray(array);
      return;
    }
    throw new NeuralNetworkError(NetworkCODEC.ERROR
        + network.getClass().getName());
  }
View Full Code Here

      return false;
    }

    final double test = Math.pow(10.0, precision);
    if (Double.isInfinite(test) || (test > Long.MAX_VALUE)) {
      throw new NeuralNetworkError("Precision of " + precision
          + " decimal places is not supported.");
    }

    for (int i = 0; i < array1.length; i++) {
      final long l1 = (long) (array1[i] * test);
 
View Full Code Here

   */
  public static int networkSize(final MLMethod network) {
    if (network instanceof MLEncodable) {
      return ((MLEncodable) network).encodedArrayLength();
    }
    throw new NeuralNetworkError(NetworkCODEC.ERROR
        + network.getClass().getName());
  }
View Full Code Here

    if (network instanceof MLEncodable) {
      final double[] encoded = new double[size];
      ((MLEncodable) network).encodeToArray(encoded);
      return encoded;
    }
    throw new NeuralNetworkError(NetworkCODEC.ERROR
        + network.getClass().getName());

  }
View Full Code Here

   * {@inheritDoc}
   */
  @Override
  public int classify(final MLData input) {
    if (input.size() > getInputCount()) {
      throw new NeuralNetworkError(
          "Can't classify SOM with input size of " + getInputCount()
              + " with input data of count " + input.size());
    }

    double[][] m = this.weights.getData();
View Full Code Here

   */
  public int calculateBMU(final MLData input) {
    int result = 0;
   
    if( input.size()>this.som.getInputCount() ) {
      throw new NeuralNetworkError("Can't train SOM with input size of " + som.getInputCount()
          + " with input data of count "
          + input.size());
    }
   
    // Track the lowest distance so far.
View Full Code Here

   */
  public SOMClusterCopyTraining(final SOM network, final MLDataSet training) {
    super(TrainingImplementationType.OnePass);
    this.network = network;
    if (this.network.getOutputCount() < training.getRecordCount()) {
      throw new NeuralNetworkError(
          "To use cluster copy training you must have at least as many output neurons as training elements.");
    }   
    setTraining(training);
  }
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 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

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.