mlpack
3.4.2
mlpack-3.4.2
src
mlpack
methods
kmeans
hamerly_kmeans.hpp
Go to the documentation of this file.
1
12
#ifndef MLPACK_METHODS_KMEANS_HAMERLY_KMEANS_HPP
13
#define MLPACK_METHODS_KMEANS_HAMERLY_KMEANS_HPP
14
15
namespace
mlpack
{
16
namespace
kmeans {
17
18
template
<
typename
MetricType,
typename
MatType>
19
class
HamerlyKMeans
20
{
21
public
:
26
HamerlyKMeans
(
const
MatType& dataset, MetricType& metric);
27
36
double
Iterate
(
const
arma::mat& centroids,
37
arma::mat& newCentroids,
38
arma::Col<size_t>& counts);
39
40
size_t
DistanceCalculations
()
const
{
return
distanceCalculations; }
41
42
private
:
44
const
MatType& dataset;
46
MetricType& metric;
47
49
arma::vec minClusterDistances;
50
52
arma::vec upperBounds;
54
arma::vec lowerBounds;
56
arma::Col<size_t> assignments;
57
59
size_t
distanceCalculations;
60
};
61
62
}
// namespace kmeans
63
}
// namespace mlpack
64
65
// Include implementation.
66
#include "hamerly_kmeans_impl.hpp"
67
68
#endif
mlpack::kmeans::HamerlyKMeans::DistanceCalculations
size_t DistanceCalculations() const
Definition:
hamerly_kmeans.hpp:40
mlpack::kmeans::HamerlyKMeans::HamerlyKMeans
HamerlyKMeans(const MatType &dataset, MetricType &metric)
Construct the HamerlyKMeans object, which must store several sets of bounds.
mlpack::kmeans::HamerlyKMeans
Definition:
hamerly_kmeans.hpp:20
mlpack
Linear algebra utility functions, generally performed on matrices or vectors.
Definition:
add_to_cli11.hpp:21
mlpack::kmeans::HamerlyKMeans::Iterate
double Iterate(const arma::mat ¢roids, arma::mat &newCentroids, arma::Col< size_t > &counts)
Run a single iteration of Hamerly's algorithm, updating the given centroids into the newCentroids mat...
Generated by
1.8.20