MOA 12.03
Real Time Analytics for Data Streams
LearningEvaluation.java
Go to the documentation of this file.
00001 /*
00002  *    LearningEvaluation.java
00003  *    Copyright (C) 2007 University of Waikato, Hamilton, New Zealand
00004  *    @author Richard Kirkby (rkirkby@cs.waikato.ac.nz)
00005  *
00006  *    This program is free software; you can redistribute it and/or modify
00007  *    it under the terms of the GNU General Public License as published by
00008  *    the Free Software Foundation; either version 3 of the License, or
00009  *    (at your option) any later version.
00010  *
00011  *    This program is distributed in the hope that it will be useful,
00012  *    but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014  *    GNU General Public License for more details.
00015  *
00016  *    You should have received a copy of the GNU General Public License
00017  *    along with this program. If not, see <http://www.gnu.org/licenses/>.
00018  *    
00019  */
00020 package moa.evaluation;
00021 
00022 import java.util.Arrays;
00023 import java.util.LinkedList;
00024 import java.util.List;
00025 
00026 import moa.AbstractMOAObject;
00027 import moa.classifiers.Classifier;
00028 import moa.clusterers.Clusterer;
00029 import moa.core.Measurement;
00030 
00037 public class LearningEvaluation extends AbstractMOAObject {
00038 
00039     private static final long serialVersionUID = 1L;
00040 
00041     protected Measurement[] measurements;
00042 
00043     public LearningEvaluation(Measurement[] measurements) {
00044         this.measurements = measurements.clone();
00045     }
00046 
00047     public LearningEvaluation(Measurement[] evaluationMeasurements,
00048             ClassificationPerformanceEvaluator cpe, Classifier model) {
00049         List<Measurement> measurementList = new LinkedList<Measurement>();
00050         measurementList.addAll(Arrays.asList(evaluationMeasurements));
00051         measurementList.addAll(Arrays.asList(cpe.getPerformanceMeasurements()));
00052         measurementList.addAll(Arrays.asList(model.getModelMeasurements()));
00053         this.measurements = measurementList.toArray(new Measurement[measurementList.size()]);
00054     }
00055 
00056     // Must change to Learner model
00057     public LearningEvaluation(Measurement[] evaluationMeasurements,
00058             LearningPerformanceEvaluator cpe, Clusterer model) {
00059         List<Measurement> measurementList = new LinkedList<Measurement>();
00060         measurementList.addAll(Arrays.asList(evaluationMeasurements));
00061         measurementList.addAll(Arrays.asList(cpe.getPerformanceMeasurements()));
00062         measurementList.addAll(Arrays.asList(model.getModelMeasurements()));
00063         this.measurements = measurementList.toArray(new Measurement[measurementList.size()]);
00064     }
00065 
00066     public Measurement[] getMeasurements() {
00067         return this.measurements.clone();
00068     }
00069 
00070     @Override
00071     public void getDescription(StringBuilder sb, int indent) {
00072         Measurement.getMeasurementsDescription(this.measurements, sb, indent);
00073     }
00074 }
 All Classes Namespaces Files Functions Variables Enumerations