simple_knn 0.0.3 copy "simple_knn: ^0.0.3" to clipboard
simple_knn: ^0.0.3 copied to clipboard

Calculate k-nearest neighbours(knn) with a small subset of lodash with chaining capability

example/main.dart

import "package:simple_knn/simple_knn.dart";
import 'data.dart';

void main() {
  final testSetSize = 100;
  final List<List<num>> testSet = alldata.sublist(0, testSetSize);
  final List<List<num>> trainingSet = alldata.sublist(0, testSetSize);

  for (int k = 1; k < 7; k++) {
    var successes = testSet.where((List<num> testPoint) =>
        LodashChain.knn(trainingSet, LodashChain.initial(testPoint), k: k) ==
        testPoint.last);
    var accuracy = (successes.length / testSetSize) * 100;
    print("result for k=$k: $accuracy%");
  }
}
4
likes
140
pub points
22%
popularity

Publisher

verified publisherschilken.de

Calculate k-nearest neighbours(knn) with a small subset of lodash with chaining capability

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

More

Packages that depend on simple_knn