Package weka.estimators

Examples of weka.estimators.DiscreteEstimator.addValue()


      // if no DiscreteEstimator is present in the map, create one
      if (df == null) {
  df = new DiscreteEstimator(instances.numClasses(), 0);
      }
      df.addValue(instance.classValue(), instance.weight()); // update
      m_estimatedDistributions.put(c, df); // put back in map
    }

    // Create the attributes for m_baseMin and m_baseMax.
    // These are identical to those of m_train, except that the
View Full Code Here


      // if no DiscreteEstimator is present in the map, create one
      if (df == null) {
  df = new DiscreteEstimator(instances.numClasses(), 0);
      }
      df.addValue(instance.classValue(),instance.weight()); // update
      distributions.put(c,df); // put back in map
    }


    // build the map of cumulative distribution functions
View Full Code Here

    DiscreteEstimator de = new DiscreteEstimator(numValues, false);
    Iterator it = new EnumerationIterator(instances.enumerateInstances());
    while (it.hasNext()) {
      Instance instance = (Instance) it.next();
      if (!instance.isMissing(attributeIndex)) {
  de.addValue(instance.value(attributeIndex), instance.weight());
      }
    }
    return de;
  }
View Full Code Here

  current = Integer.parseInt(argv[i]);

  System.out.println(newEst);
  System.out.println("Prediction for " + current + " = "
         + newEst.getProbability(current));
  newEst.addValue(current, 1);
      }
    } catch (Exception e) {
      System.out.println(e.getMessage());
    }
  }    // main
View Full Code Here

  current = Integer.parseInt(argv[i]);

  System.out.println(newEst);
  System.out.println("Prediction for " + current + " = "
         + newEst.getProbability(current));
  newEst.addValue(current, 1);
      }
    } catch (Exception e) {
      System.out.println(e.getMessage());
    }
  }    // main
View Full Code Here

      // if no DiscreteEstimator is present in the map, create one
      if (df == null) {
  df = new DiscreteEstimator(instances.numClasses(),0);
      }
      df.addValue(instance.classValue(),instance.weight()); // update
      m_estimatedDistributions.put(c,df); // put back in map
    }


    // build the map of cumulative distribution functions
View Full Code Here

    // Remove instance temporarily from the Maps with the distributions
    DiscreteEstimator df =
      (DiscreteEstimator) m_estimatedDistributions.get(c);

    // remove from df
    df.addValue(instance.classValue(),-instance.weight());

    if (Math.abs(df.getSumOfCounts() - 0) < Utils.SMALL) {

      /* There was apparently only one example with coordinates c
       * in the training set, and now we removed it.
View Full Code Here

    // If no DiscreteEstimator is present in the map, create one
    if (df == null) {
      df = new DiscreteEstimator(instance.dataset().numClasses(),0);
    }
    df.addValue(instance.classValue(),instance.weight()); // update df
    m_estimatedDistributions.put(c,df); // put back in map
    m_estimatedCumulativeDistributions.put
    (c, new CumulativeDiscreteDistribution(df));
  }
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.