Changeset 706 for trunk/yat/classifier


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

Addresses #65 and #170.

Location:
trunk/yat/classifier
Files:
4 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    ///
Note: See TracChangeset for help on using the changeset viewer.