14 #ifndef MLPACK_METHODS_KMEANS_MAX_VARIANCE_NEW_CLUSTER_HPP 15 #define MLPACK_METHODS_KMEANS_MAX_VARIANCE_NEW_CLUSTER_HPP 48 template<
typename MetricType,
typename MatType>
50 const size_t emptyCluster,
51 const arma::mat& oldCentroids,
52 arma::mat& newCentroids,
53 arma::Col<size_t>& clusterCounts,
58 template<
typename Archive>
59 void Serialize(Archive& ar,
const unsigned int version);
70 template<
typename MetricType,
typename MatType>
72 const arma::mat& oldCentroids,
73 arma::Col<size_t>& clusterCounts,
81 #include "max_variance_new_cluster_impl.hpp" size_t iteration
Index of iteration for which variance is cached.
Linear algebra utility functions, generally performed on matrices or vectors.
MaxVarianceNewCluster()
Default constructor required by EmptyClusterPolicy.
The core includes that mlpack expects; standard C++ includes and Armadillo.
When an empty cluster is detected, this class takes the point furthest from the centroid of the clust...
void Serialize(Archive &ar, const unsigned int version)
Serialize the object.
size_t EmptyCluster(const MatType &data, const size_t emptyCluster, const arma::mat &oldCentroids, arma::mat &newCentroids, arma::Col< size_t > &clusterCounts, MetricType &metric, const size_t iteration)
Take the point furthest from the centroid of the cluster with maximum variance to be a new cluster...
void Precalculate(const MatType &data, const arma::mat &oldCentroids, arma::Col< size_t > &clusterCounts, MetricType &metric)
Called when we are on a new iteration.
arma::Row< size_t > assignments
Cached assignments for each point.
arma::vec variances
Cached variances for each cluster.