source: src/main/java/weka/attributeSelection/HoldOutSubsetEvaluator.java @ 27

Last change on this file since 27 was 4, checked in by gnappo, 14 years ago

Import di weka.

File size: 2.6 KB
Line 
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 *    HoldOutSubsetEvaluator.java
19 *    Copyright (C) 2000 University of Waikato, Hamilton, New Zealand
20 *
21 */
22
23package weka.attributeSelection;
24
25import weka.core.Instance;
26import weka.core.Instances;
27
28import java.util.BitSet;
29
30/**
31 * Abstract attribute subset evaluator capable of evaluating subsets with
32 * respect to a data set that is distinct from that used to initialize/
33 * train the subset evaluator.
34 *
35 * @author Mark Hall (mhall@cs.waikato.ac.nz)
36 * @version $Revision: 1.7 $
37 */
38public abstract class HoldOutSubsetEvaluator 
39  extends ASEvaluation
40  implements SubsetEvaluator {
41
42  /** for serialization */
43  private static final long serialVersionUID = 8280529785412054174L;
44 
45  /**
46   * Evaluates a subset of attributes with respect to a set of instances.
47   * @param subset a bitset representing the attribute subset to be
48   * evaluated
49   * @param holdOut a set of instances (possibly seperate and distinct
50   * from those use to build/train the evaluator) with which to
51   * evaluate the merit of the subset
52   * @return the "merit" of the subset on the holdOut data
53   * @exception Exception if the subset cannot be evaluated
54   */
55  public abstract double evaluateSubset(BitSet subset, Instances holdOut)
56    throws Exception;
57
58  /**
59   * Evaluates a subset of attributes with respect to a single instance.
60   * @param subset a bitset representing the attribute subset to be
61   * evaluated
62   * @param holdOut a single instance (possibly not one of those used to
63   * build/train the evaluator) with which to evaluate the merit of the subset
64   * @param retrain true if the classifier should be retrained with respect
65   * to the new subset before testing on the holdOut instance.
66   * @return the "merit" of the subset on the holdOut instance
67   * @exception Exception if the subset cannot be evaluated
68   */
69  public abstract double evaluateSubset(BitSet subset, 
70                                        Instance holdOut,
71                                        boolean retrain)
72    throws Exception;
73}
Note: See TracBrowser for help on using the repository browser.