jubatus_core  0.1.2
Jubatus: Online machine learning framework for distributed environment
Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | Friends | List of all members
jubatus::core::burst::basic_window< Batch > Class Template Reference

#include <input_window.hpp>

Inheritance diagram for jubatus::core::burst::basic_window< Batch >:
Inheritance graph
Collaboration diagram for jubatus::core::burst::basic_window< Batch >:
Collaboration graph

Public Types

typedef Batch batch_type
 

Public Member Functions

 basic_window (double batch_interval=1)
 
 basic_window (double start_pos, double batch_interval, int32_t batch_size)
 
bool contains (double pos) const
 
double get_all_interval () const
 
batch_typeget_batch_by_index (size_t i)
 
const batch_typeget_batch_by_index (size_t i) const
 
double get_batch_interval () const
 
int32_t get_batch_size () const
 
const std::vector< batch_type > & get_batches () const
 
double get_end_pos () const
 
int get_index (double pos) const
 
double get_start_pos () const
 
void swap (basic_window &x)
 

Protected Member Functions

int get_index_ (double pos) const
 

Protected Attributes

double batch_interval_
 
std::vector< batch_typebatches_
 
double start_pos_
 

Friends

void swap (basic_window &x, basic_window &y)
 

Detailed Description

template<class Batch>
class jubatus::core::burst::basic_window< Batch >

Definition at line 35 of file input_window.hpp.

Member Typedef Documentation

template<class Batch>
typedef Batch jubatus::core::burst::basic_window< Batch >::batch_type

Definition at line 37 of file input_window.hpp.

Constructor & Destructor Documentation

template<class Batch>
jubatus::core::burst::basic_window< Batch >::basic_window ( double  batch_interval = 1)
inlineexplicit

Definition at line 39 of file input_window.hpp.

40  : batches_(), start_pos_(0), batch_interval_(batch_interval) {
41  if (!(batch_interval > 0)) {
42  throw JUBATUS_EXCEPTION(common::invalid_parameter(
43  "window: batch_interval should be > 0"));
44  }
45  }
std::vector< batch_type > batches_
#define JUBATUS_EXCEPTION(e)
Definition: exception.hpp:79
template<class Batch>
jubatus::core::burst::basic_window< Batch >::basic_window ( double  start_pos,
double  batch_interval,
int32_t  batch_size 
)
inline

Definition at line 47 of file input_window.hpp.

48  : batches_(), start_pos_(start_pos), batch_interval_(batch_interval) {
49  if (!(batch_interval > 0)) {
50  throw JUBATUS_EXCEPTION(common::invalid_parameter(
51  "window: batch_interval should be > 0"));
52  }
53  if (!(batch_size >= 0)) {
54  throw JUBATUS_EXCEPTION(common::invalid_parameter(
55  "window: batch_size should be >= 0"));
56  }
57  batches_.resize(batch_size);
58  }
std::vector< batch_type > batches_
#define JUBATUS_EXCEPTION(e)
Definition: exception.hpp:79

Member Function Documentation

template<class Batch>
bool jubatus::core::burst::basic_window< Batch >::contains ( double  pos) const
inline

Definition at line 80 of file input_window.hpp.

Referenced by jubatus::core::burst::basic_window< batch_result >::get_index().

80  {
81  return get_start_pos() <= pos && pos < get_end_pos();
82  }

Here is the caller graph for this function:

template<class Batch>
double jubatus::core::burst::basic_window< Batch >::get_all_interval ( ) const
inline

Definition at line 83 of file input_window.hpp.

Referenced by jubatus::core::burst::basic_window< batch_result >::get_end_pos().

83  {
85  }

Here is the caller graph for this function:

template<class Batch>
batch_type& jubatus::core::burst::basic_window< Batch >::get_batch_by_index ( size_t  i)
inline

Definition at line 98 of file input_window.hpp.

Referenced by jubatus::core::burst::aggregator::impl_::make_new_window_().

98  {
99  return batches_[i];
100  }
std::vector< batch_type > batches_

Here is the caller graph for this function:

template<class Batch>
const batch_type& jubatus::core::burst::basic_window< Batch >::get_batch_by_index ( size_t  i) const
inline

Definition at line 101 of file input_window.hpp.

101  {
102  return batches_[i];
103  }
std::vector< batch_type > batches_
template<class Batch>
double jubatus::core::burst::basic_window< Batch >::get_batch_interval ( ) const
inline

Definition at line 90 of file input_window.hpp.

Referenced by jubatus::core::burst::basic_window< batch_result >::get_index_().

90  {
91  return batch_interval_;
92  }

Here is the caller graph for this function:

template<class Batch>
int32_t jubatus::core::burst::basic_window< Batch >::get_batch_size ( ) const
inline
template<class Batch>
const std::vector<batch_type>& jubatus::core::burst::basic_window< Batch >::get_batches ( ) const
inline

Definition at line 94 of file input_window.hpp.

Referenced by jubatus::core::burst::burst_result::burst_result(), and jubatus::core::burst::result_window::result_window().

94  {
95  return batches_;
96  }
std::vector< batch_type > batches_

Here is the caller graph for this function:

template<class Batch>
double jubatus::core::burst::basic_window< Batch >::get_end_pos ( ) const
inline

Definition at line 77 of file input_window.hpp.

Referenced by jubatus::core::burst::basic_window< batch_result >::contains().

77  {
78  return start_pos_ + get_all_interval();
79  }

Here is the caller graph for this function:

template<class Batch>
int jubatus::core::burst::basic_window< Batch >::get_index ( double  pos) const
inline

Definition at line 61 of file input_window.hpp.

61  {
62  int n = get_batch_size();
63  int i = get_index_(pos);
64 
65  if (i < 0 || n <= i) {
66  JUBATUS_ASSERT(!contains(pos));
67  return -1;
68  }
69 
71  return i;
72  }
bool contains(double pos) const
#define JUBATUS_ASSERT(expr)
Definition: assert.hpp:55
int get_index_(double pos) const
template<class Batch>
int jubatus::core::burst::basic_window< Batch >::get_index_ ( double  pos) const
inlineprotected

Definition at line 121 of file input_window.hpp.

Referenced by jubatus::core::burst::basic_window< batch_result >::get_index().

121  {
122  return static_cast<int>(
123  std::floor((pos - start_pos_) / get_batch_interval()));
124  }

Here is the caller graph for this function:

template<class Batch>
double jubatus::core::burst::basic_window< Batch >::get_start_pos ( ) const
inline
template<class Batch>
void jubatus::core::burst::basic_window< Batch >::swap ( basic_window< Batch > &  x)
inline

Definition at line 105 of file input_window.hpp.

Referenced by jubatus::core::burst::basic_window< batch_result >::swap().

105  {
106  using std::swap;
107  swap(batches_, x.batches_);
108  swap(start_pos_, x.start_pos_);
109  swap(batch_interval_, x.batch_interval_);
110  }
std::vector< batch_type > batches_
void swap(weighted_point &p1, weighted_point &p2)
Definition: types.hpp:47

Here is the caller graph for this function:

Friends And Related Function Documentation

template<class Batch>
void swap ( basic_window< Batch > &  x,
basic_window< Batch > &  y 
)
friend

Definition at line 111 of file input_window.hpp.

111  {
112  x.swap(y);
113  }

Member Data Documentation

template<class Batch>
double jubatus::core::burst::basic_window< Batch >::batch_interval_
protected
template<class Batch>
std::vector<batch_type> jubatus::core::burst::basic_window< Batch >::batches_
protected
template<class Batch>
double jubatus::core::burst::basic_window< Batch >::start_pos_
protected

The documentation for this class was generated from the following file: