predict method

int predict(
  1. List<double> x
)

Implementation

int predict(List<double> x) {
  var node = _root;
  while (node != null) {
    if (node.prediction != null) return node.prediction!;
    final f = node.featureIndex!;
    if (x[f] <= node.threshold!) {
      node = node.left;
    } else {
      node = node.right;
    }
  }
  return 0;
}