35 #ifndef SHARK_MODELS_SOFTNEARESTNEIGHBOR_H 36 #define SHARK_MODELS_SOFTNEARESTNEIGHBOR_H 53 template <
class InputType>
94 {
return "SoftNearestNeighborClassifier"; }
117 RealVector parameters(1);
134 return boost::shared_ptr<State>(
new EmptyState());
138 void eval(BatchInputType
const& patterns, BatchOutputType& outputs)
const {
139 std::size_t numPatterns =
batchSize(patterns);
145 for(std::size_t p = 0; p != numPatterns;++p)
155 if (d < 1e-100) w = 1e100;
162 row(outputs, p) *= (1.0 / wsum);
165 void eval(BatchInputType
const& patterns, BatchOutputType& outputs,
State & state)
const{
166 eval(patterns, outputs);