Package org.encog.neural

Examples of org.encog.neural.NeuralNetworkError


    final int expectedSideLength = (int) Math.pow(totalNumHiddenNeurons,
        1.0 / dimensions);
    final double cmp = Math.pow(totalNumHiddenNeurons, 1.0 / dimensions);

    if (expectedSideLength != cmp) {
      throw new NeuralNetworkError(
          "Total number of RBF neurons must be some integer to the power of 'dimensions'.\n"
              + Format.formatDouble(expectedSideLength, 5)
              + " <> " + Format.formatDouble(cmp, 5));
    }
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

      break;
    case NewSupportVectorRegression:
      this.params.svm_type = svm_parameter.NU_SVR;
      break;
    default:
      throw new NeuralNetworkError("Invalid svm type");
    }

    switch (kernelType) {
    case Linear:
      this.params.kernel_type = svm_parameter.LINEAR;
      break;
    case Poly:
      this.params.kernel_type = svm_parameter.POLY;
      break;
    case RadialBasisFunction:
      this.params.kernel_type = svm_parameter.RBF;
      break;
    case Sigmoid:
      this.params.kernel_type = svm_parameter.SIGMOID;
      break;
    case Precomputed:
      this.params.kernel_type = svm_parameter.PRECOMPUTED;
      break;
    default:
      throw new NeuralNetworkError("Invalid kernel type");
    }

    // params[i].kernel_type = svm_parameter.RBF;
    this.params.degree = DEFAULT_DEGREE;
    this.params.coef0 = 0;
View Full Code Here

    int inputCount = network.getFlat().getInputCount();
    int outputCount = network.getFlat().getOutputCount();   

    if (inputCount != training.getInputSize()) {
      throw new NeuralNetworkError("The input layer size of "
          + inputCount
          + " must match the training input size of "
          + training.getInputSize() + ".");
    }

    if ((training.getIdealSize() > 0)
        && (outputCount != training.getIdealSize())) {
      throw new NeuralNetworkError("The output layer size of "
          + outputCount
          + " must match the training input size of "
          + training.getIdealSize() + ".");
    }
  }
View Full Code Here

  /**
   * End the current tag.
   */
  public void endTag() {
    if (this.tagStack.isEmpty()) {
      throw new NeuralNetworkError(
          "Can't create end tag, no beginning tag.");
    }
    final String tag = this.tagStack.pop();

    final StringBuilder builder = new StringBuilder();
View Full Code Here

      this.priors = new double[getOutputCount()];

      for (final MLDataPair pair : samples) {
        final int i = (int) pair.getIdeal().getData(0);
        if (i >= this.countPer.length) {
          throw new NeuralNetworkError(
              "Training data contains more classes than neural network has output neurons to hold.");
        }
        this.countPer[i]++;
      }
View Full Code Here

        break;
      case MexicanHat:
        this.radial = new MexicanHatFunction(1);
        break;   
      default:
        throw new NeuralNetworkError("Unknown RBF type: " + type.toString());
    }
   
    this.radial.setWidth(1.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.