Package org.encog

Examples of org.encog.EncogError


 
 
  public static void validateMethodToData(MLMethod method, MLDataSet training) {
   
    if( !(method instanceof MLInput) || !(method instanceof MLOutput) ) {
      throw new EncogError("This machine learning method is not compatible with the provided data.");
    }
   
    int trainingInputCount = training.getInputSize();
    int trainingOutputCount = training.getIdealSize();
    int methodInputCount = 0;
    int methodOutputCount = 0;
   
    if( method instanceof MLInput ) {
      methodInputCount = ((MLInput)method).getInputCount();
    }
   
    if( method instanceof MLOutput ) {
      methodOutputCount = ((MLOutput)method).getOutputCount();
    }
   
    if( methodInputCount != trainingInputCount ) {
      throw new EncogError("The machine learning method has an input length of " + methodInputCount + ", but the training data has " + trainingInputCount  + ". They must be the same.");
    }
   
    if( trainingOutputCount>0 && methodOutputCount != trainingOutputCount ) {
      throw new EncogError("The machine learning method has an output length of " + methodOutputCount + ", but the training data has " + trainingOutputCount  + ". They must be the same.");
    }
   
  }
View Full Code Here


        getImageWidth(), getImageHeight(), true);

    try {
      grabber.grabPixels();
    } catch (final InterruptedException e) {
      throw new EncogError(e);
    }

    setPixelMap((int[]) grabber.getPixels());

    // now downsample
View Full Code Here

        elementIndex++;
      }

      return result;
    } catch (final OutOfMemoryError e) {
      throw new EncogError("SVM Model - Out of Memory");
    }
  }
View Full Code Here

        this.imageWidth, this.imageWidth, true);

    try {
      grabber.grabPixels();
    } catch (final InterruptedException e) {
      throw new EncogError(e);
    }

    this.pixelMap = (int[]) grabber.getPixels();

    // now downsample
View Full Code Here

  public SVMSearchJob(final SVM svm, final MLDataSet dataSet,
      final StatusReportable report) {
    super(report);
    if (svm.getKernelType() != KernelType.RadialBasisFunction) {
      throw new EncogError(
          "To use SVM search train, the SVM kernel must be RBF.");
    }

    this.problem = EncodeSVMProblem.encode(dataSet, 0);
    this.modelSVM = svm;
View Full Code Here

    this.bestError = Double.MAX_VALUE;
  }

  @Override
  public void addStrategy(final Strategy strategy) {
    throw new EncogError("Not supported.");

  }
View Full Code Here

  }

  public void executeLine() throws IOException {
    final int index = this.line.indexOf(':');
    if (index == -1) {
      throw new EncogError("Invalid command: " + this.line);
    }

    final String command = this.line.substring(0, index).toLowerCase()
        .trim();
    final String argsStr = this.line.substring(index + 1).trim();
    final StringTokenizer tok = new StringTokenizer(argsStr, ",");
    this.args.clear();
    while (tok.hasMoreTokens()) {
      final String arg = tok.nextToken();
      final int index2 = arg.indexOf(':');
      if (index2 == -1) {
        throw new EncogError("Invalid command: " + this.line);
      }
      final String key = arg.substring(0, index2).toLowerCase().trim();
      final String value = arg.substring(index2 + 1).trim();
      this.args.put(key, value);
    }
View Full Code Here

  }

  private String getArg(final String name) {
    final String result = this.args.get(name);
    if (result == null) {
      throw new EncogError("Missing argument " + name + " on line: "
          + this.line);
    }
    return result;
  }
View Full Code Here

   */
  public void close() {
    try {
      this.output.close();
    } catch (final IOException e) {
      throw new EncogError(e);
    }
  }
View Full Code Here

    if (this.network.getHasContext()) {
      copyContexts();
    }

    if (this.reportedException != null) {
      throw (new EncogError(this.reportedException));
    }
  }
View Full Code Here

TOP

Related Classes of org.encog.EncogError

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.