Package weka.filters.supervised.attribute

Examples of weka.filters.supervised.attribute.Discretize


    m_numAttribs = m_trainInstances.numAttributes();
    m_numInstances = m_trainInstances.numInstances();
    m_isNumeric = m_trainInstances.attribute(m_classIndex).isNumeric();

    if (!m_isNumeric) {
      m_disTransform = new Discretize();
      m_disTransform.setUseBetterEncoding(true);
      m_disTransform.setInputFormat(m_trainInstances);
      m_trainInstances = Filter.useFilter(m_trainInstances, m_disTransform);
    }
View Full Code Here


    m_trainInstances = data;
    m_classIndex = m_trainInstances.classIndex();
    m_numAttribs = m_trainInstances.numAttributes();
    m_numInstances = m_trainInstances.numInstances();
    Discretize disTransform = new Discretize();
    disTransform.setUseBetterEncoding(true);
    disTransform.setInputFormat(m_trainInstances);
    m_trainInstances = Filter.useFilter(m_trainInstances, disTransform);
    m_numClasses = m_trainInstances.attribute(m_classIndex).numValues();
  }
View Full Code Here

    int classIndex = data.classIndex();
    int numInstances = data.numInstances();
   
    if (!m_Binarize) {
      Discretize disTransform = new Discretize();
      disTransform.setUseBetterEncoding(true);
      disTransform.setInputFormat(data);
      data = Filter.useFilter(data, disTransform);
    } else {
      NumericToBinary binTransform = new NumericToBinary();
      binTransform.setInputFormat(data);
      data = Filter.useFilter(data, binTransform);
View Full Code Here

    int minNumCount = 0;
    for (int i = 0; i < m_complexityIndex; i++) {
      if (trainingSets[i].numInstances() >= 5) {
  minNumCount++;
  // Discretize the sets
  Discretize disc = new Discretize();
  disc.setInputFormat(trainingSets[i]);
  trainingSets[i] = Filter.useFilter(trainingSets[i], disc);

  trainingSets[i].randomize(r);
  trainingSets[i].stratify(5);
  NaiveBayesUpdateable fullModel = new NaiveBayesUpdateable();
View Full Code Here

    int minNumCount = 0;
    for (int i = 0; i < m_complexityIndex; i++) {
      if (trainingSets[i].numInstances() > 5) {
  minNumCount++;
  // Discretize the sets
    Discretize disc = new Discretize();
  disc.setInputFormat(trainingSets[i]);
  trainingSets[i] = Filter.useFilter(trainingSets[i], disc);

  trainingSets[i].randomize(r);
  trainingSets[i].stratify(5);
  NaiveBayesUpdateable fullModel = new NaiveBayesUpdateable();
View Full Code Here

   * @param instances an <code>Instances</code> value
   * @exception Exception if an error occurs
   */
  public final void buildClassifier(Instances instances) throws Exception {
    m_nb = new NaiveBayesUpdateable();
    m_disc = new Discretize();
    m_disc.setInputFormat(instances);
    Instances temp = Filter.useFilter(instances, m_disc);
    m_nb.buildClassifier(temp);
    if (temp.numInstances() >= 5) {
      m_errors = crossValidate(m_nb, temp, new Random(1));
View Full Code Here

      }
    }

    if (bHasNonNominal) {
      System.err.println("Warning: discretizing data set");
      m_DiscretizeFilter = new Discretize();
      m_DiscretizeFilter.setInputFormat(instances);
      instances = Filter.useFilter(instances, m_DiscretizeFilter);
    }

    if (bHasMissingValues) {
View Full Code Here

    int classIndex = data.classIndex();
    int numInstances = data.numInstances();
    Random rnd = new Random(42);

    if (!m_Binarize) {
      Discretize disTransform = new Discretize();
      disTransform.setUseBetterEncoding(true);
      disTransform.setInputFormat(data);
      data = Filter.useFilter(data, disTransform);
    } else {
      NumericToBinary binTransform = new NumericToBinary();
      binTransform.setInputFormat(data);
      data = Filter.useFilter(data, binTransform);
View Full Code Here

    // Build classifier

   
    FilteredClassifier fclass = new FilteredClassifier();   
    fclass.setClassifier(new weka.classifiers.bayes.NaiveBayesSimple());
    fclass.setFilter(new Discretize());
    m_Classifier = fclass;
   
   
    // Uncomment if you want to use a different classifier
    // Caution: Other places in the code will have to be adjusted!!
View Full Code Here

TOP

Related Classes of weka.filters.supervised.attribute.Discretize

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.