Package weka.core

Examples of weka.core.Instances.attribute()


  } else if (dataSet.attribute(j).isNominal()) {
    // find correct index
    Hashtable<Object,Integer> lookup = m_cumulativeStructure.get(j);
    int index = ((Integer)lookup.get(cval)).intValue();
    vals[j] = index;
  } else if (dataSet.attribute(j).isString()) {
    vals[j] = dataSet.attribute(j).addStringValue("" + cval);
  } else {
    vals[j] = ((Double)cval).doubleValue();
  }
      }
View Full Code Here


    // find correct index
    Hashtable<Object,Integer> lookup = m_cumulativeStructure.get(j);
    int index = ((Integer)lookup.get(cval)).intValue();
    vals[j] = index;
  } else if (dataSet.attribute(j).isString()) {
    vals[j] = dataSet.attribute(j).addStringValue("" + cval);
  } else {
    vals[j] = ((Double)cval).doubleValue();
  }
      }
      dataSet.add(new DenseInstance(1.0, vals));
View Full Code Here

     
      // check here - just in case the user has uninstalled/deleted a plugin
      // perspective since the last time that the user-selected visible perspectives
      // list was written out to the props file
      if (pName != null) {
        int index = perspectiveInstances.attribute(pName).index();
        selectedPerspectives[index] = true;
      }
    }

    m_perspectiveConfigurer.setInstances(perspectiveInstances);
View Full Code Here

     
      // check here - just in case the user has uninstalled/deleted a plugin
      // perspective since the last time that the user-selected visible perspectives
      // list was written out to the props file
      if (pName != null) {
        int index = perspectiveInstances.attribute(pName).index();
        selectedPerspectives[index] = true;
      }
    }

    m_perspectiveConfigurer.setInstances(perspectiveInstances);
View Full Code Here

    }

    // process the target(s) first
    if (!dateOnly) {
      for (String target : targets) {
        if (result.attribute(target) != null) {
          int attIndex = result.attribute(target).index();
          double lastNonMissing = weka.core.Utils.missingValue();

          // We won't handle missing target values at the start or end
          // as experiments with using simple linear regression to fill
View Full Code Here

    // process the target(s) first
    if (!dateOnly) {
      for (String target : targets) {
        if (result.attribute(target) != null) {
          int attIndex = result.attribute(target).index();
          double lastNonMissing = weka.core.Utils.missingValue();

          // We won't handle missing target values at the start or end
          // as experiments with using simple linear regression to fill
          // the missing values that are created by default by the lagging
View Full Code Here

    List<String> fieldsToForecast =
      AbstractForecaster.stringToList(forecaster.getFieldsToForecast());
    for (int i = 0; i < overlay.numInstances(); i++) {
      Instance current = overlay.instance(i);
      for (String target : fieldsToForecast) {
        current.setValue(overlay.attribute(target), Utils.missingValue());
      }
    }

    return overlay;
  }
View Full Code Here

         
          // make sure that selected stuff stays selected
          boolean[] newSelected = new boolean[insts.numAttributes()];
          for (int i = 0; i < selected.length; i++) {
            Attribute toFind = oldList.attribute(selected[i]);
            Attribute toSet = insts.attribute(toFind.name());
            if (toSet != null) {
              newSelected[toSet.index()] = true;
            }
          }
          try {
View Full Code Here

      throws Exception {
    Instances result = insts;

    if (m_adjustForTrends && !m_useArtificialTimeIndex
        && m_timeStampName != null && m_timeStampName.length() > 0) {
      if (result.attribute(m_timeStampName).isDate()) {
        int origIndex = result.attribute(m_timeStampName).index();

        // find first non-missing date and set as base
        GregorianCalendar c = new GregorianCalendar();
        for (int i = 0; i < result.numInstances(); i++) {
View Full Code Here

    Instances result = insts;

    if (m_adjustForTrends && !m_useArtificialTimeIndex
        && m_timeStampName != null && m_timeStampName.length() > 0) {
      if (result.attribute(m_timeStampName).isDate()) {
        int origIndex = result.attribute(m_timeStampName).index();

        // find first non-missing date and set as base
        GregorianCalendar c = new GregorianCalendar();
        for (int i = 0; i < result.numInstances(); i++) {
          if (!result.instance(i).isMissing(origIndex)) {
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.