HoldOutSubsetEvaluator.java
Upload User: rhdiban
Upload Date: 2013-08-09
Package Size: 15085k
Code Size: 2k
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.  *    HoldOutSubsetEvaluator.java
  18.  *    Copyright (C) 2000 Mark Hall
  19.  *
  20.  */
  21. package weka.attributeSelection;
  22. import java.io.*;
  23. import java.util.*;
  24. import weka.core.*;
  25. /** 
  26.  * Abstract attribute subset evaluator capable of evaluating subsets with
  27.  * respect to a data set that is distinct from that used to initialize/
  28.  * train the subset evaluator.
  29.  *
  30.  * @author Mark Hall (mhall@cs.waikato.ac.nz)
  31.  * @version $Revision: 1.3 $
  32.  */
  33. public abstract class HoldOutSubsetEvaluator extends SubsetEvaluator {
  34.   /**
  35.    * Evaluates a subset of attributes with respect to a set of instances.
  36.    * @param subset a bitset representing the attribute subset to be
  37.    * evaluated
  38.    * @param holdOut a set of instances (possibly seperate and distinct
  39.    * from those use to build/train the evaluator) with which to
  40.    * evaluate the merit of the subset
  41.    * @return the "merit" of the subset on the holdOut data
  42.    * @exception Exception if the subset cannot be evaluated
  43.    */
  44.   public abstract double evaluateSubset(BitSet subset, Instances holdOut)
  45.     throws Exception;
  46.   /**
  47.    * Evaluates a subset of attributes with respect to a single instance.
  48.    * @param subset a bitset representing the attribute subset to be
  49.    * evaluated
  50.    * @param holdOut a single instance (possibly not one of those used to
  51.    * build/train the evaluator) with which to evaluate the merit of the subset
  52.    * @param retrain true if the classifier should be retrained with respect
  53.    * to the new subset before testing on the holdOut instance.
  54.    * @return the "merit" of the subset on the holdOut instance
  55.    * @exception Exception if the subset cannot be evaluated
  56.    */
  57.   public abstract double evaluateSubset(BitSet subset, 
  58. Instance holdOut,
  59. boolean retrain)
  60.     throws Exception;
  61. }