jubatus_core  0.1.2
Jubatus: Online machine learning framework for distributed environment
eigen_feature_mapper.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_EIGEN_FEATURE_MAPPER_HPP_
18 #define JUBATUS_CORE_CLUSTERING_EIGEN_FEATURE_MAPPER_HPP_
19 
20 #include <string>
21 #include <utility>
22 #include <vector>
23 #include "jubatus/util/data/unordered_map.h"
24 #include "gmm_types.hpp"
25 #include "types.hpp"
26 
27 namespace jubatus {
28 namespace core {
29 namespace clustering {
30 
32  public:
34  void clear();
35  int get_dimension();
36  eigen_wsvec_list_t convert(const wplist& src, bool update_map = true);
37  eigen_svec_list_t convert(const std::vector<common::sfv_t>& src,
38  bool update_map = true);
40  bool update_map = true);
41  eigen_svec_t convert(const common::sfv_t& src, bool update_map = true);
42  eigen_svec_t convertc(const common::sfv_t& src) const;
43  wplist revert(const eigen_wsvec_list_t& src) const;
44  std::vector<common::sfv_t> revert(const eigen_svec_list_t& src) const;
45  common::sfv_t revert(const eigen_svec_t& src) const;
46  weighted_point revert(const eigen_wsvec_t& src) const;
47 
48  private:
49  jubatus::util::data::unordered_map<std::string, size_t> map_;
50  jubatus::util::data::unordered_map<size_t, std::string> rmap_;
51 
52  void insert(
53  const std::pair<std::string, float>& item,
54  bool update_map,
55  eigen_svec_t& dst);
56 
57  void insertc(
58  const std::pair<std::string, float>&,
59  eigen_svec_t& dst) const;
60 
61  void rinsert(
62  const std::pair<int, float>&,
63  common::sfv_t& dst) const;
64 
65  int d_;
66 };
67 
68 } // namespace clustering
69 } // namespace core
70 } // namespace jubatus
71 
72 #endif // JUBATUS_CORE_CLUSTERING_EIGEN_FEATURE_MAPPER_HPP_
eigen_svec_t convertc(const common::sfv_t &src) const
void insert(const std::pair< std::string, float > &item, bool update_map, eigen_svec_t &dst)
wplist revert(const eigen_wsvec_list_t &src) const
void insertc(const std::pair< std::string, float > &, eigen_svec_t &dst) const
std::vector< eigen_svec_t > eigen_svec_list_t
Definition: gmm_types.hpp:32
void rinsert(const std::pair< int, float > &, common::sfv_t &dst) const
jubatus::util::data::unordered_map< std::string, size_t > map_
std::vector< std::pair< std::string, float > > sfv_t
Definition: type.hpp:29
std::vector< eigen_wsvec_t > eigen_wsvec_list_t
Definition: gmm_types.hpp:42
eigen_wsvec_list_t convert(const wplist &src, bool update_map=true)
std::vector< weighted_point > wplist
Definition: types.hpp:55
Eigen::SparseVector< double > eigen_svec_t
Definition: gmm_types.hpp:29
jubatus::util::data::unordered_map< size_t, std::string > rmap_