21 #ifndef _BINARY_CLASSIFIER_OPTIMIZER_H
22 #define _BINARY_CLASSIFIER_OPTIMIZER_H
31 template<
class DataType,
class ScalarType>
32 ScalarType Optimize(std::pair<DataType, int> & ret,
const std::pair<DataType, ScalarType> *data,
int n, ScalarType wp, ScalarType wn,
bool strictly_growin)
35 ScalarType sumW = wp + wn;
38 ret.first = data[0].first;
45 for(
int i=0; i<n-1; i++)
51 ret.first = data[i+1].first;
57 ret.first = data[i].first;
65 for(
int i=1; i<n; i++)
67 w += data[i-1].second;
69 if(data[i].first>data[i-1].first)
75 ret.first = data[i].first;
82 ret.first = data[i-1].first;
94 template<
class ScalarType>
95 ScalarType SimpleOptimize(std::pair<int, int> & ret,
const ScalarType *data,
int n, ScalarType wp, ScalarType wn)
98 ScalarType sumW = wp + wn;
106 for(
int i=0; i<n-1; i++)