mlpack  2.0.1
allow_empty_clusters.hpp
Go to the documentation of this file.
1 
15 #ifndef __MLPACK_METHODS_KMEANS_ALLOW_EMPTY_CLUSTERS_HPP
16 #define __MLPACK_METHODS_KMEANS_ALLOW_EMPTY_CLUSTERS_HPP
17 
18 #include <mlpack/core.hpp>
19 
20 namespace mlpack {
21 namespace kmeans {
22 
28 {
29  public:
32 
50  template<typename MetricType, typename MatType>
51  static inline force_inline size_t EmptyCluster(
52  const MatType& /* data */,
53  const size_t /* emptyCluster */,
54  const arma::mat& /* oldCentroids */,
55  arma::mat& /* newCentroids */,
56  arma::Col<size_t>& /* clusterCounts */,
57  MetricType& /* metric */,
58  const size_t /* iteration */)
59  {
60  // Empty clusters are okay! Do nothing.
61  return 0;
62  }
63 
65  template<typename Archive>
66  void Serialize(Archive& /* ar */, const unsigned int /* version */) { }
67 };
68 
69 } // namespace kmeans
70 } // namespace mlpack
71 
72 #endif
Linear algebra utility functions, generally performed on matrices or vectors.
void Serialize(Archive &, const unsigned int)
Serialize the empty cluster policy (nothing to do).
AllowEmptyClusters()
Default constructor required by EmptyClusterPolicy policy.
Policy which allows K-Means to create empty clusters without any error being reported.
#define force_inline
Definition: prereqs.hpp:47
Include all of the base components required to write MLPACK methods, and the main MLPACK Doxygen docu...
static force_inline size_t EmptyCluster(const MatType &, const size_t, const arma::mat &, arma::mat &, arma::Col< size_t > &, MetricType &, const size_t)
This function does nothing.