jubatus_core  0.1.2
Jubatus: Online machine learning framework for distributed environment
Public Types | Public Member Functions | Private Attributes | Friends | List of all members
jubatus::core::fv_converter::counter< T > Class Template Reference

#include <counter.hpp>

Inheritance diagram for jubatus::core::fv_converter::counter< T >:
Inheritance graph
Collaboration diagram for jubatus::core::fv_converter::counter< T >:
Collaboration graph

Public Types

typedef jubatus::util::data::unordered_map< T, double >::const_iterator const_iterator
 
typedef jubatus::util::data::unordered_map< T, double >::iterator iterator
 
typedef jubatus::util::data::unordered_map< T, double > map_t
 

Public Member Functions

void add (const counter< T > &counts)
 
const_iterator begin () const
 
iterator begin ()
 
void clear ()
 
bool contains (const T &key) const
 
const_iterator end () const
 
iterator end ()
 
 MSGPACK_DEFINE (data_)
 
double operator[] (const T &key) const
 
double & operator[] (const T &key)
 

Private Attributes

jubatus::util::data::unordered_map< T, double > data_
 

Friends

std::ostream & operator<< (std::ostream &os, const counter< T > &c)
 

Detailed Description

template<class T>
class jubatus::core::fv_converter::counter< T >

Definition at line 31 of file counter.hpp.

Member Typedef Documentation

template<class T>
typedef jubatus::util::data::unordered_map<T, double>::const_iterator jubatus::core::fv_converter::counter< T >::const_iterator

Definition at line 35 of file counter.hpp.

template<class T>
typedef jubatus::util::data::unordered_map<T, double>::iterator jubatus::core::fv_converter::counter< T >::iterator

Definition at line 37 of file counter.hpp.

template<class T>
typedef jubatus::util::data::unordered_map<T, double> jubatus::core::fv_converter::counter< T >::map_t

Definition at line 33 of file counter.hpp.

Member Function Documentation

template<class T>
void jubatus::core::fv_converter::counter< T >::add ( const counter< T > &  counts)
inline

Definition at line 79 of file counter.hpp.

Referenced by jubatus::core::fv_converter::keyword_weights::merge().

79  {
80  for (const_iterator it = counts.begin(); it != counts.end(); ++it) {
81  (*this)[it->first] += it->second;
82  }
83  }
jubatus::util::data::unordered_map< T, double >::const_iterator const_iterator
Definition: counter.hpp:35

Here is the caller graph for this function:

template<class T>
const_iterator jubatus::core::fv_converter::counter< T >::begin ( ) const
inline

Definition at line 59 of file counter.hpp.

Referenced by jubatus::core::fv_converter::counter< std::string >::add(), and jubatus::core::fv_converter::datum_to_fv_converter_impl::make_string_features().

59  {
60  return data_.begin();
61  }
jubatus::util::data::unordered_map< T, double > data_
Definition: counter.hpp:101

Here is the caller graph for this function:

template<class T>
iterator jubatus::core::fv_converter::counter< T >::begin ( )
inline

Definition at line 63 of file counter.hpp.

63  {
64  return data_.begin();
65  }
jubatus::util::data::unordered_map< T, double > data_
Definition: counter.hpp:101
template<class T>
void jubatus::core::fv_converter::counter< T >::clear ( )
inline

Definition at line 75 of file counter.hpp.

Referenced by jubatus::core::fv_converter::keyword_weights::clear().

75  {
76  jubatus::util::data::unordered_map<T, double>().swap(data_);
77  }
jubatus::util::data::unordered_map< T, double > data_
Definition: counter.hpp:101
void swap(weighted_point &p1, weighted_point &p2)
Definition: types.hpp:47

Here is the caller graph for this function:

template<class T>
bool jubatus::core::fv_converter::counter< T >::contains ( const T &  key) const
inline

Definition at line 39 of file counter.hpp.

39  {
40  return data_.count(key) != 0;
41  }
jubatus::util::data::unordered_map< T, double > data_
Definition: counter.hpp:101
template<class T>
const_iterator jubatus::core::fv_converter::counter< T >::end ( ) const
inline

Definition at line 67 of file counter.hpp.

Referenced by jubatus::core::fv_converter::counter< std::string >::add(), and jubatus::core::fv_converter::datum_to_fv_converter_impl::make_string_features().

67  {
68  return data_.end();
69  }
jubatus::util::data::unordered_map< T, double > data_
Definition: counter.hpp:101

Here is the caller graph for this function:

template<class T>
iterator jubatus::core::fv_converter::counter< T >::end ( )
inline

Definition at line 71 of file counter.hpp.

71  {
72  return data_.end();
73  }
jubatus::util::data::unordered_map< T, double > data_
Definition: counter.hpp:101
template<class T>
jubatus::core::fv_converter::counter< T >::MSGPACK_DEFINE ( data_  )
template<class T>
double jubatus::core::fv_converter::counter< T >::operator[] ( const T &  key) const
inline

Definition at line 43 of file counter.hpp.

43  {
44  const_iterator it = data_.find(key);
45  if (it == data_.end()) {
46  return 0;
47  } else {
48  return it->second;
49  }
50  }
jubatus::util::data::unordered_map< T, double > data_
Definition: counter.hpp:101
jubatus::util::data::unordered_map< T, double >::const_iterator const_iterator
Definition: counter.hpp:35
template<class T>
double& jubatus::core::fv_converter::counter< T >::operator[] ( const T &  key)
inline

Definition at line 52 of file counter.hpp.

52  {
53  if (data_.count(key) == 0) {
54  data_[key] = 0;
55  }
56  return data_[key];
57  }
jubatus::util::data::unordered_map< T, double > data_
Definition: counter.hpp:101

Friends And Related Function Documentation

template<class T>
std::ostream& operator<< ( std::ostream &  os,
const counter< T > &  c 
)
friend

Definition at line 87 of file counter.hpp.

87  {
88  os << "{";
89  for (typename
90  jubatus::util::data::unordered_map<T, double>::const_iterator it
91  = c.data_.begin();
92  it != c.data_.end();
93  ++it) {
94  os << it->first << ":" << it->second << ", ";
95  }
96  os << "}";
97  return os;
98  }

Member Data Documentation

template<class T>
jubatus::util::data::unordered_map<T, double> jubatus::core::fv_converter::counter< T >::data_
private

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