predictProba method

double predictProba(
  1. List<double> features
)

Predict probability for a single example.

Implementation

double predictProba(List<double> features) {
  if (_weights == null) throw StateError('Model not fitted');
  var z = _weights![0];
  for (var i = 0; i < features.length && i + 1 < _weights!.length; i++) {
    z += _weights![i + 1] * features[i];
  }
  return _sigmoid(z);
}