27 using jubatus::util::lang::shared_ptr;
35 int accumulate_d_vec(
const burst_result& r) {
36 const std::vector<batch_result>& batches = r.get_batches();
38 for (
size_t i = 0; i < batches.size(); ++i) {
39 result += batches[i].d;
53 double costcut_threshold,
55 int max_reuse_batches) {
56 const std::vector<batch_input>& input_batches = input.
get_batches();
58 const int max_reuse = (std::min)(max_reuse_batches, static_cast<int>(n));
61 std::vector<uint32_t> d_vec, r_vec;
62 std::vector<double> burst_weights;
65 burst_weights.reserve(n);
66 for (
size_t i = 0; i < n; ++i) {
67 d_vec.push_back(input_batches[i].d);
68 r_vec.push_back(input_batches[i].r);
69 burst_weights.push_back(-1);
77 const std::vector<batch_result>& prev_results = prev.
get_batches();
78 for (
int i = 0, j = intersection.first;
79 i < max_reuse && j < intersection.second;
81 burst_weights[i] = prev_results[j].burst_weight;
88 scaling_param, gamma, costcut_threshold);
99 return p_.get() != NULL;
111 return p_ &&
p_->contains(pos);
115 return p_ ?
p_->get_batch_size() : 0;
118 return p_ ?
p_->get_batch_interval() : 1;
121 return p_ ?
p_->get_all_interval() : 0;
128 double pos0 =
p_->get_start_pos();
139 double pos0 =
p_->get_start_pos();
150 double pos0 =
p_->get_start_pos();
158 double interval_x = x.
p_->get_batch_interval();
169 int i =
p_ ?
p_->get_index(pos) : -1;
171 throw std::out_of_range(
"burst_result: pos is out of range");
173 return p_->get_batches()[i];
177 int i =
p_ ?
p_->get_index(pos) : -1;
181 return p_->get_batches()[i].is_bursted();
188 const std::vector<batch_result>& batches =
p_->get_batches();
189 return !batches.empty() && batches.back().is_bursted();
200 if (accumulate_d_vec(*
this) < accumulate_d_vec(w)) {
219 unpacked->msgpack_unpack(o);
bool mix(const burst_result &w)
bool has_same_start_pos_to(double start_pos) const
int get_batch_size() const
double get_end_pos() const
void msgpack_unpack(msgpack::object o)
bool has_same_batch_interval(const burst_result &x) const
bool contains(double pos) const
bool is_bursted_at(double pos) const
bool has_start_pos_newer_than(double start_pos) const
const std::vector< batch_result > & get_batches() const
std::pair< int, int > get_intersection(const W1 &w1, const W2 &w2)
bool has_batch_interval_equals_to(double interval1) const
void msgpack_pack(framework::packer &packer) const
bool is_bursted_at_latest_batch() const
const std::vector< batch_result > empty_batch_results
msgpack::packer< jubatus_packer > packer
bool has_start_pos_older_than(double start_pos) const
const std::vector< batch_type > & get_batches() const
static const double invalid_pos
bool window_position_near(double pos0, double pos1, double batch_interval)
int32_t get_batch_size() const
double get_all_interval() const
double get_start_pos() const
const batch_result & get_batch_at(double pos) const
jubatus::util::lang::shared_ptr< const result_window > p_
double get_start_pos() const
void burst_detect(const std::vector< uint32_t > &d_vector, const std::vector< uint32_t > &r_vector, std::vector< double > &batch_weights, double scaling_param, double gamma, double burst_cut_threshold)
double get_batch_interval() const