[4] | 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 | /* |
---|
| 18 | * RankedOutputSearch.java |
---|
| 19 | * Copyright (C) 1999 University of Waikato, Hamilton, New Zealand |
---|
| 20 | * |
---|
| 21 | */ |
---|
| 22 | |
---|
| 23 | |
---|
| 24 | package weka.attributeSelection; |
---|
| 25 | |
---|
| 26 | |
---|
| 27 | /** |
---|
| 28 | * Interface for search methods capable of producing a |
---|
| 29 | * ranked list of attributes. |
---|
| 30 | * |
---|
| 31 | * @author Mark Hall (mhall@cs.waikato.ac.nz) |
---|
| 32 | * @version $Revision: 1.11 $ |
---|
| 33 | */ |
---|
| 34 | public interface RankedOutputSearch { |
---|
| 35 | |
---|
| 36 | |
---|
| 37 | // =============== |
---|
| 38 | // Public methods. |
---|
| 39 | // =============== |
---|
| 40 | |
---|
| 41 | /** |
---|
| 42 | * Returns a X by 2 list of attribute indexes and corresponding |
---|
| 43 | * evaluations from best (highest) to worst. |
---|
| 44 | * @return the ranked list of attribute indexes in an array of ints |
---|
| 45 | * @exception Exception if the ranking can't be produced |
---|
| 46 | */ |
---|
| 47 | double[][] rankedAttributes() throws Exception; |
---|
| 48 | |
---|
| 49 | /** |
---|
| 50 | * Sets a threshold by which attributes can be discarded from the |
---|
| 51 | * ranking. This threshold is used by the AttributeSelection module |
---|
| 52 | * which does the actual discarding of attributes---the implementer |
---|
| 53 | * of this method needs only to provide a variable in which to store the |
---|
| 54 | * supplied threshold. -Double.MAX_VALUE is reserved to mean no threshold, |
---|
| 55 | * ie, retain all attributes. |
---|
| 56 | * @param threshold the threshold. |
---|
| 57 | */ |
---|
| 58 | void setThreshold(double threshold); |
---|
| 59 | |
---|
| 60 | /** |
---|
| 61 | * Gets the threshold by which attributes can be discarded. Discarding |
---|
| 62 | * of attributes is done by the AttributeSelection module using the |
---|
| 63 | * threshold returned by this method. |
---|
| 64 | * @return a threshold by which to discard attributes |
---|
| 65 | */ |
---|
| 66 | double getThreshold(); |
---|
| 67 | |
---|
| 68 | /** |
---|
| 69 | * Specify the number of attributes to select from the ranked list. < 0 |
---|
| 70 | * indicates that all attributes are to be retained. NumToSelect has |
---|
| 71 | * precedence over threshold, ie. if there is a non -1 value for NumToSelect |
---|
| 72 | * then this will take precedence over any threshold value. |
---|
| 73 | * @param numToSelect the number of attributes to retain |
---|
| 74 | */ |
---|
| 75 | void setNumToSelect(int numToSelect); |
---|
| 76 | |
---|
| 77 | /** |
---|
| 78 | * Gets the user specified number of attributes to be retained. |
---|
| 79 | * @return the number of attributes to retain |
---|
| 80 | */ |
---|
| 81 | int getNumToSelect(); |
---|
| 82 | |
---|
| 83 | /** |
---|
| 84 | * Gets the calculated number of attributes to retain. This is the |
---|
| 85 | * actual number of attributes to retain. This is the same as |
---|
| 86 | * getNumToSelect if the user specifies a number which is not less |
---|
| 87 | * than zero. Otherwise it should be the number of attributes in the |
---|
| 88 | * (potentially transformed) data. |
---|
| 89 | */ |
---|
| 90 | int getCalculatedNumToSelect(); |
---|
| 91 | |
---|
| 92 | /** |
---|
| 93 | * Sets whether or not ranking is to be performed. |
---|
| 94 | * When a search method is capable of producing a ranked list |
---|
| 95 | * of attributes, the user has the choice of seeing the results of a |
---|
| 96 | * normal search or seeing a ranked list. |
---|
| 97 | * @param doRanking true if ranked list is to be produced |
---|
| 98 | */ |
---|
| 99 | void setGenerateRanking(boolean doRanking); |
---|
| 100 | |
---|
| 101 | /** |
---|
| 102 | * Gets whether the user has opted to see a ranked list of |
---|
| 103 | * attributes rather than the normal result of the search |
---|
| 104 | * @return true if a ranked list has been requested. |
---|
| 105 | */ |
---|
| 106 | boolean getGenerateRanking(); |
---|
| 107 | |
---|
| 108 | } |
---|