- Timestamp:
- Dec 18, 2006, 1:47:44 AM (16 years ago)
- Location:
- trunk/yat
- Files:
-
- 53 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/yat/regression/Linear.cc
r698 r703 32 32 namespace regression { 33 33 34 Linear::Linear(void) 35 : OneDimensional(), alpha_(0), alpha_var_(0), beta_(0), beta_var_(0), 36 mse_(0), m_x_(0) 37 { 38 } 39 40 Linear::~Linear(void) 41 { 42 } 43 34 44 void Linear::fit(const utility::vector& x, const utility::vector& y) 35 45 { … … 55 65 } 56 66 57 58 67 double Linear::standard_error(const double x) const 59 68 { -
trunk/yat/regression/Linear.h
r702 r703 46 46 public: 47 47 /// 48 /// Default Constructor.48 /// @brief The default constructor 49 49 /// 50 inline Linear(void) 51 : OneDimensional(), alpha_(0), alpha_var_(0), beta_(0), beta_var_(0), 52 mse_(0), m_x_(0){} 50 Linear(void); 53 51 54 52 /// 55 /// Destructor53 /// @brief The destructor 56 54 /// 57 inline virtual ~Linear(void) {};55 virtual ~Linear(void); 58 56 59 57 /// -
trunk/yat/regression/LinearWeighted.cc
r702 r703 32 32 namespace regression { 33 33 34 LinearWeighted::LinearWeighted(void) 35 : OneDimensionalWeighted(), alpha_(0), alpha_var_(0), beta_(0), 36 beta_var_(0), m_x_(0), s2_(0) 37 { 38 } 39 40 LinearWeighted::~LinearWeighted(void) 41 { 42 } 43 34 44 void LinearWeighted::fit(const utility::vector& x, 35 45 const utility::vector& y, -
trunk/yat/regression/LinearWeighted.h
r702 r703 46 46 public: 47 47 /// 48 /// Default Constructor.48 /// @brief The default constructor. 49 49 /// 50 inline LinearWeighted(void) 51 : OneDimensionalWeighted(), alpha_(0), alpha_var_(0), beta_(0), 52 beta_var_(0), 53 m_x_(0), s2_(0) {} 50 LinearWeighted(void); 54 51 55 52 /// 56 /// Destructor53 /// @brief The destructor 57 54 /// 58 inline virtual ~LinearWeighted(void) {};55 virtual ~LinearWeighted(void); 59 56 60 57 /// -
trunk/yat/regression/Local.cc
r682 r703 34 34 namespace yat { 35 35 namespace regression { 36 37 Local::Local(OneDimensionalWeighted& r, Kernel& k) 38 : kernel_(&k), regressor_(&r) 39 { 40 } 41 42 Local::~Local(void) 43 { 44 } 36 45 37 46 void Local::fit(const size_t step_size, const size_t nof_points) -
trunk/yat/regression/Local.h
r682 r703 51 51 public: 52 52 /// 53 /// Constructor taking type of \a regressor,53 /// @brief Constructor taking type of \a regressor, 54 54 /// type of \a kernel. 55 55 /// 56 inline Local(OneDimensionalWeighted& r, Kernel& k) 57 : kernel_(&k), regressor_(&r) {} 56 Local(OneDimensionalWeighted& r, Kernel& k); 58 57 59 58 /// 60 /// Destructor59 /// @brief The destructor 61 60 /// 62 virtual ~Local(void) {}; 63 61 virtual ~Local(void); 64 62 65 63 /// -
trunk/yat/regression/MultiDimensional.cc
r682 r703 29 29 namespace yat { 30 30 namespace regression { 31 32 33 MultiDimensional::MultiDimensional(void) 34 : chisquare_(0), work_(NULL) 35 { 36 } 37 38 39 MultiDimensional::~MultiDimensional(void) 40 { 41 if (work_) 42 gsl_multifit_linear_free(work_); 43 } 31 44 32 45 -
trunk/yat/regression/MultiDimensional.h
r682 r703 44 44 /// @brief Default Constructor 45 45 /// 46 inline MultiDimensional(void) : chisquare_(0), work_(NULL) {}46 MultiDimensional(void); 47 47 48 48 /// 49 49 /// @brief Destructor 50 50 /// 51 inline ~MultiDimensional(void) { if (work_) gsl_multifit_linear_free(work_);}51 ~MultiDimensional(void); 52 52 53 53 /// -
trunk/yat/regression/MultiDimensionalWeighted.cc
r682 r703 31 31 namespace yat { 32 32 namespace regression { 33 34 MultiDimensionalWeighted::MultiDimensionalWeighted(void) 35 : chisquare_(0), work_(NULL) 36 { 37 } 38 39 MultiDimensionalWeighted::~MultiDimensionalWeighted(void) 40 { 41 if (work_) 42 gsl_multifit_linear_free(work_); 43 } 33 44 34 45 void MultiDimensionalWeighted::fit(const utility::matrix& x, -
trunk/yat/regression/MultiDimensionalWeighted.h
r682 r703 44 44 /// @brief Default Constructor 45 45 /// 46 inline MultiDimensionalWeighted(void) : chisquare_(0), work_(NULL) {}46 MultiDimensionalWeighted(void); 47 47 48 48 /// 49 49 /// @brief Destructor 50 50 /// 51 inline ~MultiDimensionalWeighted(void) 52 { if (work_) gsl_multifit_linear_free(work_);} 51 ~MultiDimensionalWeighted(void); 53 52 54 53 /// -
trunk/yat/regression/Naive.cc
r702 r703 35 35 namespace regression { 36 36 37 Naive::Naive(void) 38 : OneDimensional(), mse_(0.0) 39 { 40 } 41 42 Naive::~Naive(void) 43 { 44 } 45 37 46 void Naive::fit(const utility::vector& x, const utility::vector& y) 38 47 { -
trunk/yat/regression/Naive.h
r702 r703 47 47 public: 48 48 /// 49 /// Default Constructor.49 /// @brief The default constructor 50 50 /// 51 inline Naive(void) : OneDimensional(), mse_(0.0) {}51 Naive(void); 52 52 53 53 /// 54 /// Copy Constructor. (not implemented)54 /// @brief The destructor 55 55 /// 56 Naive(const Naive&); 57 58 /// 59 /// Destructor 60 /// 61 virtual ~Naive(void) {}; 56 virtual ~Naive(void); 62 57 63 58 /// … … 85 80 86 81 private: 82 /// 83 /// @brief The copy constructor (not implemented). 84 /// 85 Naive(const Naive&); 86 87 87 double mse_; 88 88 }; -
trunk/yat/regression/NaiveWeighted.cc
r702 r703 33 33 namespace regression { 34 34 35 NaiveWeighted::NaiveWeighted(void) 36 : OneDimensionalWeighted() 37 { 38 } 39 40 NaiveWeighted::~NaiveWeighted(void) 41 { 42 } 43 35 44 void NaiveWeighted::fit(const utility::vector& x, 36 45 const utility::vector& y, -
trunk/yat/regression/NaiveWeighted.h
r702 r703 48 48 public: 49 49 /// 50 /// Default Constructor.50 /// @brief The default constructor 51 51 /// 52 inline NaiveWeighted(void) 53 : OneDimensionalWeighted() {} 52 NaiveWeighted(void); 54 53 55 54 /// 56 /// Destructor55 /// @brief The destructor 57 56 /// 58 virtual ~NaiveWeighted(void) {};57 virtual ~NaiveWeighted(void); 59 58 60 59 /** -
trunk/yat/regression/OneDimensional.cc
r682 r703 28 28 namespace regression { 29 29 30 OneDimensional::OneDimensional(void) 31 { 32 } 33 34 OneDimensional::~OneDimensional(void) 35 { 36 } 37 30 38 std::ostream& OneDimensional::print(std::ostream& os, const double min, 31 39 double max, const u_int n) const -
trunk/yat/regression/OneDimensional.h
r702 r703 46 46 public: 47 47 /// 48 /// Default Constructor.48 /// @brief The default constructor 49 49 /// 50 inline OneDimensional(void) {}50 OneDimensional(void); 51 51 52 52 /// 53 /// Destructor53 /// @brief The destructor 54 54 /// 55 virtual ~OneDimensional(void) {};55 virtual ~OneDimensional(void); 56 56 57 57 /** -
trunk/yat/regression/Polynomial.cc
r697 r703 30 30 namespace regression { 31 31 32 Polynomial::Polynomial(size_t power) 33 : OneDimensional(), mse_(0), power_(power) 34 { 35 } 36 37 Polynomial::~Polynomial(void) 38 { 39 } 40 32 41 void Polynomial::fit(const utility::vector& x, const utility::vector& y) 33 42 { -
trunk/yat/regression/Polynomial.h
r702 r703 47 47 /// @param power degree of polynomial, e.g. 1 for a linear model 48 48 /// 49 inline Polynomial(size_t power) 50 : OneDimensional(), mse_(0), power_(power) {} 49 explicit Polynomial(size_t power); 51 50 52 51 /// 53 52 /// @brief Destructor 54 53 /// 55 inline ~Polynomial(void) {};54 ~Polynomial(void); 56 55 57 56 /// -
trunk/yat/regression/PolynomialWeighted.cc
r682 r703 31 31 namespace yat { 32 32 namespace regression { 33 34 PolynomialWeighted::PolynomialWeighted(size_t power) 35 : OneDimensionalWeighted(), mse_(0), power_(power) 36 { 37 } 38 39 PolynomialWeighted::~PolynomialWeighted(void) 40 { 41 } 33 42 34 43 void PolynomialWeighted::fit(const utility::vector& x, -
trunk/yat/regression/PolynomialWeighted.h
r702 r703 45 45 /// @param power degree of polynomial model 46 46 /// 47 inline PolynomialWeighted(size_t power) 48 : OneDimensionalWeighted(), mse_(0), power_(power) {} 47 PolynomialWeighted(size_t power); 49 48 50 49 /// 51 50 /// @brief Destructor 52 51 /// 53 inline ~PolynomialWeighted(void) {};52 ~PolynomialWeighted(void); 54 53 55 54 /// -
trunk/yat/statistics/Averager.cc
r680 r703 43 43 } 44 44 45 void Averager::add(double d, u_long n) 46 { 47 n_ += n; 48 x_ += n*d; 49 xx_ += n*d*d; 50 } 51 52 void Averager::rescale(double a) 53 { 54 x_ *= a; 55 xx_ *= a*a; 56 } 57 58 void Averager::reset(void) 59 { 60 n_=0; 61 x_=xx_=0.0; 62 } 63 64 const Averager& Averager::operator=(const Averager& a) 65 { 66 n_ = a.n_; 67 x_ = a.x_; 68 xx_ = a.xx_; 69 return *this; 70 } 71 45 72 const Averager& Averager::operator+=(const Averager& a) 46 73 { -
trunk/yat/statistics/Averager.h
r680 r703 62 62 /// Adding \a n (default=1) number of data point(s) with value \a d. 63 63 /// 64 inline void add(double d, u_long n=1) { n_+=n; x_+=n*d; xx_+=n*d*d;}64 void add(double d, u_long n=1); 65 65 66 66 /// … … 95 95 96 96 /// 97 /// Rescales the object, \f$ \forall x_i \rightarrow a*x_i \f$, 97 /// @brief Rescales the object 98 /// 99 /// \f$ \forall x_i \rightarrow a*x_i \f$, 98 100 /// \f$ \forall x_i^2 \rightarrow a^2*x_i^2 \f$ 99 101 /// 100 inline void rescale(double a) { x_*=a; xx_*=a*a; }102 inline void rescale(double a); 101 103 102 104 /// … … 107 109 108 110 /// 109 /// The standard deviation is defined as the square root of the110 /// variance.111 /// @brief The standard deviation is defined as the square root of 112 /// the variance. 111 113 /// 112 114 /// @return The standard deviation, root of the variance(). … … 115 117 116 118 /// 117 /// The standard deviation is defined as the square root of the118 /// variance.119 /// @brief The standard deviation is defined as the square root of 120 /// the variance. 119 121 /// 120 122 /// @return Standard deviation around \a m, root of the variance(m). … … 138 140 139 141 /// 142 /// @brief The variance with know mean 143 /// 144 /// The variance is calculated as 140 145 /// \f$ \frac{1}{n}\sum (x_i-m)^2 \f$. 141 146 /// … … 146 151 147 152 /// 153 /// @brief The estimated variance 154 /// 148 155 /// The variance is calculated as \f$ \frac{1}{N}\sum_i 149 156 /// (x_i-m)^2 \f$, where \f$ m \f$ is the mean. 150 157 /// 151 /// @return estimation of variance158 /// @return Estimation of variance 152 159 /// 153 160 inline double variance(void) const … … 166 173 167 174 /// 168 /// Resets everything to zero 169 /// 170 inline void reset(void) { n_=0; x_=xx_=0.0;} 171 172 /// 173 /// The assignment operator 174 /// 175 inline const Averager& operator=(const Averager& a) 176 { n_=a.n_; x_=a.x_; xx_=a.xx_; return *this; } 175 /// @brief Reset everything to zero 176 /// 177 void reset(void); 178 179 /// 180 /// @brief The assignment operator 181 /// 182 const Averager& operator=(const Averager&); 177 183 178 184 /// -
trunk/yat/statistics/AveragerPair.cc
r683 r703 31 31 namespace yat { 32 32 namespace statistics { 33 33 34 AveragerPair::AveragerPair(void) 35 : x_(Averager()), y_(Averager()), xy_(0.0) 36 { 37 } 38 39 AveragerPair::AveragerPair(const AveragerPair& a) 40 : x_(a.x_averager()), y_(a.y_averager()), xy_(a.sum_xy()) 41 { 42 } 43 44 void AveragerPair::add(const double x, const double y, const unsigned long n) 45 { 46 x_.add(x,n); y_.add(y,n); xy_ += n*x*y; 47 } 48 49 void AveragerPair::reset(void) 50 { 51 x_.reset(); y_.reset(); xy_=0.0; 52 } 53 54 const AveragerPair& AveragerPair::operator=(const AveragerPair& a) 55 { 56 x_=a.x_; y_=a.y_; xy_=a.xy_; 57 return *this; 58 } 59 34 60 const AveragerPair& AveragerPair::operator+=(const AveragerPair& a) 35 61 { -
trunk/yat/statistics/AveragerPair.h
r680 r703 45 45 46 46 /// 47 /// Default constructor47 /// @brief The default constructor 48 48 /// 49 inline AveragerPair(void) : x_(Averager()), y_(Averager()), xy_(0.0) {}50 49 AveragerPair(void); 50 51 51 /// 52 52 /// Constructor taking sum of \a x , \a xx , \a y , \a yy , xy and … … 58 58 59 59 /// 60 /// Copy constructor60 /// The copy constructor 61 61 /// 62 inline AveragerPair(const AveragerPair& a) 63 : x_(a.x_averager()), y_(a.y_averager()), xy_(a.sum_xy()) {} 64 62 AveragerPair(const AveragerPair&); 63 65 64 /// 66 65 /// Adding \a n pairs of data points with value \a x and \a y. 67 66 /// 68 inline void add(const double x, const double y, const unsigned long n=1) 69 { x_.add(x,n); y_.add(y,n), xy_ += n*x*y; } 67 void add(const double x, const double y, const unsigned long n=1); 70 68 71 69 /// … … 131 129 132 130 /// 133 /// Resetseverything to zero131 /// @brief Reset everything to zero 134 132 /// 135 inline void reset(void) { x_.reset(); y_.reset(); xy_=0.0; }133 void reset(void); 136 134 137 135 /// … … 156 154 157 155 /// 158 /// The assigment operator156 /// @brief The assigment operator 159 157 /// 160 inline const AveragerPair& operator=(const AveragerPair& a) 161 { x_=a.x_; y_=a.y_; xy_=a.xy_; return *this; } 158 const AveragerPair& operator=(const AveragerPair& a); 162 159 163 160 /// -
trunk/yat/statistics/AveragerPairWeighted.cc
r701 r703 31 31 namespace yat { 32 32 namespace statistics { 33 33 34 35 AveragerPairWeighted::AveragerPairWeighted(void) 36 : wxy_(0), w_(0) 37 { 38 } 39 34 40 35 41 void AveragerPairWeighted::add(const double x, const double y, … … 64 70 } 65 71 72 73 void AveragerPairWeighted::reset(void) 74 { 75 x_.reset(); y_.reset(); wxy_=0; w_=0; 76 } 77 66 78 }}} // of namespace statistics, yat, and theplu -
trunk/yat/statistics/AveragerPairWeighted.h
r683 r703 55 55 public: 56 56 57 AveragerPairWeighted()58 : wxy_(0), w_(0)59 {60 }57 /// 58 /// @brief The default constructor 59 /// 60 AveragerPairWeighted(void); 61 61 62 62 /// … … 122 122 123 123 /// 124 /// reset everything to zero124 /// @brief Reset everything to zero 125 125 /// 126 inline void reset(void) { x_.reset(); y_.reset(); wxy_=0; w_=0; }126 void reset(void); 127 127 128 128 /// -
trunk/yat/statistics/AveragerWeighted.cc
r683 r703 28 28 namespace statistics { 29 29 30 AveragerWeighted AveragerWeighted::operator+=(const AveragerWeighted& a) 30 AveragerWeighted::AveragerWeighted(void) 31 : w_(Averager()), wx_(Averager()), wwx_(0), wxx_(0) 32 { 33 } 34 35 AveragerWeighted::AveragerWeighted(const AveragerWeighted& a) 36 : w_(Averager(a.sum_w(),a.sum_ww(),1)), 37 wx_(Averager(a.sum_wx(),a.sum_wwxx(),1)), 38 wwx_(a.sum_wwx()), 39 wxx_(a.sum_wxx()) 40 { 41 } 42 43 void AveragerWeighted::add(const double d, const double w) 44 { 45 if (!w) 46 return; 47 w_.add(w); wx_.add(w*d); wwx_+=w*w*d; wxx_+=w*d*d; 48 } 49 50 void AveragerWeighted::rescale(double a) 51 { 52 wx_.rescale(a); 53 wwx_*=a; 54 wxx_*=a*a; 55 } 56 57 void AveragerWeighted::reset(void) 58 { 59 wx_.reset(); w_.reset(); wwx_=0; wxx_=0; 60 } 61 62 const AveragerWeighted& AveragerWeighted::operator+=(const AveragerWeighted& a) 31 63 { 32 64 wx_+=a.wx(); w_+=a.w(); wwx_+=a.sum_wwx(); wxx_+=a.sum_wxx(); -
trunk/yat/statistics/AveragerWeighted.h
r699 r703 65 65 66 66 /// 67 /// Default constructor67 /// @brief The default constructor 68 68 /// 69 inline AveragerWeighted(void) 70 : w_(Averager()), wx_(Averager()), wwx_(0), wxx_(0) {} 71 72 /// 73 /// Copy constructor 74 /// 75 inline AveragerWeighted(const AveragerWeighted& a) 76 : w_(Averager(a.sum_w(),a.sum_ww(),1)), 77 wx_(Averager(a.sum_wx(),a.sum_wwxx(),1)), wwx_(a.sum_wwx()), 78 wxx_(a.sum_wxx()) {} 79 80 /// 81 /// adding a data point d, with weight w (default is 1) 82 /// 83 inline void add(const double d,const double w=1) 84 { if(w==0) return; w_.add(w); wx_.add(w*d); wwx_+=w*w*d; wxx_+=w*d*d; } 69 AveragerWeighted(void); 70 71 /// 72 /// @brief The copy constructor 73 /// 74 AveragerWeighted(const AveragerWeighted&); 75 76 /// 77 /// Adding a data point \a d, with weight \a w (default is 1) 78 /// 79 void add(const double d,const double w=1); 85 80 86 81 /// … … 96 91 97 92 /// 98 /// Calculatingthe weighted mean93 /// @brief Calculate the weighted mean 99 94 /// 100 95 /// @return \f$ \frac{\sum w_ix_i}{\sum w_i} \f$ 101 96 /// 102 inline double mean(void) const { return sum_w() ? 103 sum_wx()/sum_w() : 0; } 97 inline double mean(void) const { return sum_w() ? sum_wx()/sum_w() : 0; } 104 98 105 99 /// … … 117 111 118 112 /// 119 /// rescale object, i.e. each data point is rescaled 120 /// \f$ x = a * x \f$ 121 /// 122 inline void rescale(double a) { wx_.rescale(a); wwx_*=a; wxx_*=a*a; } 123 124 /// 125 /// resets everything to zero 126 /// 127 inline void reset(void) { wx_.reset(); w_.reset(); wwx_=0; wxx_=0; } 128 129 /// 130 /// The standard deviation is defined as the square root of the 131 /// variance(). 113 /// @brief Rescale object. 114 /// 115 /// Each data point is rescaled as \f$ x = a * x \f$ 116 /// 117 void rescale(double a); 118 119 /// 120 /// @brief Reset everything to zero. 121 /// 122 void reset(void); 123 124 /// 125 /// @brief The standard deviation is defined as the square root of 126 /// the variance(). 132 127 /// 133 128 /// @return The standard deviation, root of the variance(). … … 136 131 137 132 /// 138 /// Calculates standard deviation of the mean(). Variance from the 133 /// @brief Calculates standard deviation of the mean(). 134 /// 135 /// Variance from the 139 136 /// weights are here neglected. This is true when the weight is 140 137 /// known before the measurement. In case this is not a good … … 219 216 /// operator to add a AveragerWeighted 220 217 /// 221 AveragerWeightedoperator+=(const AveragerWeighted&);218 const AveragerWeighted& operator+=(const AveragerWeighted&); 222 219 223 220 Averager w_; … … 226 223 double wxx_; 227 224 228 inline Averager wx(void) const {return wx_;} 229 inline Averager w(void) const {return w_;} 230 231 225 inline Averager wx(void) const { return wx_; } 226 inline Averager w(void) const { return w_; } 232 227 }; 233 228 -
trunk/yat/statistics/Distance.cc
r683 r703 31 31 namespace statistics{ 32 32 33 double Distance::operator()(const classifier::DataLookup1D& x, 33 Distance::Distance(void) 34 { 35 } 36 37 Distance::~Distance(void) 38 { 39 } 40 41 double Distance::operator()(const classifier::DataLookup1D& x, 34 42 const classifier::DataLookup1D& y) const 35 43 { -
trunk/yat/statistics/Distance.h
r683 r703 44 44 public: 45 45 46 Distance() 47 { 48 } 46 /// 47 /// @brief The default constructor 48 /// 49 Distance(void); 49 50 50 virtual ~Distance() 51 { 52 } 51 /// 52 /// @brief The destructor 53 /// 54 virtual ~Distance(void); 53 55 54 56 /// -
trunk/yat/statistics/Pearson.cc
r683 r703 38 38 Pearson::Pearson(bool b) 39 39 : Score(b), r_(0), nof_samples_(0) 40 { 41 } 42 43 Pearson::~Pearson(void) 40 44 { 41 45 } -
trunk/yat/statistics/Pearson.h
r683 r703 43 43 class Pearson : public Score 44 44 { 45 46 45 public: 47 46 /// 48 /// Default Constructor.47 /// @brief The default constructor. 49 48 /// 50 49 Pearson(bool absolute=true); 51 50 52 51 /// 53 /// Destructor52 /// @brief The destructor. 54 53 /// 55 virtual ~Pearson(void) {};54 virtual ~Pearson(void); 56 55 57 56 -
trunk/yat/statistics/PearsonDistance.cc
r683 r703 31 31 namespace statistics{ 32 32 33 PearsonDistance::PearsonDistance(void) 34 : Distance() 35 { 36 } 37 38 PearsonDistance::~PearsonDistance(void) 39 { 40 } 41 33 42 double PearsonDistance::operator()(const utility::vector& x, 34 43 const utility::vector& y) const -
trunk/yat/statistics/PearsonDistance.h
r683 r703 47 47 public: 48 48 49 PearsonDistance() 50 : Distance() 51 { 52 } 49 PearsonDistance(void); 53 50 54 virtual ~PearsonDistance() 55 { 56 } 57 51 virtual ~PearsonDistance(void); 52 58 53 // Use all operator() from Distance except the ones that are 59 54 // overloaded in this class. … … 68 63 const utility::vector& wx, 69 64 const utility::vector& wy) const; 70 71 private:72 65 }; 73 66 -
trunk/yat/statistics/ROC.cc
r683 r703 39 39 ROC::ROC(bool b) 40 40 : Score(b), area_(0.5), minimum_size_(10), nof_pos_(0) 41 { 42 } 43 44 ROC::~ROC(void) 41 45 { 42 46 } -
trunk/yat/statistics/ROC.h
r683 r703 50 50 public: 51 51 /// 52 /// Default constructor52 /// @brief Default constructor 53 53 /// 54 54 ROC(bool absolute=true); 55 55 56 56 /// 57 /// Destructor57 /// @brief The destructor 58 58 /// 59 virtual ~ROC(void) {};59 virtual ~ROC(void); 60 60 61 61 /// Function taking \a value, \a target (+1 or -1) and vector -
trunk/yat/statistics/SNR.h
r683 r703 54 54 public: 55 55 /// 56 /// Default Constructor.56 /// @brief Default Constructor. 57 57 /// 58 58 SNR(bool absolute=true); -
trunk/yat/statistics/Score.cc
r683 r703 33 33 } 34 34 35 Score::~Score(void) 36 { 37 } 38 39 double Score::score(const classifier::Target& target, 40 const classifier::DataLookup1D& value) 41 { 42 assert(target.size()==value.size()); 43 utility::vector a; 44 classifier::convert(value,a); 45 return score(target,a); 46 } 47 48 double Score::score(const classifier::Target& target, 49 const classifier::DataLookup1D& value, 50 const classifier::DataLookup1D& weight) 51 { 52 utility::vector a; 53 classifier::convert(value,a); 54 utility::vector b; 55 classifier::convert(weight,a); 56 return score(target,a,b); 57 } 58 35 59 }}} // of namespace statistics, yat, and theplu -
trunk/yat/statistics/Score.h
r683 r703 52 52 public: 53 53 /// 54 /// 54 /// @brief Constructor 55 55 /// 56 56 Score(bool absolute=true) ; 57 57 58 58 /// 59 /// 59 /// @brief Destructor 60 60 /// 61 virtual ~Score(void) {};61 virtual ~Score(void); 62 62 63 63 /// 64 /// Function changing mode of Score64 /// @brief Function changing mode of Score 65 65 /// 66 66 inline void absolute(bool absolute) {absolute_=absolute;} … … 87 87 /// @param value vector of the values 88 88 /// 89 inline double 90 score(const classifier::Target& target, 91 const classifier::DataLookup1D& value) 92 { 93 assert(target.size()==value.size()); 94 utility::vector a; 95 classifier::convert(value,a); 96 return score(target,a); 97 } 89 double score(const classifier::Target& target, 90 const classifier::DataLookup1D& value); 98 91 99 92 /// … … 127 120 /// is wanted. 128 121 /// 129 inline double 130 score(const classifier::Target& target, 131 const classifier::DataLookup1D& value, 132 const classifier::DataLookup1D& weight) 133 { 134 utility::vector a; 135 classifier::convert(value,a); 136 utility::vector b; 137 classifier::convert(weight,a); 138 return score(target,a,b); 139 } 122 double score(const classifier::Target& target, 123 const classifier::DataLookup1D& value, 124 const classifier::DataLookup1D& weight); 140 125 141 126 protected: -
trunk/yat/statistics/tScore.h
r683 r703 48 48 public: 49 49 /// 50 /// Default Constructor.50 /// 2brief Default Constructor. 51 51 /// 52 52 tScore(bool absolute=true); -
trunk/yat/statistics/utility.cc
r683 r703 37 37 p+= gsl_ran_hypergeometric_pdf(i, n1, n2, t); 38 38 return p; 39 } 40 41 double kurtosis(const utility::vector& v) 42 { 43 const gsl_vector* gvp=v.gsl_vector_p(); 44 return gsl_stats_kurtosis(gvp->data,gvp->stride,gvp->size); 39 45 } 40 46 … … 82 88 } 83 89 90 double skewness(const utility::vector& v) 91 { 92 const gsl_vector* gvp=v.gsl_vector_p(); 93 return gsl_stats_skew(gvp->data,gvp->stride,gvp->size); 94 } 95 84 96 }}} // of namespace statistics, yat, and theplu -
trunk/yat/statistics/utility.h
r683 r703 40 40 //forward declarations 41 41 template <class T> 42 inlinedouble median(const std::vector<T>& v, const bool sorted=false);42 double median(const std::vector<T>& v, const bool sorted=false); 43 43 44 44 template <class T> … … 61 61 62 62 /// 63 /// Computes the kurtosis of the data in a vector. The kurtosis 64 /// measures how sharply peaked a distribution is, relative to its 65 /// width. The kurtosis is normalized to zero for a gaussian 66 /// distribution. 63 /// @brief Computes the kurtosis of the data in a vector. 67 64 /// 68 inline double kurtosis(const utility::vector& v)69 {70 const gsl_vector* gvp=v.gsl_vector_p();71 return gsl_stats_kurtosis(gvp->data,gvp->stride,gvp->size);72 }65 /// The kurtosis measures how sharply peaked a distribution is, 66 /// relative to its width. The kurtosis is normalized to zero for a 67 /// gaussian distribution. 68 /// 69 double kurtosis(const utility::vector&); 73 70 74 71 … … 173 170 174 171 /// 175 /// Computes the skewness of the data in a vector. The skewness 176 /// measures the asymmetry of the tails of a distribution. 172 /// @brief Computes the skewness of the data in a vector. 177 173 /// 178 inline double skewness(const utility::vector& v) 179 { 180 const gsl_vector* gvp=v.gsl_vector_p(); 181 return gsl_stats_skew(gvp->data,gvp->stride,gvp->size); 182 } 174 /// The skewness measures the asymmetry of the tails of a 175 /// distribution. 176 /// 177 double skewness(const utility::vector&); 183 178 184 179 }}} // of namespace statistics, yat, and theplu -
trunk/yat/utility/CommandLine.h
r687 r703 148 148 149 149 /// 150 /// If more than maximal number of arguments is found during151 /// parsing an error message is displayed followed by exit.150 /// @brief If more than maximal number of arguments is found 151 /// during parsing an error message is displayed followed by exit. 152 152 /// 153 153 /// @return maximal number of arguments allowed. … … 156 156 157 157 /// 158 /// If less than minimal number of arguments is found during159 /// parsing an error message is displayed followed by exit.158 /// @brief If less than minimal number of arguments is found 159 /// during parsing an error message is displayed followed by exit. 160 160 /// 161 161 /// @return minimal number of arguments allowed. … … 181 181 182 182 /// 183 /// The @a description will be included in help display giving a184 /// g eneral explanation what program is doing.183 /// @brief The @a description will be included in help display 184 /// giving a general explanation what program is doing. 185 185 /// 186 186 inline void set_general_description(const std::string& description) -
trunk/yat/utility/PCA.cc
r687 r703 32 32 namespace yat { 33 33 namespace utility { 34 35 36 PCA::PCA(const utility::matrix& A) 37 : A_(A), process_(false), explained_calc_(false) 38 { 39 } 34 40 35 41 -
trunk/yat/utility/PCA.h
r687 r703 47 47 public: 48 48 /** 49 Default constructor (not implemented)50 */51 PCA(void);52 53 /**54 49 Constructor taking the data-matrix as input. No row-centering 55 50 should have been performed and no products. 56 51 */ 57 inline explicit PCA(const utility::matrix& A) 58 : A_(A), process_(false), explained_calc_(false) {} 59 52 explicit PCA(const utility::matrix&); 53 60 54 /** 61 55 Will perform PCA according to the following scheme: \n … … 80 74 @return Eigenvector \a i. 81 75 */ 82 inline utility::vector get_eigenvector( const size_t&i) const76 inline utility::vector get_eigenvector(size_t i) const 83 77 { return utility::vector(eigenvectors_,i); } 84 78 … … 87 81 \f$ C = \frac{1}{N^2}A^TA \f$ 88 82 */ 89 inline double 90 get_eigenvalue(const size_t& i) const { return eigenvalues_[i]; } 83 inline double get_eigenvalue(size_t i) const { return eigenvalues_[i]; } 91 84 92 85 /** -
trunk/yat/utility/SVD.cc
r687 r703 27 27 namespace yat { 28 28 namespace utility { 29 30 31 SVD::SVD(const utility::matrix& Ain) 32 : U_(Ain), V_(Ain.columns(),Ain.columns()), s_(Ain.columns()) 33 { 34 } 35 36 37 SVD::~SVD(void) 38 { 39 } 29 40 30 41 -
trunk/yat/utility/SVD.h
r687 r703 71 71 72 72 /// 73 /// Constructs an SVD object using the matrix A as only input. The73 /// Constructs an SVD object using the matrix Ain as only input. The 74 74 /// input matrix is copied for further use in the object. 75 75 /// 76 inline SVD(const utility::matrix& Ain) 77 : U_(Ain), V_(Ain.columns(),Ain.columns()), s_(Ain.columns()) {} 76 SVD(const utility::matrix& Ain); 78 77 79 inline ~SVD(void) {} 78 /// 79 /// @brief The destructor 80 /// 81 ~SVD(void); 80 82 81 83 /// … … 88 90 89 91 /// 90 /// Access to the s vector.92 /// @brief Access to the s vector. 91 93 /// 92 94 /// @return A copy of the s vector. … … 98 100 99 101 /// 100 /// Solve the system \f$ Ax=b \f$ using the decomposition of A. 102 /// @brief Solve the system \f$ Ax=b \f$ using the decomposition 103 /// of A. 101 104 /// 102 105 /// @note If decompose() has not been run the outcome of the call … … 111 114 112 115 /// 113 /// Access to the U matrix.116 /// @brief Access to the U matrix. 114 117 /// 115 118 /// @return A copy of the U matrix. … … 121 124 122 125 /// 123 /// Access to the V matrix.126 /// @brief Access to the V matrix. 124 127 /// 125 128 /// @return A copy of the V matrix. -
trunk/yat/utility/WeNNI.h
r687 r703 68 68 69 69 70 71 70 private: 72 71 -
trunk/yat/utility/matrix.cc
r680 r703 39 39 namespace utility { 40 40 41 42 matrix::matrix(void) 43 : m_(NULL), view_(NULL) 44 { 45 } 46 47 48 matrix::matrix(const size_t& r, const size_t& c, double init_value) 49 : view_(NULL) 50 { 51 m_ = gsl_matrix_alloc(r,c); 52 set_all(init_value); 53 } 54 55 56 matrix::matrix(const matrix& o) 57 : view_(NULL) 58 { 59 m_ = o.create_gsl_matrix_copy(); 60 } 41 61 42 62 … … 212 232 213 233 234 const matrix& matrix::operator+=(const matrix& m) 235 { 236 add(m); 237 return *this; 238 } 239 240 241 const matrix& matrix::operator+=(const double d) 242 { 243 add_constant(d); 244 return *this; 245 } 246 247 248 const matrix& matrix::operator-=(const matrix& m) 249 { 250 sub(m); 251 return *this; 252 } 253 214 254 215 255 const matrix& matrix::operator*=(const matrix& other) … … 222 262 } 223 263 264 265 const matrix& matrix::operator*=(const double d) 266 { 267 scale(d); 268 return *this; 269 } 224 270 225 271 -
trunk/yat/utility/matrix.h
r687 r703 80 80 structures. 81 81 */ 82 inline matrix(void) : m_(NULL), view_(NULL) {}83 84 /// 85 /// Constructor. Allocatesmemory space for \a r times \a c82 matrix(void); 83 84 /// 85 /// @brief Constructor allocating memory space for \a r times \a c 86 86 /// elements, and sets all elements to \a init_value. 87 87 /// 88 inline matrix(const size_t& r, const size_t& c, double init_value=0) 89 : view_(NULL) { m_ = gsl_matrix_alloc(r,c); set_all(init_value); } 90 91 /// 92 /// The copy constructor. 88 matrix(const size_t& r, const size_t& c, double init_value=0); 89 90 /// 91 /// @brief The copy constructor. 93 92 /// 94 93 /// @note If the object to be copied is a matrix view, the values 95 94 /// of the view will be copied, i.e. the view is not copied. 96 95 /// 97 inline matrix(const matrix& o) : view_(NULL) {m_=o.create_gsl_matrix_copy();}96 matrix(const matrix&); 98 97 99 98 /// … … 134 133 135 134 /// 136 /// The destructor.135 /// @brief The destructor. 137 136 /// 138 137 ~matrix(void); … … 199 198 200 199 /// 201 /// Check if the matrix object is a view (sub-matrix) to another202 /// matrix.200 /// @brief Check if the matrix object is a view (sub-matrix) to 201 /// another matrix. 203 202 /// 204 203 /// @return True if the object is a view, false othwerwise. … … 216 215 /// row-major order). 217 216 /// 218 inlinestd::pair<size_t,size_t> max_index(void) const;217 std::pair<size_t,size_t> max_index(void) const; 219 218 220 219 /// … … 228 227 /// row-major order). 229 228 /// 230 inlinestd::pair<size_t,size_t> min_index(void) const;229 std::pair<size_t,size_t> min_index(void) const; 231 230 232 231 /// … … 308 307 309 308 /// 310 /// Set \a row values to values in \a vec.309 /// @brief Set \a row values to values in \a vec. 311 310 /// 312 311 /// @return Whatever GSL returns. … … 335 334 336 335 /// 337 /// Swap columns \a i and \a j.336 /// @brief Swap columns \a i and \a j. 338 337 /// 339 338 inline int swap_columns(const size_t i,const size_t j) … … 341 340 342 341 /// 343 /// Swap row \a i and column \a j.342 /// @brief Swap row \a i and column \a j. 344 343 /// 345 344 inline int swap_rowcol(const size_t i,const size_t j) … … 347 346 348 347 /// 349 /// Swap rows \a i and \a j.348 /// @brief Swap rows \a i and \a j. 350 349 /// 351 350 inline int swap_rows(const size_t i, const size_t j) … … 353 352 354 353 /// 355 /// Transpose the matrix.354 /// @brief Transpose the matrix. 356 355 /// 357 356 void transpose(void); … … 371 370 372 371 /// 373 /// Matrix-vector multiplication.372 /// @brief Matrix-vector multiplication. 374 373 /// 375 374 /// @return The resulting vector. … … 379 378 380 379 /// 381 /// Comparison operator.380 /// @brief Comparison operator. 382 381 /// 383 382 /// @return True if all elements are equal otherwise False. … … 388 387 389 388 /// 390 /// Comparison operator.389 /// @brief Comparison operator. 391 390 /// 392 391 /// @return False if all elements are equal otherwise True. … … 397 396 398 397 /// 399 /// The assignment operator. There is no requirements on 400 /// dimensions, i.e. the matrix is remapped in memory if 401 /// necessary. This implies that in general views cannot be 402 /// assigned using this operator. Views will be mutated into 403 /// normal matrices. The only exception to this behaviour on views 404 /// is when self-assignemnt is done, since self-assignment is 405 /// ignored. 398 /// @brief The assignment operator. 399 /// 400 /// There is no requirements on dimensions, i.e. the matrix is 401 /// remapped in memory if necessary. This implies that in general 402 /// views cannot be assigned using this operator. Views will be 403 /// mutated into normal matrices. The only exception to this 404 /// behaviour on views is when self-assignemnt is done, since 405 /// self-assignment is ignored. 406 406 /// 407 407 /// @return A const reference to the resulting matrix. … … 412 412 413 413 /// 414 /// Add and assign operator. 415 /// 416 inline const matrix& operator+=(const matrix& m) { add(m); return *this; } 417 418 /// 419 /// Add and assign operator. 420 /// 421 inline const matrix& 422 operator+=(const double d) { add_constant(d); return *this; } 423 424 /// 425 /// Subtract and assign operator. 426 /// 427 inline const matrix& operator-=(const matrix& m) { sub(m); return *this; } 428 429 /// 430 /// Multiply and assigment operator. 414 /// @brief Add and assign operator. 415 /// 416 const matrix& operator+=(const matrix&); 417 418 /// 419 /// @brief Add and assign operator. 420 /// 421 const matrix& operator+=(const double); 422 423 /// 424 /// @brief Subtract and assign operator. 425 /// 426 const matrix& operator-=(const matrix&); 427 428 /// 429 /// @brief Multiply and assigment operator. 431 430 /// 432 431 /// @return Const reference to the resulting matrix. … … 435 434 436 435 /// 437 /// Multiply and assign operator. 438 /// 439 inline const matrix& operator*=(const double d) { scale(d); return *this; } 440 436 /// @brief Multiply and assignment operator 437 /// 438 const matrix& operator*=(const double); 441 439 442 440 private: -
trunk/yat/utility/stl_utility.h
r687 r703 120 120 121 121 /// 122 /// Function converting a string to lower case122 /// @brief Function converting a string to lower case 123 123 /// 124 124 inline void to_lower(std::string& s) { … … 127 127 128 128 /// 129 /// Function converting a string to upper case129 /// @brief Function converting a string to upper case 130 130 /// 131 131 inline void to_upper(std::string& s) { -
trunk/yat/utility/vector.cc
r686 r703 258 258 259 259 260 const vector& vector::operator+=(const vector& other) 261 { 262 gsl_vector_add(v_,other.v_); 263 return *this; 264 } 265 266 267 const vector& vector::operator-=(const vector& other) 268 { 269 gsl_vector_sub(v_,other.v_); 270 return *this; 271 } 272 273 274 const vector& vector::operator*=(const double d) 275 { 276 gsl_vector_scale(v_,d); 277 return *this; 278 } 279 280 260 281 std::ostream& operator<<(std::ostream& s, const vector& a) 261 282 { -
trunk/yat/utility/vector.h
r693 r703 434 434 435 435 /// 436 /// @return The dot product. 437 /// 438 double operator*(const vector&) const; 439 440 /// 436 441 /// Comparison operator. Takes linear time. 437 442 /// … … 457 462 458 463 /// 459 /// @return The dot product.460 ///461 double operator*( const vector &other ) const;462 463 ///464 464 /// Addition and assign operator. 465 465 /// 466 466 /// @return A const reference to the resulting vector. 467 467 /// 468 inline const vector& 469 operator+=(const vector& other) { gsl_vector_add(v_,other.v_); return *this;} 468 const vector& operator+=(const vector&); 470 469 471 470 /// … … 474 473 /// @return A const reference to the resulting vector. 475 474 /// 476 inline const vector& 477 operator-=(const vector& other) { gsl_vector_sub(v_,other.v_); return *this;} 475 const vector& operator-=(const vector&); 478 476 479 477 /// … … 482 480 /// @return A const reference to the resulting vector. 483 481 /// 484 inline const vector& 485 operator*=(const double d) { gsl_vector_scale(v_,d); return *this; } 482 const vector& operator*=(const double); 486 483 487 484
Note: See TracChangeset
for help on using the changeset viewer.