# ErrorMeasure.h

    00001 /*
    00002  *             Copyright (C) 2005 Maarten Keijzer
    00003  *
    00004  *          This program is free software; you can redistribute it and/or modify
    00005  *          it under the terms of version 2 of the GNU General Public License as
    00006  *          published by the Free Software Foundation.
    00007  *
    00008  *          This program is distributed in the hope that it will be useful,
    00009  *          but WITHOUT ANY WARRANTY; without even the implied warranty of
    00010  *          MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    00011  *          GNU General Public License for more details.
    00012  *
    00013  *          You should have received a copy of the GNU General Public License
    00014  *          along with this program; if not, write to the Free Software
    00015  *          Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
    00016  */
    00017
    00018 #ifndef ERROR_MEASURE_H
    00019 #define ERROR_MEASURE_H
    00020
    00021 #include "Scaling.h"
    00022
    00023 class ErrorMeasureImpl;
    00024 class Sym;
    00025 class Dataset;
    00026
    00027 class ErrorMeasure {
    00028
    00029     ErrorMeasureImpl* pimpl;
    00030
    00031     public :
    00032
    00033         enum measure {
    00034             absolute,
    00035             mean_squared,
    00036             mean_squared_scaled,
    00037         };
    00038
    00039         struct result {
    00040             double  error;
    00041             Scaling scaling;
    00042
    00043             result();
    00044             bool valid() const;
    00045         };
    00046
    00047         ErrorMeasure(const Dataset& data, double train_perc, measure meas = mean_squared);
    00048
    00049         ~ErrorMeasure();
    00050         ErrorMeasure(const ErrorMeasure& that);
    00051         ErrorMeasure& operator=(const ErrorMeasure& that);
    00052
    00053         result calc_error(Sym sym);
    00054
    00055         std::vector<result> calc_error(const std::vector<Sym>& sym);
    00056
    00057         double worst_performance() const;
    00058 };
    00059
    00060 #endif
    00061