Changeset 706


Ignore:
Timestamp:
Dec 19, 2006, 9:59:19 AM (15 years ago)
Author:
Jari Häkkinen
Message:

Addresses #65 and #170.

Location:
trunk/yat
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/yat/classifier/SVM.cc

    r680 r706  
    149149  }
    150150
     151  void SVM::reset(void)
     152  {
     153    trained_=false;
     154    alpha_=utility::vector(target_.size(), 0);
     155  }
     156
    151157  bool SVM::train(void)
    152158  {
  • trunk/yat/classifier/SVM.h

    r692 r706  
    9292    /// @returns mean of vector \f$ C_i \f$
    9393    ///
    94     inline double C(void) const { return 1/C_inverse_; }
     94    inline double C(void) const { return 1.0/C_inverse_; }
    9595
    9696    ///
     
    139139
    140140    ///
    141     /// Function sets \f$ \alpha=0 \f$ and makes SVM untrained.
    142     ///
    143     inline void reset(void)
    144     { trained_=false; alpha_=utility::vector(target_.size(),0); }
     141    /// @brief Function sets \f$ \alpha=0 \f$ and makes SVM untrained.
     142    ///
     143    void reset(void);
    145144
    146145    ///
  • trunk/yat/classifier/SVindex.h

    r680 r706  
    5050
    5151    // @return index_first
    52     inline size_t index_first(void) const
    53     { assert(index_first_<size()); return index_first_; }
     52    inline size_t index_first(void) const { return index_first_; }
    5453
    5554    // @return index_second
    56     inline size_t index_second(void) const
    57     { assert(index_second_<size()); return index_second_; }
     55    inline size_t index_second(void) const { return index_second_; }
    5856
    5957    // synch the object against alpha
     
    8987
    9088    // @return value_first
    91     inline size_t value_first(void) const
    92     { assert(value_first_<size()); return value_first_; }
     89    inline size_t value_first(void) const { return value_first_; }
    9390
    9491    // @return const ref value_second
    95     inline size_t value_second(void) const
    96     { assert(value_first_<size()); return value_second_; }
     92    inline size_t value_second(void) const { return value_second_; }
    9793
    98     inline size_t operator()(size_t i) const {
    99       assert(i<size()); assert(vec_[i]<size()); return vec_[i]; }
     94    inline size_t operator()(size_t i) const { return vec_[i]; }
    10095
    10196  private:
  • trunk/yat/classifier/Target.h

    r680 r706  
    9191
    9292    ///
    93     /// Default binary is set to false for all classes except class 0.
     93    /// @brief Default binary is set to false for all classes except
     94    /// class 0.
    9495    ///
    9596    /// @return binary target for sample @a i
     
    9798    /// @see set_binary
    9899    ///
    99     inline bool binary(const size_t i) const
    100     { assert(i<size()); return binary_[operator()(i)]; }
     100    inline bool binary(const size_t i) const { return binary_[operator()(i)]; }
    101101   
    102102    ///
     
    110110    /// 0 which is set to true.
    111111    ///
    112     inline void set_binary(const size_t i, const bool b)
    113     { assert(i<nof_classes()); binary_[i]=b; }
     112    inline void set_binary(const size_t i, const bool b) { binary_[i]=b; }
    114113
    115114    ///
     
    141140    ///
    142141    inline size_t operator()(const size_t sample) const
    143     { assert(sample<size()); return classes_[sample]; }
     142    { return classes_[sample]; }
    144143   
    145144    ///
  • trunk/yat/microarray/DataSet.h

    r688 r706  
    11#ifndef _theplu_yat_microarray_dataset_
    22#define _theplu_yat_microarray_dataset_
     3
    34// $Id$
    45
     6/*
     7  Copyright (C) The authors contributing to this file.
     8
     9  This file is part of the yat library, http://lev.thep.lu.se/trac/yat
     10
     11  The yat library is free software; you can redistribute it and/or
     12  modify it under the terms of the GNU General Public License as
     13  published by the Free Software Foundation; either version 2 of the
     14  License, or (at your option) any later version.
     15
     16  The yat library is distributed in the hope that it will be useful,
     17  but WITHOUT ANY WARRANTY; without even the implied warranty of
     18  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
     19  General Public License for more details.
     20
     21  You should have received a copy of the GNU General Public License
     22  along with this program; if not, write to the Free Software
     23  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
     24  02111-1307, USA.
     25*/
    526
    627#include "yat/classifier/MatrixLookup.h"
     
    5172
    5273  private:
    53     /// Copy Constructor
     74    ///
     75    /// @brief The copy constructor
     76    ///
    5477    DataSet(const DataSet&);
    5578
    56     /// Assignment operator
     79    ///
     80    /// @brief The assignment operator
     81    ///
    5782    DataSet& operator=(const DataSet&);
    5883
  • trunk/yat/random/random.cc

    r680 r706  
    8585  }
    8686
     87  // --------------------- Discrete distribtuions ---------------------
     88
     89  Discrete::Discrete(void)
     90    : rng_(RNG::instance())
     91  {
     92  }
     93
     94 
     95  Discrete::~Discrete(void)
     96  {
     97  }
     98
    8799
    88100  DiscreteGeneral::DiscreteGeneral(const statistics::Histogram& hist)
     
    103115  }
    104116
     117
     118  Poisson::Poisson(const double m)
     119    : m_(m)
     120  {
     121  }
     122
     123  // --------------------- Continuous distribtuions ---------------------
     124
     125  Continuous::Continuous(void)
     126    : rng_(RNG::instance())
     127  {
     128  }
     129
     130
     131  Continuous::~Continuous(void)
     132  {
     133  }
     134
     135
     136  ContinuousGeneral::ContinuousGeneral(const statistics::Histogram& hist)
     137    : discrete_(DiscreteGeneral(hist)), hist_(hist)
     138  {
     139  }
     140
     141
     142  Exponential::Exponential(const double m)
     143    : m_(m)
     144  {
     145  }
     146
     147
     148  Gaussian::Gaussian(const double s, const double m)
     149    : m_(m), s_(s)
     150  {
     151  }
     152
    105153}}} // of namespace random, yat, and theplu
  • trunk/yat/random/random.h

    r680 r706  
    193193    /// @brief Constructor
    194194    ///
    195     inline Discrete(void) { rng_=RNG::instance(); }
    196 
    197     inline virtual ~Discrete(void) { }
     195    Discrete(void);
     196
     197    ///
     198    /// @brief The destructor
     199    ///
     200    virtual ~Discrete(void);
    198201
    199202    ///
     
    338341    ///
    339342    /// @param m is expectation value
    340     inline Poisson(const double m=1) : m_(m) {}
     343    ///
     344    Poisson(const double m=1);
    341345
    342346    ///
     
    373377    /// @brief Constructor
    374378    ///
    375     inline Continuous(void) { rng_=RNG::instance(); }
    376 
    377     inline virtual ~Continuous(void) { }
     379    Continuous(void);
     380
     381    ///
     382    /// @brief The destructor
     383    ///
     384    virtual ~Continuous(void);
    378385
    379386    ///
     
    434441    /// @param hist is a Histogram defining the probability distribution
    435442    ///
    436     inline ContinuousGeneral(const statistics::Histogram& hist)
    437       : discrete_(DiscreteGeneral(hist)), hist_(hist) {}
    438 
    439     ///
    440     /// @brief Destructor
    441     ///
    442     ~ContinuousGeneral(void);
     443    ContinuousGeneral(const statistics::Histogram& hist);
    443444
    444445    ///
     
    475476    /// @param m is the expectation value of the distribution.
    476477    ///
    477     inline Exponential(const double m=1) : m_(m) {}
     478    inline Exponential(const double m=1);
    478479
    479480    ///
     
    514515    ///
    515516    /// @brief Constructor
     517    ///
    516518    /// @param s is the standard deviation \f$ \sigma \f$ of distribution
    517519    /// @param m is the expectation value \f$ \mu \f$ of the distribution
    518520    ///
    519     inline Gaussian(const double s=1, const double m=0) : m_(m), s_(s) {}
     521    Gaussian(const double s=1, const double m=0);
    520522
    521523    ///
     
    528530    /// @return A random Gaussian number with standard deviation \a s
    529531    /// and expectation value 0.
     532    ///
    530533    /// @note this operator ignores parameters given in Constructor
    531534    ///
     
    536539    /// @return A random Gaussian number with standard deviation \a s
    537540    /// and expectation value \a m.
     541    ///
    538542    /// @note this operator ignores parameters given in Constructor
    539543    ///
Note: See TracChangeset for help on using the changeset viewer.