jubatus_core  0.1.2
Jubatus: Online machine learning framework for distributed environment
types.hpp
Go to the documentation of this file.
1 // Jubatus: Online machine learning framework for distributed environment
2 // Copyright (C) 2013 Preferred Networks and Nippon Telegraph and Telephone Corporation.
3 //
4 // This library is free software; you can redistribute it and/or
5 // modify it under the terms of the GNU Lesser General Public
6 // License version 2.1 as published by the Free Software Foundation.
7 //
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // Lesser General Public License for more details.
12 //
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16 
17 #ifndef JUBATUS_CORE_CLUSTERING_TYPES_HPP_
18 #define JUBATUS_CORE_CLUSTERING_TYPES_HPP_
19 
20 #include <algorithm>
21 #include <string>
22 #include <utility>
23 #include <vector>
24 
25 #include <msgpack.hpp>
26 
27 #include "../common/type.hpp"
28 #include "../fv_converter/datum.hpp"
29 
30 namespace jubatus {
31 namespace core {
32 namespace clustering {
33 
34 typedef double cluster_weight;
35 typedef std::vector<std::pair<cluster_weight,
37 typedef std::vector<cluster_unit> cluster_set;
38 
40  public:
42  double weight;
45 };
46 
47 inline void swap(weighted_point& p1, weighted_point& p2) {
48  using std::swap;
49  swap(p1.weight, p2.weight);
50  swap(p1.data, p2.data);
53 }
54 
55 typedef std::vector<weighted_point> wplist;
56 typedef std::vector<common::sfv_t> plist;
57 typedef std::vector<std::pair<std::string, wplist> > diff_t;
58 
59 } // namespace clustering
60 } // namespace core
61 } // namespace jubatus
62 
63 #endif // JUBATUS_CORE_CLUSTERING_TYPES_HPP_
MSGPACK_DEFINE(weight, data, original)
std::vector< cluster_unit > cluster_set
Definition: types.hpp:37
std::vector< std::pair< cluster_weight, jubatus::core::fv_converter::datum > > cluster_unit
Definition: types.hpp:36
void swap(weighted_point &p1, weighted_point &p2)
Definition: types.hpp:47
std::vector< std::pair< std::string, wplist > > diff_t
Definition: types.hpp:57
std::vector< std::pair< std::string, float > > sfv_t
Definition: type.hpp:29
std::vector< common::sfv_t > plist
Definition: types.hpp:56
std::vector< weighted_point > wplist
Definition: types.hpp:55