predict.DBSCAN.RdSimilar to other predict methods, this function predicts fitted values from a fitted "DBSCAN" object.
# S3 method for DBSCAN predict(model, data, key, features = NULL, ...)
| model |
|
|---|---|
| data |
|
| key |
|
| features |
|
| ... | Reserved parameter. |
S3 methods
Predicted values are returned as a DataFrame, structured as follows.
ID column, with same name and type as data's ID column.
Cluster_ID, type INTEGER, the assigned cluster ID.
DISTANCE, type DOUBLE, Distance between a given point and the nearest core object .
Perform the predict on DataFrame data2 using "DBSCAN" object dbscan:
> data2$Collect() ID V000 V001 V002 1 1 0.10 0.10 B 2 2 0.11 0.10 A 3 3 0.10 0.11 C 4 4 0.11 0.11 B 5 5 0.12 0.11 A ...... 28 28 16.11 16.11 A 29 29 20.11 20.12 C 30 30 15.12 15.11 A > fitted <- predict(model = dbscan, data = data2)
Output:
> fitted$Collect()
ID CLUSTER_ID DISTANCE
1 1 0 0.000
2 2 0 0.000
3 3 0 0.000
4 4 0 0.000
5 5 0 0.000
......
28 28 -1 11.950
29 29 -1 21.374
30 30 -1 9.960