Examples of AnalystField


Examples of org.encog.app.analyst.script.normalize.AnalystField

    // determine output field
    if (this.methodType != WizardMethodType.BayesianNetwork) {
      // now that the target field has been determined, set the analyst
      // fields
      AnalystField af = null;
      for (final AnalystField field : this.analyst.getScript()
          .getNormalize().getNormalizedFields()) {
        if ((field.getAction() != NormalizationAction.Ignore)
            && field == this.targetField) {
          if ((af == null)
              || (af.getTimeSlice() < field.getTimeSlice())) {
            af = field;
          }
        }
      }

      /* If we found the output field, then flip its status to output */
      if (af != null) {
        af.setOutput(true);
        /* However, if we are including the target field in the input, for time series,
         * then we must create an input field for it.
         */
        if( this.includeTargetField ) {
          AnalystField af2 = new AnalystField(af);
          af.setOutput(false);
          this.script.getNormalize().getNormalizedFields().add(af2);
        }
      }
    }
View Full Code Here

Examples of org.encog.app.analyst.script.normalize.AnalystField

    // generate the inputs for the new list
    for (final AnalystField field : oldList) {
      if (!field.isIgnored()) {
        if (field.isInput()) {
          for (int i = 0; i < this.lagWindowSize; i++) {
            final AnalystField newField = new AnalystField(field);
            newField.setTimeSlice(-i);
            newField.setOutput(false);
            newList.add(newField);
          }
        }
      } else {
        newList.add(field);
      }
    }

    // generate the outputs for the new list
    for (final AnalystField field : oldList) {
      if (!field.isIgnored()) {
        if (field.isOutput()) {
          for (int i = 1; i <= this.leadWindowSize; i++) {
            final AnalystField newField = new AnalystField(field);
            newField.setTimeSlice(i);
            newList.add(newField);
          }
        }
      }
    }
View Full Code Here

Examples of org.encog.app.analyst.script.normalize.AnalystField

      NormalizationAction action;
      final boolean isLast = i == this.script.getFields().length - 1;

      if( (this.methodType == WizardMethodType.EPL ) || (this.methodType == WizardMethodType.BayesianNetwork) ) {
        AnalystField af;
        if (f.isClass()) {
          af = new AnalystField(f.getName(),
              NormalizationAction.SingleField, 0, 0);
        } else {
          af = new AnalystField(f.getName(),
              NormalizationAction.PassThrough, 0, 0);
        }
        norm.add(af);
      } else if ((f.isInteger() || f.isReal()) && !f.isClass()) {
        action = NormalizationAction.Normalize;
        AnalystField af;
        if (this.range == NormalizeRange.NegOne2One) {
          af = new AnalystField(f.getName(), action, 1, -1);
        } else {
          af = new AnalystField(f.getName(), action, 1, 0);
        }
        norm.add(af);
        af.setActualHigh(f.getMax());
        af.setActualLow(f.getMin());
      } else if (f.isClass()) {
        if (isLast && this.directClassification) {
          action = NormalizationAction.SingleField;
        } else if (f.getClassMembers().size() > 2) {
          action = NormalizationAction.Equilateral;
        } else {
          action = NormalizationAction.OneOf;
        }

        if (this.range == NormalizeRange.NegOne2One) {
          norm.add(new AnalystField(f.getName(), action, 1, -1));
        } else {
          norm.add(new AnalystField(f.getName(), action, 1, 0));
        }
      } else {
        action = NormalizationAction.Ignore;
        norm.add(new AnalystField(action, f.getName()));
      }
    }

    this.script.getNormalize().init(this.script);
  }
View Full Code Here

Examples of org.encog.app.analyst.script.normalize.AnalystField

    generateSettings();
    generateSourceData(sourceData);
    generateNormalizedFields();

    // if there is a time field, then ignore it
    AnalystField timeField = this.script.findAnalystField("time");
    if (timeField != null) {
      timeField.setAction(NormalizationAction.Ignore);
    }

    generateSegregate();
    generateGenerate();
    generateProcess(backwardWindow, forwardWindow, prediction, predictField);
View Full Code Here

Examples of org.encog.app.analyst.script.normalize.AnalystField

          des = NormalizationAction.OneOf;
        } else {
          throw new AnalystError("Unknown field type:" + action);
        }

        final AnalystField nf = new AnalystField(name, des, high, low);
        nf.setTimeSlice(timeSlice);
        nf.setOutput(isOutput);
        this.script.getNormalize().getNormalizedFields().add(nf);
      } else {
        first = false;
      }
    }
View Full Code Here

Examples of org.encog.app.analyst.script.normalize.AnalystField

    return false;
  }

  public AnalystField defineField(String fieldName, FieldDirection d, NormalizationAction action,
      double theActualHigh, double theActualLow) {
    AnalystField field = new AnalystField();

    if (action == NormalizationAction.Equilateral
        || action == NormalizationAction.OneOf) {
      throw new AnalystError(
          "Must use defineClass if you are going to use Equilateral or OneOf");
    }

    // add underlying raw field
    DataField df = new DataField(fieldName);
    df.setMax(theActualHigh);
    df.setMin(theActualLow);
    df.setReal(true);
    df.setClass(false);
    df.setMean(theActualLow + ((theActualHigh - theActualLow) / 2));

    if (this.getFields() == null) {
      this.setFields(new DataField[] { df });
    } else {
      int len = this.getFields().length;
      DataField[] added = Arrays.copyOf(this.getFields(), len+1);
      added[len] = df;
      this.setFields(added);
    }

    // add a normalized field

    field.setAction(action);
    field.setNormalizedHigh(this.defaultNormalizedRangeHigh);
    field.setNormalizedLow(this.defaultNormalizedRangeLow);
    field.setActualHigh(theActualHigh);
    field.setActualLow(theActualLow);
    field.setName(fieldName);
    field.setOutput(d==FieldDirection.Output || d==FieldDirection.InputOutput);

    getNormalize().getNormalizedFields().add(field);
    return field;
  }
View Full Code Here

Examples of org.encog.app.analyst.script.normalize.AnalystField

    this.defaultNormalizedRangeHigh = high;
  }

  public AnalystField defineClass(String fieldName, FieldDirection d, NormalizationAction action,
      List<ClassItem> classes) {
    AnalystField field = new AnalystField();

    if (action != NormalizationAction.Equilateral
        && action != NormalizationAction.OneOf) {
      throw new AnalystError(
          "defineClass can only be used with action type of Equilateral or OneOf");
    }

    field.setAction(action);
    field.setNormalizedHigh(this.defaultNormalizedRangeHigh);
    field.setNormalizedLow(this.defaultNormalizedRangeLow);
    field.setActualHigh(0);
    field.setActualLow(0);
    field.setName(fieldName);
    field.setOutput(d==FieldDirection.Output || d==FieldDirection.InputOutput);
    field.getClasses().addAll(classes);

    getNormalize().getNormalizedFields().add(field);
    return field;
  }
View Full Code Here

Examples of org.encog.app.analyst.script.normalize.AnalystField

    MLDataSet data = obtainTrainingSet();
    return ((MLError)method).calculateError(data);
  }

  public void dumpAnalystField(int i) {
    AnalystField af = this.encogAnalyst.getScript().getNormalize().getNormalizedFields().get(i);
   
    System.out.print(Format.formatDouble(af.getActualHigh(),6));
    System.out.print(";");
    System.out.print(Format.formatDouble(af.getActualLow(),6));
    System.out.print(";");
    System.out.print(Format.formatDouble(af.getNormalizedHigh(),6));
    System.out.print(";");
    System.out.print(Format.formatDouble(af.getNormalizedLow(),6));
    System.out.print(";");
    System.out.print(af.getName());
    System.out.print(";");
    System.out.print(af.getTimeSlice());
    System.out.print(";");
    System.out.println(af.getAction().toString());
   
  }
View Full Code Here

Examples of org.encog.app.analyst.script.normalize.AnalystField

   
  }

  public void validateAnalystField(int i, double high, double low, double normHigh, double normLow,
      String name, int timeSlice, String action) {
    AnalystField af = this.encogAnalyst.getScript().getNormalize().getNormalizedFields().get(i);
    Assert.assertEquals(high, af.getActualHigh(),0.001);
    Assert.assertEquals(low, af.getActualLow(),0.001);
    Assert.assertEquals(normHigh, af.getNormalizedHigh(),0.001);
    Assert.assertEquals(normLow, af.getNormalizedLow(),0.001);
    Assert.assertEquals(name, af.getName() );
    Assert.assertEquals(timeSlice, af.getTimeSlice() );
    Assert.assertEquals(action, af.getAction().toString() );
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.