# TargetInfo.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 TARGETINFO_H_
    00019 #define TARGETINFO_H_
    00020
    00021 #include <valarray>
    00022 #include <vector>
    00023
    00024 class TargetInfo {
    00025     std::valarray<double> _targets;
    00026     std::valarray<double> _weights;
    00027     std::valarray<bool>   _training_mask;
    00028
    00029     // some stuff for ols
    00030     std::valarray<double> _tcov_part;
    00031     double _tmean;
    00032     double _tvar;
    00033     double _tstd;
    00034     double _tmed;
    00035
    00036     public:
    00037     TargetInfo() {}
    00038
    00039     TargetInfo(const std::valarray<double>& t);
    00040     TargetInfo(const std::valarray<double>& t, const std::valarray<double>& w);
    00041
    00042     TargetInfo(const TargetInfo& org);
    00043     TargetInfo& operator=(const TargetInfo& org);
    00044     ~TargetInfo() {}
    00045
    00046     const std::valarray<double>& targets() const { return _targets; }
    00047     const std::valarray<double>& weights() const { return _weights; }
    00048     const std::valarray<bool>&   mask() const { return _training_mask; }
    00049
    00050     void set_training_mask(const std::valarray<bool>& mask);
    00051
    00052     bool has_weights() const { return _weights.size(); }
    00053     bool has_mask()    const { return _training_mask.size(); }
    00054
    00055     std::vector<int> sort();
    00056
    00057     const std::valarray<double>& tcov_part() const { return _tcov_part; }
    00058     double tmean() const { return _tmean; }
    00059     double tvar()  const { return _tvar; }
    00060     double tstd()  const { return _tstd; }
    00061     double devmedian() const { return _tmed; }
    00062 };
    00063
    00064 #endif
    00065