35 #ifndef SHARK_MODELS_ONEVERSUSONE_H 36 #define SHARK_MODELS_ONEVERSUSONE_H 61 template <
class InputType,
class VectorType = RealVector>
78 {
return "OneVersusOneClassifier"; }
86 for (std::size_t i=0; i<
m_binary.size(); i++){
87 std::size_t n =
m_binary[i]->numberOfParameters();
88 noalias(subrange(ret, used, used + n)) =
m_binary[i]->parameterVector();
98 for (std::size_t i=0; i<
m_binary.size(); i++){
99 std::size_t n =
m_binary[i]->numberOfParameters();
100 m_binary[i]->setParameterVector(subrange(newParameters, used, used + n));
108 for (std::size_t i=0; i<
m_binary.size(); i++)
132 binary_classifier_type
const&
binary(
unsigned int class_one,
unsigned int class_zero)
const{
135 unsigned int index = class_one * (class_zero - 1) / 2 + class_zero;
147 void addClass(std::vector<binary_classifier_type*>
const& binmodels)
155 return boost::shared_ptr<State>(
new EmptyState());
162 BatchInputType
const & patterns, BatchOutputType& output,
State& state
164 std::size_t numPatterns =
batchSize(patterns);
165 output.resize(numPatterns);
174 UIntVector bin(numPatterns);
176 for (
unsigned int i=0, c=0; c<
m_classes; c++)
178 for (std::size_t e=0; e<c; e++, i++)
181 for(std::size_t p = 0; p != numPatterns; ++p){
191 for(std::size_t p = 0; p != numPatterns; ++p){
192 for (
unsigned int c=1; c <
m_classes; c++){
193 if (votes(p,c) > votes(p,output(p)))