dbscan.hpp
Go to the documentation of this file.
1 
13 #ifndef MLPACK_METHODS_DBSCAN_DBSCAN_HPP
14 #define MLPACK_METHODS_DBSCAN_DBSCAN_HPP
15 
16 #include <mlpack/core.hpp>
21 #include <boost/dynamic_bitset.hpp>
22 
23 namespace mlpack {
24 namespace dbscan {
25 
51 template<typename RangeSearchType = range::RangeSearch<>,
52  typename PointSelectionPolicy = OrderedPointSelection>
53 class DBSCAN
54 {
55  public:
69  DBSCAN(const double epsilon,
70  const size_t minPoints,
71  const bool batchMode = true,
72  RangeSearchType rangeSearch = RangeSearchType(),
73  PointSelectionPolicy pointSelector = PointSelectionPolicy());
74 
83  template<typename MatType>
84  size_t Cluster(const MatType& data,
85  arma::mat& centroids);
86 
96  template<typename MatType>
97  size_t Cluster(const MatType& data,
98  arma::Row<size_t>& assignments);
99 
110  template<typename MatType>
111  size_t Cluster(const MatType& data,
112  arma::Row<size_t>& assignments,
113  arma::mat& centroids);
114 
115  private:
117  double epsilon;
118 
121  size_t minPoints;
122 
124  bool batchMode;
125 
127  RangeSearchType rangeSearch;
128 
130  PointSelectionPolicy pointSelector;
131 
142  template<typename MatType>
143  void PointwiseCluster(const MatType& data,
144  emst::UnionFind& uf);
145 
155  template<typename MatType>
156  void BatchCluster(const MatType& data,
157  emst::UnionFind& uf);
158 };
159 
160 } // namespace dbscan
161 } // namespace mlpack
162 
163 // Include implementation.
164 #include "dbscan_impl.hpp"
165 
166 #endif
A Union-Find data structure.
Definition: union_find.hpp:30
DBSCAN (Density-Based Spatial Clustering of Applications with Noise) is a clustering technique descri...
Definition: dbscan.hpp:53
Linear algebra utility functions, generally performed on matrices or vectors.
size_t Cluster(const MatType &data, arma::mat &centroids)
Performs DBSCAN clustering on the data, returning number of clusters and also the centroid of each cl...
DBSCAN(const double epsilon, const size_t minPoints, const bool batchMode=true, RangeSearchType rangeSearch=RangeSearchType(), PointSelectionPolicy pointSelector=PointSelectionPolicy())
Construct the DBSCAN object with the given parameters.
Include all of the base components required to write mlpack methods, and the main mlpack Doxygen docu...