Hi, in GDBScan, the last line of the expand method says "if new point is a cluster"... but in the "if clause" the point is evaluated with the current neighbourhood... not with the new neighbours.
neighbours.foldLeft(neighbours) {
case (neighbourhood, neighbour @ Point(row)) =>
// if not visited yet, create a new neighbourhood
val newNeighbours = if (!(visited contains neighbour)) {
visited add neighbour
getNeighbours(neighbour, points.filterNot(_.row == neighbour.row))
} else {
Seq.empty
}
// Add to cluster if neighbour point isn't assigned to a cluster yet
if (!(clustered contains neighbour)) {
cluster add neighbour
clustered add neighbour
}
// if the neighbour point is a cluster, join the neighbourhood
if (isCorePoint(neighbour, neighbourhood)) neighbourhood ++ newNeighbours else neighbourhood
}
I think the last line should be:
// if the neighbour point is a cluster, join the neighbourhood
if (isCorePoint(neighbour, newNeighbours)) neighbourhood ++ newNeighbours else neighbourhood
If you agree I can do a PR.
Hi, in GDBScan, the last line of the expand method says "if new point is a cluster"... but in the "if clause" the point is evaluated with the current neighbourhood... not with the new neighbours.
neighbours.foldLeft(neighbours) { case (neighbourhood, neighbour @ Point(row)) => // if not visited yet, create a new neighbourhood val newNeighbours = if (!(visited contains neighbour)) { visited add neighbour getNeighbours(neighbour, points.filterNot(_.row == neighbour.row)) } else { Seq.empty } // Add to cluster if neighbour point isn't assigned to a cluster yet if (!(clustered contains neighbour)) { cluster add neighbour clustered add neighbour } // if the neighbour point is a cluster, join the neighbourhood if (isCorePoint(neighbour, neighbourhood)) neighbourhood ++ newNeighbours else neighbourhood }I think the last line should be:
If you agree I can do a PR.