Package weka.filters

Examples of weka.filters.Filter


    m_FilterEditor.setCapabilitiesFilter(filterClass);
   
    // check capabilities
    m_ApplyFilterBut.setEnabled(true);
    Capabilities currentCapabilitiesFilter = m_FilterEditor.getCapabilitiesFilter();
    Filter currentFilter = (Filter) m_FilterEditor.getValue();
    Capabilities currentFilterCapabilities = null;
    if (currentFilter != null && currentCapabilitiesFilter != null &&
        (currentFilter instanceof CapabilitiesHandler)) {
      currentFilterCapabilities = ((CapabilitiesHandler)currentFilter).getCapabilities();
     
View Full Code Here


    PointDouble      values;
    Instances      data;
    Evaluation      eval;
    PointDouble      result;
    Classifier      classifier;
    Filter      filter;
    int        size;
    boolean      cached;
    boolean      allCached;
    Performance      p1;
    Performance      p2;
    double      x;
    double      y;
   
    performances = new Vector();
   
    log("Determining best pair with " + cv + "-fold CV in Grid:\n" + grid + "\n");
   
    if (m_Traversal == TRAVERSAL_BY_COLUMN)
      size = grid.width();
    else
      size = grid.height();
   
    allCached = true;

    for (i = 0; i < size; i++) {
      if (m_Traversal == TRAVERSAL_BY_COLUMN)
  enm = grid.column(i);
      else
  enm = grid.row(i);
     
      filter = null;
      data   = null;
     
      while (enm.hasMoreElements()) {
  values = enm.nextElement();
 
  // already calculated?
  cached = m_Cache.isCached(cv, values);
  if (cached) {
    performances.add(m_Cache.get(cv, values));
  }
  else {
    allCached = false;
   
    x = evaluate(values.getX(), true);
    y = evaluate(values.getY(), false);
   
    // data pass through filter
    if (filter == null) {
      filter = (Filter) setup(getFilter(), x, y);
      filter.setInputFormat(inst);
      data = Filter.useFilter(inst, filter);
      // make sure that the numbers don't get too small - otherwise NaNs!
      Filter cleaner = new NumericCleaner();
      cleaner.setInputFormat(data);
      data = Filter.useFilter(data, cleaner);
    }

    // setup classifier
    classifier = (Classifier) setup(getClassifier(), x, y);
View Full Code Here

   *
   * @return     the filter string.
   */
  protected String getFilterSpec() {
    String  result;
    Filter   filter;
   
    filter = getFilter();
    result = filter.getClass().getName();
   
    if (filter instanceof OptionHandler)
      result += " " + Utils.joinOptions(((OptionHandler) filter).getOptions());
   
    return result;
View Full Code Here

   * Get the filter + options as a string
   *
   * @return a String containing the name of the filter + any options
   */
  protected String getFilterSpec() {
    Filter c = getFilter();
    if (c instanceof OptionHandler) {
      return c.getClass().getName() + " "
  + Utils.joinOptions(((OptionHandler)c).getOptions());
    }
    return c.getClass().getName();
  }
View Full Code Here

   *
   * @return the filter string.
   */
  protected String getFilterSpec() {
   
    Filter c = getFilter();
    if (c instanceof OptionHandler) {
      return c.getClass().getName() + " "
  + Utils.joinOptions(((OptionHandler)c).getOptions());
    }
    return c.getClass().getName();
  }
View Full Code Here

      m_filterEditor.setValue(new weka.filters.unsupervised.attribute.Add());
      m_filterEditor.addPropertyChangeListener(new PropertyChangeListener() {
    public void propertyChange(PropertyChangeEvent e) {
      repaint();
      if (m_filter != null) {
        Filter editedF = (Filter)m_filterEditor.getValue();
        m_filter.setFilter(editedF);
        // should pass on the property change to any other interested
        // listeners
      }
    }
View Full Code Here

   *
   * @return     the filter string.
   */
  protected String getFilterSpec() {
    String  result;
    Filter   filter;
   
    filter = getFilter();
    result = filter.getClass().getName();
   
    if (filter instanceof OptionHandler)
      result += " " + Utils.joinOptions(((OptionHandler) filter).getOptions());
   
    return result;
View Full Code Here

    double[] instanceStats = new double[cc];
    Instances testRaw = null;
    boolean hasClass = (test.classIndex() >= 0);
    int unclusteredInstances = 0;
    Vector<Double> clusterAssignments = new Vector<Double>();
    Filter filter = null;
    DataSource source = null;
    Instance inst;

    if (testFileName == null)
      testFileName = "";
   
    // load data
    if (testFileName.length() != 0)
      source = new DataSource(testFileName);
    else
      source = new DataSource(test);
    testRaw = source.getStructure(test.classIndex());
   
    // If class is set then do class based evaluation as well
    if (hasClass) {
      if (testRaw.classAttribute().isNumeric())
  throw new Exception("ClusterEvaluation: Class must be nominal!");

      filter = new Remove();
      ((Remove) filter).setAttributeIndices("" + (testRaw.classIndex() + 1));
      ((Remove) filter).setInvertSelection(false);
      filter.setInputFormat(testRaw);
    }
   
    i = 0;
    while (source.hasMoreElements(testRaw)) {
      // next instance
      inst = source.nextElement(testRaw);
      if (filter != null) {
  filter.input(inst);
  filter.batchFinished();
  inst = filter.output();
      }
     
      cnum = -1;
      try {
  if (m_Clusterer instanceof DensityBasedClusterer) {
View Full Code Here

   * Get the filter + options as a string
   *
   * @return a String containing the name of the filter + any options
   */
  protected String getFilterSpec() {
    Filter c = getFilter();
    if (c instanceof OptionHandler) {
      return c.getClass().getName() + " "
  + Utils.joinOptions(((OptionHandler)c).getOptions());
    }
    return c.getClass().getName();
  }
View Full Code Here

   * the filter and any options to the filter
   *
   * @return     the filter string.
   */
  protected String getFilterSpec() {
    Filter c = getFilter();
   
    if (c instanceof OptionHandler)
      return   c.getClass().getName() + " "
             + Utils.joinOptions(((OptionHandler)c).getOptions());
    else
      return c.getClass().getName();
  }
View Full Code Here

TOP

Related Classes of weka.filters.Filter

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.