Package weka.filters.unsupervised.attribute

Examples of weka.filters.unsupervised.attribute.MakeIndicator


      }
      numClassifiers = code.size();
      m_Classifiers = AbstractClassifier.makeCopies(m_Classifier, numClassifiers);
      m_ClassFilters = new MakeIndicator[numClassifiers];
      for (int i = 0; i < m_Classifiers.length; i++) {
  m_ClassFilters[i] = new MakeIndicator();
  MakeIndicator classFilter = (MakeIndicator) m_ClassFilters[i];
  classFilter.setAttributeIndex("" + (insts.classIndex() + 1));
  classFilter.setValueIndices(code.getIndices(i));
  classFilter.setNumeric(false);
  classFilter.setInputFormat(insts);
  newInsts = Filter.useFilter(insts, m_ClassFilters[i]);
  m_Classifiers[i].buildClassifier(newInsts);
      }
    }
    m_ClassAttribute = insts.classAttribute();
View Full Code Here


    int numAttrLeft = data.numAttributes()-1;
    // Ranked attribute indices for this class, one vs.all (highest->lowest)
    int[] attRanks = new int[numAttrLeft];

    try {
      MakeIndicator filter = new MakeIndicator();
      filter.setAttributeIndex("" + (data.classIndex() + 1));
      filter.setNumeric(false);
      filter.setValueIndex(classInd);
      filter.setInputFormat(data);
      Instances trainCopy = Filter.useFilter(data, filter);
      double pctToElim = ((double) m_percentToEliminate) / 100.0;
      while (numAttrLeft > 0) {
        int numToElim;
        if (pctToElim > 0) {
View Full Code Here

    } else {
      m_Classifiers = Classifier.makeCopies(m_Classifier, numClassifiers);
      m_ClassFilters = new MakeIndicator[numClassifiers];

      for (int i = 0; i < m_Classifiers.length; i++) {
  m_ClassFilters[i] = new MakeIndicator();
  m_ClassFilters[i].setAttributeIndex("" + (insts.classIndex() + 1));
  m_ClassFilters[i].setValueIndices(""+(i+2)+"-last");
  m_ClassFilters[i].setNumeric(false);
  m_ClassFilters[i].setInputFormat(insts);
  newInsts = Filter.useFilter(insts, m_ClassFilters[i]);
View Full Code Here

      }
      numClassifiers = code.size();
      m_Classifiers = Classifier.makeCopies(m_Classifier, numClassifiers);
      m_ClassFilters = new MakeIndicator[numClassifiers];
      for (int i = 0; i < m_Classifiers.length; i++) {
  m_ClassFilters[i] = new MakeIndicator();
  MakeIndicator classFilter = (MakeIndicator) m_ClassFilters[i];
  classFilter.setAttributeIndex("" + (insts.classIndex() + 1));
  classFilter.setValueIndices(code.getIndices(i));
  classFilter.setNumeric(false);
  classFilter.setInputFormat(insts);
  newInsts = Filter.useFilter(insts, m_ClassFilters[i]);
  m_Classifiers[i].buildClassifier(newInsts);
      }
    }
    m_ClassAttribute = insts.classAttribute();
View Full Code Here

    insts.deleteWithMissingClass();
   
    m_Classifiers = Classifier.makeCopies(m_Classifier, insts.numClasses());
    m_ClassFilters = new MakeIndicator[insts.numClasses()];
    for (int i = 0; i < insts.numClasses(); i++) {
      m_ClassFilters[i] = new MakeIndicator();
      m_ClassFilters[i].setAttributeIndex("" + (insts.classIndex() + 1));
      m_ClassFilters[i].setValueIndex(i);
      m_ClassFilters[i].setNumeric(true);
      m_ClassFilters[i].setInputFormat(insts);
      newInsts = Filter.useFilter(insts, m_ClassFilters[i]);
View Full Code Here

    Range secondRange = new Range(Range.indicesToRangeList(secondInds));
    secondRange.setUpper(data.numClasses() - 1);
      
    // Change the class labels and build the classifier
    MakeIndicator filter = new MakeIndicator();
    filter.setAttributeIndex("" + (data.classIndex() + 1));
    filter.setValueIndices(m_Range.getRanges());
    filter.setNumeric(false);
    filter.setInputFormat(data);
    m_FilteredClassifier = new FilteredClassifier();
    if (data.numInstances() > 0) {
      m_FilteredClassifier.setClassifier(Classifier.makeCopies(classifier, 1)[0]);
    } else {
      m_FilteredClassifier.setClassifier(new weka.classifiers.rules.ZeroR());
View Full Code Here

    Range secondRange = new Range(Range.indicesToRangeList(secondInds));
    secondRange.setUpper(data.numClasses() - 1);
      
    // Change the class labels and build the classifier
    MakeIndicator filter = new MakeIndicator();
    filter.setAttributeIndex("" + (data.classIndex() + 1));
    filter.setValueIndices(m_Range.getRanges());
    filter.setNumeric(false);
    filter.setInputFormat(data);
    m_FilteredClassifier = new FilteredClassifier();
    if (data.numInstances() > 0) {
      m_FilteredClassifier.setClassifier(Classifier.makeCopies(classifier, 1)[0]);
    } else {
      m_FilteredClassifier.setClassifier(new weka.classifiers.rules.ZeroR());
View Full Code Here

    // Are we at a leaf node ?
    if (node.m_left != null) {
     
      // Create classifier
      MakeIndicator filter = new MakeIndicator();
      filter.setAttributeIndex("" + (data.classIndex() + 1));
      filter.setValueIndices(node.m_right.getString());
      filter.setNumeric(false);
      filter.setInputFormat(data);
      FilteredClassifier classifier = new FilteredClassifier();
      if (data.numInstances() > 0) {
  classifier.setClassifier(Classifier.makeCopies(m_Classifier, 1)[0]);
      } else {
  classifier.setClassifier(new ZeroR());
View Full Code Here

      }
      numClassifiers = code.size();
      m_Classifiers = AbstractClassifier.makeCopies(m_Classifier, numClassifiers);
      m_ClassFilters = new MakeIndicator[numClassifiers];
      for (int i = 0; i < m_Classifiers.length; i++) {
  m_ClassFilters[i] = new MakeIndicator();
  MakeIndicator classFilter = (MakeIndicator) m_ClassFilters[i];
  classFilter.setAttributeIndex("" + (insts.classIndex() + 1));
  classFilter.setValueIndices(code.getIndices(i));
  classFilter.setNumeric(false);
  classFilter.setInputFormat(insts);
  newInsts = Filter.useFilter(insts, m_ClassFilters[i]);
  m_Classifiers[i].buildClassifier(newInsts);
      }
    }
    m_ClassAttribute = insts.classAttribute();
View Full Code Here

    insts.deleteWithMissingClass();
   
    m_Classifiers = AbstractClassifier.makeCopies(m_Classifier, insts.numClasses());
    m_ClassFilters = new MakeIndicator[insts.numClasses()];
    for (int i = 0; i < insts.numClasses(); i++) {
      m_ClassFilters[i] = new MakeIndicator();
      m_ClassFilters[i].setAttributeIndex("" + (insts.classIndex() + 1));
      m_ClassFilters[i].setValueIndex(i);
      m_ClassFilters[i].setNumeric(true);
      m_ClassFilters[i].setInputFormat(insts);
      newInsts = Filter.useFilter(insts, m_ClassFilters[i]);
View Full Code Here

TOP

Related Classes of weka.filters.unsupervised.attribute.MakeIndicator

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.