source: src/main/java/weka/gui/beans/BatchClustererEvent.java @ 5

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

Import di weka.

File size: 3.5 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 *    BatchClustererEvent.java
19 *    Copyright (C) 2004 University of Waikato, Hamilton, New Zealand
20 *
21 */
22
23package weka.gui.beans;
24
25import weka.clusterers.Clusterer;
26
27import java.util.EventObject;
28
29/**
30 * Class encapsulating a built clusterer and a batch of instances to
31 * test on.
32 *
33 * @author <a href="mailto:mutter@cs.waikato.ac.nz">Stefan Mutter</a>
34 * @version $Revision: 1.4 $
35 * @since 1.0
36 * @see EventObject
37 */
38public class BatchClustererEvent
39  extends EventObject {
40
41  /** for serialization */
42  private static final long serialVersionUID = 7268777944939129714L;
43
44  /**
45   * The clusterer
46   */
47  protected Clusterer m_clusterer;
48  //  protected Instances m_trainingSet;
49
50  /**
51   * Training or Test Instances
52   */
53  //  protected Instances m_testSet;
54  protected DataSetEvent m_testSet;
55
56  /**
57   * The set number for the test set
58   */
59  protected int m_setNumber;
60
61  /**
62   * Indicates if m_testSet is a training or a test set. 0 for test, >0 for training
63   */
64  protected int m_testOrTrain;
65
66  /**
67   * The last set number for this series
68   */
69  protected int m_maxSetNumber;
70 
71  public static int TEST = 0;
72  public static int TRAINING = 1;
73
74  /**
75   * Creates a new <code>BatchClustererEvent</code> instance.
76   *
77   * @param source the source object
78   * @param scheme a Clusterer
79   * @param tstI the training/test instances
80   * @param setNum the set number of the training/testinstances
81   * @param maxSetNum the last set number in the series
82   * @param testOrTrain 0 if the set is a test set, >0 if it is a training set
83   */
84  public BatchClustererEvent(Object source, Clusterer scheme, DataSetEvent tstI, int setNum, int maxSetNum, int testOrTrain) {
85    super(source);
86    //    m_trainingSet = trnI;
87    m_clusterer = scheme;
88    m_testSet = tstI;
89    m_setNumber = setNum;
90    m_maxSetNumber = maxSetNum;
91    if(testOrTrain == 0)
92        m_testOrTrain = TEST;
93    else
94        m_testOrTrain = TRAINING;
95  }
96
97
98  /**
99   * Get the clusterer
100   *
101   * @return the clusterer
102   */
103  public Clusterer getClusterer() {
104    return m_clusterer;
105  }
106
107  /**
108   * Get the training/test set
109   *
110   * @return the training/testing instances
111   */
112  public DataSetEvent getTestSet() {
113    return m_testSet;
114  }
115
116  /**
117   * Get the set number (ie which fold this is)
118   *
119   * @return the set number for the training and testing data sets
120   * encapsulated in this event
121   */
122  public int getSetNumber() {
123    return m_setNumber;
124  }
125
126  /**
127   * Get the maximum set number (ie the total number of training
128   * and testing sets in the series).
129   *
130   * @return the maximum set number
131   */
132  public int getMaxSetNumber() {
133    return m_maxSetNumber;
134  }
135 
136  /**
137   * Get whether the set of instances is a test or a training set
138   *
139   * @return 0 for test set, >0 fro training set
140   */
141  public int getTestOrTrain(){
142    return m_testOrTrain;
143  }
144}
145
Note: See TracBrowser for help on using the repository browser.