Package org.encog.app.analyst

Examples of org.encog.app.analyst.AnalystError


      }
      count++;
    }
   
    if( count==0 ) {
      throw new AnalystError("Can't analyze file, it is empty.");
    }


    for (final AnalyzedField field : this.fields) {
      field.completePass1();
View Full Code Here


   * @param input The input.
   * @return The output.
   */
  public double[] process(final double[] input) {
    if (input.length != this.inputSize) {
      throw new AnalystError("Invalid input size: " + input.length
          + ", should be " + this.inputSize);
    }

    this.buffer.add(0, EngineArray.arrayCopy(input));

    // are we ready yet?
    if (this.buffer.size() < this.totalDepth) {
      return null;
    }

    // create output
    final double[] output = new double[this.outputSize];

    int outputIndex = 0;
    for (final AnalystField field : this.analyst.getScript().getNormalize()
        .getNormalizedFields()) {
      if (!field.isIgnored()) {
        if (!this.headingMap.containsKey(field.getName())) {
          throw new AnalystError("Undefined field: "
              + field.getName());
        }
        final int headingIndex = this.headingMap.get(field.getName());
        final int timeslice = translateTimeSlice(field.getTimeSlice());
        final double[] row = this.buffer.get(timeslice);
View Full Code Here

    this.idealCount = getInputHeadings().length - this.inputCount;

    if ((getInputHeadings().length != this.inputCount)
        && (getInputHeadings().length
            != (this.inputCount + this.outputCount))) {
      throw new AnalystError("Invalid number of columns("
          + getInputHeadings().length + "), must match input("
          + this.inputCount + ") count or input+output("
          + (this.inputCount + this.outputCount) + ") count.");
    }
View Full Code Here

    final ReadCSV csv = new ReadCSV(getInputFilename().toString(),
        isExpectInputHeaders(), getFormat());

    if (method.getInputCount() != this.inputCount) {
      throw new AnalystError("This machine learning method has "
          + method.getInputCount()
          + " inputs, however, the data has " + this.inputCount
          + " inputs.");
    }
View Full Code Here

          }
        }
      }

      if (!success) {
        throw new AnalystError(
            "Can't determine target field automatically, "
                + "please specify one.\nThis can also happen if you "
                + "specified the wrong file format.\nNote: If your file has no headers, specify \"field:1\" - \"field:n\".");
      }
    } else {
      this.targetField = this.script
          .findAnalystField(this.targetFieldName);
      if (this.targetField == null) {
        throw new AnalystError("Invalid target field: "
            + this.targetField);
      }
    }

    this.script.getProperties().setProperty(
        ScriptProperties.DATA_CONFIG_GOAL, this.goal);

    if (!this.timeSeries && this.taskBalance) {
      this.script.getProperties().setProperty(
          ScriptProperties.BALANCE_CONFIG_BALANCE_FIELD,
          this.targetField.getName());
      final DataField field = this.analyst.getScript().findDataField(
          this.targetField.getName());
      if ((field != null) && field.isClass()) {
        final int countPer = field.getMinClassCount();
        this.script.getProperties().setProperty(
            ScriptProperties.BALANCE_CONFIG_COUNT_PER, countPer);
      } else {
        throw new AnalystError("Balance currently may only be used on a nominal/class field, not a numeric field.");
      }
    }

    // determine output field
    if (this.methodType != WizardMethodType.BayesianNetwork) {
View Full Code Here

    final PropertyEntry entry = PropertyConstraints.getInstance()
        .findEntry(dots);

    if (entry == null) {
      throw new AnalystError("Unknown property: " + args.toUpperCase());
    }

    // strip quotes
    if (value.charAt(0) == '\"') {
      value = value.substring(1);
View Full Code Here

  private void generateFeedForward(final int inputColumns,
      final int outputColumns) {
    int hidden = (int) ((inputColumns*Math.max(this.lagWindowSize,1)) * 1.5);
    if( hidden<0 ) {
      // Usual cause of this is zero inputs, which is in turn caused by not including the predicted field in the input.
      throw new AnalystError("Can't have zero hidden neurons, make sure you have both input fields defined.\n "
          + "You might need to include the predicted field in the input.");
    }

    this.script.getProperties().setProperty(
        ScriptProperties.ML_CONFIG_TYPE,
View Full Code Here

      final int outputColumns) {

    int segment = this.evidenceSegements;

    if (!this.targetField.isClassify()) {
      throw new AnalystError(
          "Bayesian networks cannot be used for regression.");
    }

    StringBuilder a = new StringBuilder();
    for (DataField field : this.analyst.getScript().getFields()) {
View Full Code Here

   */
  private void generateGenerate() {
    determineTargetField();

    if (this.targetField == null) {
      throw new AnalystError(
          "Failed to find normalized version of target field: "
              + this.targetField);
    }

    final int inputColumns = this.script.getNormalize()
        .calculateInputColumns();
    final int idealColumns = this.script.getNormalize()
        .calculateOutputColumns();

    switch (this.methodType) {
    case BayesianNetwork:
      generateBayesian(inputColumns, idealColumns);
      break;
    case FeedForward:
      generateFeedForward(inputColumns, idealColumns);
      break;
    case SVM:
      generateSVM(inputColumns, idealColumns);
      break;
    case RBF:
      generateRBF(inputColumns, idealColumns);
      break;
    case SOM:
      generateSOM(inputColumns);
      break;
    case PNN:
      generatePNN(inputColumns, idealColumns);
      break;
    case NEAT:
      generateNEAT(inputColumns, idealColumns);
      break;
    case EPL:
      generateEPL(inputColumns, idealColumns);
      break;
    default:
      throw new AnalystError("Unknown method type");
    }
  }
View Full Code Here

   *            The number of input columns.
   */
  private void generateSOM(final int inputColumns) {

    if (!this.targetField.isClassify()) {
      throw new AnalystError("SOM cannot be used for regression.");
    }

    this.script.getProperties().setProperty(
        ScriptProperties.ML_CONFIG_TYPE, MLMethodFactory.TYPE_SOM);
    this.script.getProperties().setProperty(
View Full Code Here

TOP

Related Classes of org.encog.app.analyst.AnalystError

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.