[mlpack] 85/207: Minor style fixes.
Barak A. Pearlmutter
barak+git at pearlmutter.net
Thu Mar 23 17:53:43 UTC 2017
This is an automated email from the git hooks/post-receive script.
bap pushed a commit to branch master
in repository mlpack.
commit 9fdf7106b1633b404ffd5a7bb4a5ec85f7ed69a9
Author: Ryan Curtin <ryan at ratml.org>
Date: Thu Feb 23 09:30:52 2017 -0500
Minor style fixes.
---
src/mlpack/methods/dbscan/dbscan.hpp | 10 +++++-----
src/mlpack/methods/dbscan/dbscan_impl.hpp | 22 +++++++++-------------
2 files changed, 14 insertions(+), 18 deletions(-)
diff --git a/src/mlpack/methods/dbscan/dbscan.hpp b/src/mlpack/methods/dbscan/dbscan.hpp
index 99d0fed..3067ba7 100644
--- a/src/mlpack/methods/dbscan/dbscan.hpp
+++ b/src/mlpack/methods/dbscan/dbscan.hpp
@@ -100,17 +100,17 @@ class DBSCAN
arma::mat& centroids);
private:
- // Maximum distance between two points to be part of same cluster.
+ //! Maximum distance between two points to be part of same cluster.
double epsilon;
- // Minimum number of points to be in the epsilon-neighborhood(including
- // itself) for the point to be a core-point.
+ //! Minimum number of points to be in the epsilon-neighborhood (including
+ //! itself) for the point to be a core-point.
size_t minPoints;
- // Instantiated range search policy.
+ //! Instantiated range search policy.
RangeSearchType rangeSearch;
- // Instantiated point selection policy.
+ //! Instantiated point selection policy.
PointSelectionPolicy pointSelector;
/**
diff --git a/src/mlpack/methods/dbscan/dbscan_impl.hpp b/src/mlpack/methods/dbscan/dbscan_impl.hpp
index 5fd075d..0f9906d 100644
--- a/src/mlpack/methods/dbscan/dbscan_impl.hpp
+++ b/src/mlpack/methods/dbscan/dbscan_impl.hpp
@@ -63,11 +63,9 @@ size_t DBSCAN<RangeSearchType, PointSelectionPolicy>::Cluster(
// Now calculate the centroids.
centroids.zeros(data.n_rows, numClusters);
- //Stores the number of points in each cluster
+ // Calculate number of points in each cluster.
arma::Row<size_t> counts;
counts.zeros(numClusters);
-
- //Caluclate number of points in each cluster.
for (size_t i = 0; i < data.n_cols; ++i)
{
if (assignments[i] != SIZE_MAX)
@@ -95,29 +93,27 @@ size_t DBSCAN<RangeSearchType, PointSelectionPolicy>::Cluster(
const MatType& data,
arma::Row<size_t>& assignments)
{
- //Stores cluster assigned to each point.
assignments.set_size(data.n_cols);
assignments.fill(SIZE_MAX);
size_t currentCluster = 0;
- //For each point find the points in epsilon-nighborhood
- //and their distances.
+ // For each point, find the points in epsilon-nighborhood and their distances.
std::vector<std::vector<size_t>> neighbors;
std::vector<std::vector<double>> distances;
- Log::Info << "Performing range search." << std::endl;
+ Log::Debug << "Performing range search." << std::endl;
rangeSearch.Train(data);
rangeSearch.Search(data, math::Range(0.0, epsilon), neighbors, distances);
- Log::Info << "Range search complete." << std::endl;
+ Log::Debug << "Range search complete." << std::endl;
// Initialize to all true; false means it's been visited.
boost::dynamic_bitset<> unvisited(data.n_cols);
unvisited.set();
while (unvisited.any())
{
- //Randomly select an unvisited point.
+ // Select the next unvisited point.
const size_t nextIndex = pointSelector.Select(unvisited, data);
- Log::Info << "Inspect point " << nextIndex << "; " << unvisited.count()
+ Log::Debug << "Inspect point " << nextIndex << "; " << unvisited.count()
<< " unvisited points remain." << std::endl;
// currentCluster will only be incremented if a cluster was created.
@@ -129,9 +125,9 @@ size_t DBSCAN<RangeSearchType, PointSelectionPolicy>::Cluster(
}
/**
- * This function processes the point at index. It marks the point
- * as visited, checks if the given point is core or non-core.
- * If its a core point, it expands the cluster else returns.
+ * This function processes the point at index. It marks the point as visited,
+ * checks if the given point is core or non-core. If it is a core point, it
+ * expands the cluster, otherwise it returns.
*/
template<typename RangeSearchType, typename PointSelectionPolicy>
template<typename MatType>
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/mlpack.git
More information about the debian-science-commits
mailing list