21 #include "glog/logging.h" 26 std::unique_ptr<FixedRatioSamplingPointsProcessor>
30 const double sampling_ratio(dictionary->
GetDouble(
"sampling_ratio"));
31 CHECK_LT(0., sampling_ratio) <<
"Sampling ratio <= 0 makes no sense.";
32 CHECK_LT(sampling_ratio, 1.) <<
"Sampling ratio >= 1 makes no sense.";
33 return common::make_unique<FixedRatioSamplingPointsProcessor>(sampling_ratio,
44 std::unique_ptr<PointsBatch> batch) {
45 std::vector<int> to_remove;
46 for (
size_t i = 0; i < batch->points.size(); ++i) {
48 to_remove.push_back(i);
void RemovePoints(std::vector< int > to_remove, PointsBatch *batch)
virtual void Process(std::unique_ptr< PointsBatch > points_batch)=0
const double sampling_ratio_
PointsProcessor *const next_
double GetDouble(const string &key)
FlushResult Flush() override
void Process(std::unique_ptr< PointsBatch > batch) override
static std::unique_ptr< FixedRatioSamplingPointsProcessor > FromDictionary(common::LuaParameterDictionary *dictionary, PointsProcessor *next)
virtual FlushResult Flush()=0
std::unique_ptr< common::FixedRatioSampler > sampler_
FixedRatioSamplingPointsProcessor(double sampling_ratio, PointsProcessor *next)