predict method

int predict(
  1. List<double> x
)

Implementation

int predict(List<double> x) {
  final votes = <int, int>{};
  for (final t in _trees) {
    final p = t.predict(x);
    votes[p] = (votes[p] ?? 0) + 1;
  }
  return votes.entries.reduce((a, b) => a.value >= b.value ? a : b).key;
}