Examples of AnalystField


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

    final List<Integer> fields = new ArrayList<Integer>();

    for (int currentIndex = 0; currentIndex < headerList.size(); currentIndex++) {
      final String baseName = headerList.getBaseHeader(currentIndex);
      final int slice = headerList.getSlice(currentIndex);
      final AnalystField field = getAnalyst().getScript()
          .findNormalizedField(baseName, slice);

      if (field != null && field.isOutput()) {
        fields.add(currentIndex);
      }
    }

    // allocate result array
View Full Code Here

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

    final List<Integer> fields = new ArrayList<Integer>();

    for (int currentIndex = 0; currentIndex < headerList.size(); currentIndex++) {
      final String baseName = headerList.getBaseHeader(currentIndex);
      final int slice = headerList.getSlice(currentIndex);
      final AnalystField field = getAnalyst().getScript()
          .findNormalizedField(baseName, slice);

      if (field != null && field.isInput()) {
        fields.add(currentIndex);
      }
    }

    // allocate result array
View Full Code Here

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

            ScriptProperties.BALANCE_CONFIG_COUNT_PER, countPer);
      }
    }

    // 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.getName().equalsIgnoreCase(this.targetField)) {
        if ((af == null) || (af.getTimeSlice() < field.getTimeSlice())) {
          af = field;
        }
      }
    }

    if (af != null) {
      af.setOutput(true);
    }

    // set the clusters count
    if (this.taskCluster) {
      if ((this.targetField.length() == 0)
View Full Code Here

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

    for (final AnalystField field : oldList) {
      if (!field.isIgnored()) {

        if (this.includeTargetField || 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 ((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

          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

  public String getTemplatePath() {
    return "org/encog/data/mt4.mql4";
  }

  private void processCalc() {
    AnalystField firstOutputField = null;
    final int barsNeeded = Math.abs(getAnalyst().determineMinTimeSlice());

    final int inputCount = getAnalyst().determineInputCount();
    final int outputCount = getAnalyst().determineOutputCount();

    setIndentLevel(2);
    addLine("if( _inputCount>0 && Bars>=" + barsNeeded + " )");
    addLine("{");
    indentIn();
    addLine("double input[" + inputCount + "];");
    addLine("double output[" + outputCount + "];");

    int idx = 0;
    for (final AnalystField field : getAnalyst().getScript().getNormalize()
        .getNormalizedFields()) {
      if (field.isInput()) {

        final DataField df = getAnalyst().getScript().findDataField(
            field.getName());
        String str;

        switch (field.getAction()) {
        case PassThrough:
          str = EngineArray.replace(df.getSource(), "##", "pos+"
              + (-field.getTimeSlice()));
          addLine("input[" + idx + "]=" + str + ";");
          idx++;
          break;
        case Normalize:
          str = EngineArray.replace(df.getSource(), "##", "pos+"
              + (-field.getTimeSlice()));
          addLine("input[" + idx + "]=Norm(" + str + ","
              + field.getNormalizedHigh() + ","
              + field.getNormalizedLow() + ","
              + field.getActualHigh() + ","
              + field.getActualLow() + ");");
          idx++;
          break;
        case Ignore:
          break;
        default:
          throw new AnalystCodeGenerationError(
              "Can't generate Ninjascript code, unsupported normalizatoin action: "
                  + field.getAction().toString());
        }
      }
      if (field.isOutput()) {
        if (firstOutputField == null) {
          firstOutputField = field;
        }
      }
    }

    if (firstOutputField == null) {
      throw new AnalystCodeGenerationError(
          "Could not find an output field.");
    }

    addLine("Compute(input,output);");

    addLine("ExtMapBuffer1[pos] = DeNorm(output[0]" + ","
        + firstOutputField.getNormalizedHigh() + ","
        + firstOutputField.getNormalizedLow() + ","
        + firstOutputField.getActualHigh() + ","
        + firstOutputField.getActualLow() + ");");
    indentOut();
    addLine("}");
    setIndentLevel(2);

  }
View Full Code Here

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

    final List<Integer> fields = new ArrayList<Integer>();

    for (int currentIndex = 0; currentIndex < headerList.size(); currentIndex++) {
      final String baseName = headerList.getBaseHeader(currentIndex);
      final int slice = headerList.getSlice(currentIndex);
      final AnalystField field = getAnalyst().getScript()
          .findNormalizedField(baseName, slice);

      if (field != null && field.isOutput()) {
        fields.add(currentIndex);
      }
    }

    // allocate result array
View Full Code Here

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

    final List<Integer> fields = new ArrayList<Integer>();

    for (int currentIndex = 0; currentIndex < headerList.size(); currentIndex++) {
      final String baseName = headerList.getBaseHeader(currentIndex);
      final int slice = headerList.getSlice(currentIndex);
      final AnalystField field = getAnalyst().getScript()
          .findNormalizedField(baseName, slice);

      if (field != null && field.isInput()) {
        fields.add(currentIndex);
      }
    }

    // allocate result array
View Full Code Here

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

    addLine("#endregion");
    setIndentLevel(0);
  }

  private void processCalc() {
    AnalystField firstOutputField = null;
    int barsNeeded = Math.abs(this.getAnalyst().determineMinTimeSlice());

    setIndentLevel(2);
    addLine("if( _inputCount>0 && CurrentBar>=" + barsNeeded + " )");
    addLine("{");
    indentIn();
    addLine("double[] input = new double[_inputCount];");
    addLine("double[] output = new double[_outputCount];");

    int idx = 0;
    for (AnalystField field : this.getAnalyst().getScript().getNormalize()
        .getNormalizedFields()) {
      if (field.isInput()) {
        String str;
        DataField df = this.getAnalyst().getScript()
            .findDataField(field.getName());

        switch (field.getAction()) {
        case PassThrough:
          str = EngineArray.replace(df.getSource(),"##", ""+ (-field.getTimeSlice()));
          addLine("input[" + idx + "]=" + str + ";");
          idx++;
          break;
        case Normalize:
          str = EngineArray.replace(df.getSource(),"##",""+ (-field.getTimeSlice()));
          addLine("input[" + idx + "]=Norm(" + str + ","
              + field.getNormalizedHigh() + ","
              + field.getNormalizedLow() + ","
              + field.getActualHigh() + ","
              + field.getActualLow() + ");");
          idx++;
          break;
        case Ignore:
          break;
        default:
          throw new AnalystCodeGenerationError(
              "Can't generate Ninjascript code, unsupported normalizatoin action: "
                  + field.getAction().toString());
        }
      }
      if (field.isOutput()) {
        if (firstOutputField == null) {
          firstOutputField = field;
        }
      }
    }

    if (firstOutputField != null) {
      addLine("Compute(input,output);");
      addLine("Output.Set(DeNorm(output[0]" + ","
          + firstOutputField.getNormalizedHigh() + ","
          + firstOutputField.getNormalizedLow() + ","
          + firstOutputField.getActualHigh() + ","
          + firstOutputField.getActualLow() + "));");
      indentOut();
    }

    addLine("}");
    setIndentLevel(2);
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.