35 #ifndef SHARK_MODELS_NEARESTNEIGHBORREGRESSION_H 36 #define SHARK_MODELS_NEARESTNEIGHBORREGRESSION_H 53 template <
class InputType>
82 {
return "NearestNeighborRegression"; }
105 RealVector parameters(1);
113 "[SoftNearestNeighborClassifier::setParameterVector] invalid number of parameters");
125 return boost::shared_ptr<State>(
new EmptyState());
131 void eval(BatchInputType
const& patterns, BatchOutputType& output,
State& state)
const{
132 std::size_t numPatterns =
batchSize(patterns);
135 std::size_t dimension = neighbors[0].value.size();
136 output.resize(numPatterns,dimension);
139 for(std::size_t p = 0; p != numPatterns;++p)
149 if (d < 1e-100) w = 1e100;
155 row(output,p) *= (1.0 / wsum);