src/main/java/pt/it/av/tnav/ml/clustering/FGClustering.java
public <D extends Distance<D>> List<Cluster<D>> clustering(final List<D> dps,
                                                             final int minPts, final Curvature cur) {
    // array with average distance to closest minPts
    double dist[] = new double[dps.size()],
        x[] = new double[dps.size()];

    // Find minPits closer points
    for (int i = 0; i < dps.size(); i++) {
      dist[i] = ArrayUtils.mean(DBSCAN.kCloserPoints(dps, i, minPts));
      x[i] = i;
    }

    // Sort distances
    Arrays.sort(dist);

    // Find curvature and use it as EPS
    double eps = dist[cur.elbow(x, dist)];
    return clustering(dps, eps);
  }
/**
   * Use the same technique as in DBSCAN.
   *
   * @param dps
   * @param minPts
   * @param <D>
   * @return
   */
Use the same technique as in DBSCAN.
Use the same technique as in DBSCAN .
public <D extends Distance<D>> List<Cluster<D>> clustering(final List<D> dps,
                                                             final int minPts, final Curvature cur) {
    double dist[] = new double[dps.size()],
        x[] = new double[dps.size()];
    for (int i = 0; i < dps.size(); i++) {
      dist[i] = ArrayUtils.mean(DBSCAN.kCloserPoints(dps, i, minPts));
      x[i] = i;
    }
    Arrays.sort(dist);
    double eps = dist[cur.elbow(x, dist)];
    return clustering(dps, eps);
  }
public < D extends Distance < D > > List < Cluster < D > > clustering ( final List < D > dps , final int minPts , final Curvature cur ) { double dist [ ] = new double [ dps . size ( ) ] , x [ ] = new double [ dps . size ( ) ] ; for ( int i = 0 ; i < dps . size ( ) ; i ++ ) { dist [ i ] = ArrayUtils . mean ( DBSCAN . kCloserPoints ( dps , i , minPts ) ) ; x [ i ] = i ; } Arrays . sort ( dist ) ; double eps = dist [ cur . elbow ( x , dist ) ] ; return clustering ( dps , eps ) ; }
Use the same technique as in DBSCAN.
Use the same technique as in DBSCAN .
// array with average distance to closest minPts // Find minPits closer points // Sort distances // Find curvature and use it as EPS