Changeset 1141


Ignore:
Timestamp:
Feb 25, 2008, 2:22:25 PM (13 years ago)
Author:
Peter
Message:

adding iterator to ROC interface - refs #292

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/yat/statistics/ROC.h

    r1000 r1141  
    2727*/
    2828
     29#include "yat/classifier/Target.h"
     30#include "yat/utility/iterator_traits.h"
     31
    2932#include <algorithm>
    3033#include <map>
     
    3336namespace theplu {
    3437namespace yat {
    35 namespace classifier {
    36   class DataLookup1D;
    37   class DataLookupWeighted1D;
    38   class Target;
    39 }
    40 namespace utility {
    41   class vector;
    42 }
    4338namespace statistics { 
    4439
     
    155150  };
    156151
     152  /**
     153     Add a range [first, last) of values to ROC. The first last-first
     154     elements in Target.binary are used.
     155   */
     156  template<typename ForwardIterator>
     157  void add(ROC& roc,
     158           ForwardIterator first, ForwardIterator last,
     159           const classifier::Target& target)
     160  {
     161    for (size_t i=0; first!=last; ++i, ++first)
     162      roc.add(utility::iterator_traits<ForwardIterator>().data(),
     163              target.binary(i),
     164              utility::iterator_traits<ForwardIterator>().weight());
     165  }
    157166}}} // of namespace statistics, yat, and theplu
    158167
Note: See TracChangeset for help on using the changeset viewer.