dbscan 0.1.1 copy "dbscan: ^0.1.1" to clipboard
dbscan: ^0.1.1 copied to clipboard

Dart 1 only

A clustering package utilizing density based spatial clustering for applications with noise.

example/dbscan_example.dart

// Copyright (c) 2017, erikrahtjen. All rights reserved. Use of this source code
// is governed by a BSD-style license that can be found in the LICENSE file.

import 'dart:math';
import 'package:dbscan/dbscan.dart';

main() {
  List<Point<double>> _dataset = [
    new Point(1.0, 3.0),
    new Point(0.0, 0.0),
    new Point(2.0, 0.0),
    new Point(1.0, 1.0),
    new Point(3.0, 1.0),
    new Point(2.0, 3.0),
    new Point(1.0, 1.0),
    new Point(1.0, 2.0),
    new Point(0.0, 2.0),
    new Point(2.0, 3.0),
    new Point(3.0, 0.0),
    new Point(0.0, 1.0),
    new Point(1.0, 2.123),
  ];

  double distanceSigma = 1.25;
  int minimumNumberOfPointsInCluster = 4;

  var pointClusterer = new DBSCAN(_dataset, distanceSigma, 4, (Point<double> pointA, Point<double> pointB) {
    return sqrt(pow(pointA.x - pointB.x, 2) + pow(pointA.y - pointB.y, 2));
  });

  print('Clusters: ${pointClusterer.clusters}');
  print('Noise: ${pointClusterer.noise}');
}
0
likes
40
pub points
0%
popularity

Publisher

unverified uploader

A clustering package utilizing density based spatial clustering for applications with noise.

Repository (GitHub)
View/report issues

License

BSD-3-Clause (LICENSE)

More

Packages that depend on dbscan