Ignore:
Timestamp:
Feb 22, 2006, 4:01:10 PM (17 years ago)
Author:
Peter
Message:

changed internal representation in Target

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/lib/classifier/Target.h

    r514 r520  
    6969
    7070    ///
    71     /// Default binary is set to false for all classes except class 0
     71    /// Default binary is set to false for all classes except class 0.
    7272    ///
    73     /// @return true if class of sample @a i is set to true
     73    /// @return binary target for sample @a i
    7474    ///
    7575    /// @see set_binary
    7676    ///
    7777    inline bool binary(const size_t i) const
    78     { assert(i<size()); return binary_[i]; }
     78    { assert(i<size()); return binary_[operator()(i)]; }
    7979   
    8080    ///
    81     /// Class @a target is set to @a b. Default is binary set to false
    82     /// for each class.
     81    /// Binary target for each sample with class @a i is set to @a
     82    /// b. Default is binary set to false for each class except class
     83    /// 0 which is set to true.
    8384    ///
    84     void set_binary(const size_t target, const bool b);
     85    inline void set_binary(const size_t i, const bool b)
     86    { assert(i<nof_classes()); binary_[i]=b; }
    8587
    8688    ///
     
    102104
    103105  private:
    104     std::vector<short> binary_; // avoid using vector<bool>
     106    // binary target for class i
     107    std::vector<char> binary_; // avoid using vector<bool>
    105108    std::vector<size_t> classes_; // class of sample i
    106109    std::map<std::string,size_t> class_map_; 
Note: See TracChangeset for help on using the changeset viewer.