jubatus_core  0.1.2
Jubatus: Online machine learning framework for distributed environment
gmm.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_GMM_HPP_
18 #define JUBATUS_CORE_CLUSTERING_GMM_HPP_
19 
20 #include "gmm_types.hpp"
21 
22 namespace jubatus {
23 namespace core {
24 namespace clustering {
25 
26 class gmm {
27  public:
28  void batch(const eigen_wsvec_list_t& data, int d, int k);
30  return means_;
31  }
33  return covs_;
34  }
36  int64_t get_nearest_center_index(const eigen_svec_t& p) const;
37 
38  private:
39  void initialize(const eigen_wsvec_list_t& data, int d, int k);
40  bool is_converged(
41  int64_t niter,
42  const eigen_svec_list_t& means,
43  const eigen_svec_list_t& old_means,
44  double obj,
45  double old_obj);
47  const eigen_svec_t& x,
48  const eigen_svec_list_t& mean,
49  const eigen_smat_list_t& cov,
50  const eigen_solver_list_t& solvers) const;
55  int d_;
56  int k_;
57 };
58 
59 } // namespace clustering
60 } // namespace core
61 } // namespace jubatus
62 
63 #endif // JUBATUS_CORE_CLUSTERING_GMM_HPP_
void batch(const eigen_wsvec_list_t &data, int d, int k)
Definition: gmm.cpp:40
eigen_smat_list_t get_covs()
Definition: gmm.hpp:32
int64_t get_nearest_center_index(const eigen_svec_t &p) const
Definition: gmm.cpp:95
std::vector< jubatus::util::lang::shared_ptr< eigen_solver_t > > eigen_solver_list_t
Definition: gmm_types.hpp:35
eigen_smat_list_t covs_
Definition: gmm.hpp:52
void initialize(const eigen_wsvec_list_t &data, int d, int k)
Definition: gmm.cpp:114
Eigen::SparseMatrix< double > eigen_smat_t
Definition: gmm_types.hpp:30
bool is_converged(int64_t niter, const eigen_svec_list_t &means, const eigen_svec_list_t &old_means, double obj, double old_obj)
Definition: gmm.cpp:136
eigen_svec_t get_nearest_center(const eigen_svec_t &p) const
Definition: gmm.cpp:91
eigen_svec_list_t get_centers()
Definition: gmm.hpp:29
eigen_svec_t cluster_probs(const eigen_svec_t &x, const eigen_svec_list_t &mean, const eigen_smat_list_t &cov, const eigen_solver_list_t &solvers) const
Definition: gmm.cpp:149
std::vector< eigen_svec_t > eigen_svec_list_t
Definition: gmm_types.hpp:32
eigen_solver_list_t cov_solvers_
Definition: gmm.hpp:54
std::vector< eigen_wsvec_t > eigen_wsvec_list_t
Definition: gmm_types.hpp:42
Eigen::SparseVector< double > eigen_svec_t
Definition: gmm_types.hpp:29
eigen_svec_list_t means_
Definition: gmm.hpp:51
std::vector< eigen_smat_t > eigen_smat_list_t
Definition: gmm_types.hpp:33