Interface ThresholdProvider

Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@Experimental @FunctionalInterface public interface ThresholdProvider
Provides the threshold for boolean answers of a decision service: the answer is true when the probability of "yes" is greater than or equal to the threshold.

It is called on every invocation, so thresholds can come from configuration that changes at runtime. It can be called concurrently, and for asynchronous methods on the thread that completes the call to the model (for example an I/O thread), so it must be thread-safe, fast and non-blocking.

ThresholdProvider thresholds = context -> config.getDouble(
        context.serviceInterface().getSimpleName() + "." + context.questionName());
Since:
1.21.0
  • Method Summary

    Modifier and Type
    Method
    Description
    Returns the threshold for the given question, from 0 to 1, or null to use the default of 0.5.
  • Method Details

    • threshold

      Double threshold(ThresholdContext context)
      Returns the threshold for the given question, from 0 to 1, or null to use the default of 0.5.