RankedOutputSearch.java
Upload User: rhdiban
Upload Date: 2013-08-09
Package Size: 15085k
Code Size: 4k
Category:

Windows Develop

Development Platform:

Java

  1. /*
  2.  *    This program is free software; you can redistribute it and/or modify
  3.  *    it under the terms of the GNU General Public License as published by
  4.  *    the Free Software Foundation; either version 2 of the License, or
  5.  *    (at your option) any later version.
  6.  *
  7.  *    This program is distributed in the hope that it will be useful,
  8.  *    but WITHOUT ANY WARRANTY; without even the implied warranty of
  9.  *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  10.  *    GNU General Public License for more details.
  11.  *
  12.  *    You should have received a copy of the GNU General Public License
  13.  *    along with this program; if not, write to the Free Software
  14.  *    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  15.  */
  16. /*
  17.  *    RankedOutputSearch.java
  18.  *    Copyright (C) 1999 Mark Hall
  19.  *
  20.  */
  21. package weka.attributeSelection;
  22. import java.io.*;
  23. import weka.core.*;
  24. /** 
  25.  * Interface for search methods capable of producing a
  26.  * ranked list of attributes.
  27.  *
  28.  * @author Mark Hall (mhall@cs.waikato.ac.nz)
  29.  * @version $Revision: 1.9 $
  30.  */
  31. public interface RankedOutputSearch {
  32.   // ===============
  33.   // Public methods.
  34.   // ===============
  35.   
  36.   /**
  37.    * Returns a X by 2 list of attribute indexes and corresponding
  38.    * evaluations from best (highest) to worst.
  39.    * @return the ranked list of attribute indexes in an array of ints
  40.    * @exception Exception if the ranking can't be produced
  41.    */
  42.   double[][] rankedAttributes() throws Exception;
  43.   /**
  44.    * Sets a threshold by which attributes can be discarded from the
  45.    * ranking. This threshold is used by the AttributeSelection module
  46.    * which does the actual discarding of attributes---the implementer
  47.    * of this method needs only to provide a variable in which to store the
  48.    * supplied threshold. -Double.MAX_VALUE is reserved to mean no threshold,
  49.    * ie, retain all attributes.
  50.    * @param threshold the threshold.
  51.    */
  52.   void setThreshold(double threshold);
  53.   /**
  54.    * Gets the threshold by which attributes can be discarded. Discarding
  55.    * of attributes is done by the AttributeSelection module using the
  56.    * threshold returned by this method.
  57.    * @return a threshold by which to discard attributes
  58.    */
  59.   double getThreshold();
  60.   /**
  61.    * Specify the number of attributes to select from the ranked list. < 0
  62.    * indicates that all attributes are to be retained. NumToSelect has
  63.    * precedence over threshold, ie. if there is a non -1 value for NumToSelect
  64.    * then this will take precedence over any threshold value.
  65.    * @param numToSelect the number of attributes to retain
  66.    */
  67.   void setNumToSelect(int numToSelect);
  68.   /**
  69.    * Gets the user specified number of attributes to be retained.
  70.    * @return the number of attributes to retain
  71.    */
  72.   int getNumToSelect();
  73.   /**
  74.    * Gets the calculated number of attributes to retain. This is the
  75.    * actual number of attributes to retain. This is the same as
  76.    * getNumToSelect if the user specifies a number which is not less
  77.    * than zero. Otherwise it should be the number of attributes in the
  78.    * (potentially transformed) data.
  79.    */
  80.   int getCalculatedNumToSelect();
  81.   
  82.   /**
  83.    * Sets whether or not ranking is to be performed.
  84.    * When a search method is capable of producing a ranked list
  85.    * of attributes, the user has the choice of seeing the results of a
  86.    * normal search or seeing a ranked list.
  87.    * @param doRanking true if ranked list is to be produced
  88.    */
  89.   void setGenerateRanking(boolean doRanking);
  90.   /**
  91.    * Gets whether the user has opted to see a ranked list of
  92.    * attributes rather than the normal result of the search
  93.    * @return true if a ranked list has been requested.
  94.    */
  95.   boolean getGenerateRanking();
  96. }