V
- Vector typeprotected static class GriDBSCAN.Instance<V extends NumberVector>
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
private Border[] |
borders
Border identifier objects (shared to conserve memory).
|
protected int[] |
cells
Number of cells per dimension.
|
private WritableDataStore<Assignment> |
clusterids
Cluster assignments.
|
private Core[] |
cores
Core identifier objects (shared to conserve memory).
|
protected int |
dim
Dimensionality.
|
protected DistanceFunction<? super V> |
distanceFunction
Distance function used.
|
protected double[][] |
domain
Value domain.
|
protected double |
epsilon
Holds the epsilon radius threshold.
|
(package private) it.unimi.dsi.fastutil.longs.Long2ObjectOpenHashMap<ModifiableDBIDs> |
grid
Data grid partitioning.
|
protected double |
gridwidth
Width of the grid cells.
|
protected int |
minpts
Holds the minimum cluster size.
|
protected static int |
NOISE
Noise IDs.
|
protected double[] |
offset
Grid offset.
|
private boolean |
overflown
Indicates that the number of grid cells has overflown.
|
private WritableIntegerDataStore |
temporary
Temporary assignments of a single run.
|
protected static int |
UNPROCESSED
Unprocessed IDs.
|
Constructor and Description |
---|
Instance(DistanceFunction<? super V> distanceFunction,
double epsilon,
int minpts,
double gridwidth)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
protected void |
buildGrid(Relation<V> relation,
int numcells,
double[] offset)
Build the data grid.
|
protected int |
checkGridCellSizes(int size,
long numcell)
Perform some sanity checks on the grid cells.
|
private long |
computeGridBaseOffsets()
Compute the grid base offset.
|
protected int |
expandCluster(DBIDRef seed,
int clusterid,
WritableIntegerDataStore clusterids,
ModifiableDoubleDBIDList neighbors,
ArrayModifiableDBIDs activeSet,
RangeQuery<V> rq,
FiniteProgress pprog)
Set-based expand cluster implementation.
|
private void |
insertIntoGrid(DBIDRef id,
V obj,
int d,
int v)
Insert a single object into the grid; potentially into multiple cells (at
most 2^d) via recursion.
|
protected void |
mergeClusterInformation(ModifiableDBIDs cellids,
WritableIntegerDataStore temporary,
WritableDataStore<Assignment> clusterids)
Merge cluster information.
|
protected int |
processCorePoint(DBIDRef seed,
DoubleDBIDList newneighbors,
int clusterid,
WritableIntegerDataStore clusterids,
ArrayModifiableDBIDs activeSet)
Process a single core point.
|
Clustering<Model> |
run(Relation<V> relation)
Performs the DBSCAN algorithm on the given database.
|
private void |
updateCoreBorderObjects(int clusterid)
Update the shared arrays for core points (to conserve memory)
|
protected static final int UNPROCESSED
protected static final int NOISE
protected DistanceFunction<? super V extends NumberVector> distanceFunction
protected double epsilon
protected int minpts
protected double gridwidth
protected double[][] domain
protected int dim
protected double[] offset
protected int[] cells
it.unimi.dsi.fastutil.longs.Long2ObjectOpenHashMap<ModifiableDBIDs> grid
private Core[] cores
private Border[] borders
private WritableDataStore<Assignment> clusterids
private WritableIntegerDataStore temporary
private boolean overflown
public Instance(DistanceFunction<? super V> distanceFunction, double epsilon, int minpts, double gridwidth)
distanceFunction
- Distance functionepsilon
- Epsilonminpts
- MinPtsgridwidth
- Grid widthpublic Clustering<Model> run(Relation<V> relation)
relation
- Relation to processprivate void updateCoreBorderObjects(int clusterid)
clusterid
- Number of clustersprivate long computeGridBaseOffsets()
protected void buildGrid(Relation<V> relation, int numcells, double[] offset)
relation
- Data relationnumcells
- Total number of cellsoffset
- Offsetprivate void insertIntoGrid(DBIDRef id, V obj, int d, int v)
id
- Object IDobj
- Objectd
- Current dimensionv
- Current cell valueprotected int checkGridCellSizes(int size, long numcell)
numcell
- Number of cellssize
- Relation sizeprotected int expandCluster(DBIDRef seed, int clusterid, WritableIntegerDataStore clusterids, ModifiableDoubleDBIDList neighbors, ArrayModifiableDBIDs activeSet, RangeQuery<V> rq, FiniteProgress pprog)
clusterid
- ID of the current cluster.clusterids
- Current object to cluster mapping.neighbors
- Neighbors acquired by initial getNeighbors call.activeSet
- Set to manage active candidates.rq
- Range querypprog
- Object progressprotected int processCorePoint(DBIDRef seed, DoubleDBIDList newneighbors, int clusterid, WritableIntegerDataStore clusterids, ArrayModifiableDBIDs activeSet)
seed
- Point to processnewneighbors
- New neighborsclusterid
- Cluster to add toclusterids
- Cluster assignment storage.activeSet
- Active set of cluster seedsprotected void mergeClusterInformation(ModifiableDBIDs cellids, WritableIntegerDataStore temporary, WritableDataStore<Assignment> clusterids)
cellids
- IDs in current celltemporary
- Temporary assignmentsclusterids
- Merged cluster assignmentCopyright © 2019 ELKI Development Team. License information.