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 
22 namespace mlpack {
23 namespace dbscan {
24 
50 template<typename RangeSearchType = range::RangeSearch<>,
51  typename PointSelectionPolicy = OrderedPointSelection>
52 class DBSCAN
53 {
54  public:
68  DBSCAN(const double epsilon,
69  const size_t minPoints,
70  const bool batchMode = true,
71  RangeSearchType rangeSearch = RangeSearchType(),
72  PointSelectionPolicy pointSelector = PointSelectionPolicy());
73 
82  template<typename MatType>
83  size_t Cluster(const MatType& data,
84  arma::mat& centroids);
85 
95  template<typename MatType>
96  size_t Cluster(const MatType& data,
97  arma::Row<size_t>& assignments);
98 
109  template<typename MatType>
110  size_t Cluster(const MatType& data,
111  arma::Row<size_t>& assignments,
112  arma::mat& centroids);
113 
114  private:
116  double epsilon;
117 
120  size_t minPoints;
121 
123  bool batchMode;
124 
126  RangeSearchType rangeSearch;
127 
129  PointSelectionPolicy pointSelector;
130 
141  template<typename MatType>
142  void PointwiseCluster(const MatType& data,
143  emst::UnionFind& uf);
144 
154  template<typename MatType>
155  void BatchCluster(const MatType& data,
156  emst::UnionFind& uf);
157 };
158 
159 } // namespace dbscan
160 } // namespace mlpack
161 
162 // Include implementation.
163 #include "dbscan_impl.hpp"
164 
165 #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:52
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...