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::unordered_set<int> to_remove;
46 for (
size_t i = 0; i < batch->points.size(); ++i) {
virtual void Process(std::unique_ptr< PointsBatch > points_batch)=0
const double sampling_ratio_
void RemovePoints(std::unordered_set< int > to_remove, PointsBatch *batch)
PointsProcessor *const next_
FlushResult Flush() override
void Process(std::unique_ptr< PointsBatch > batch) override
double GetDouble(const std::string &key)
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)