Class FunctionEvaluator

java.lang.Object
ai.vespa.models.evaluation.FunctionEvaluator

public class FunctionEvaluator extends Object
An evaluator which can be used to evaluate a single function once.
Author:
bratseth
  • Method Details

    • bind

      public FunctionEvaluator bind(String name, com.yahoo.tensor.Tensor value)
      Binds the given variable referred in this expression to the given value.
      Parameters:
      name - the variable to bind
      value - the value this becomes bound to
      Returns:
      this for chaining
    • bind

      public FunctionEvaluator bind(String name, double value)
      Binds the given variable referred in this expression to the given value. This is equivalent to bind(name, Tensor.Builder.of(TensorType.empty).cell(value).build())
      Parameters:
      name - the variable to bind
      value - the value this becomes bound to
      Returns:
      this for chaining
    • bind

      public FunctionEvaluator bind(String name, String value)
      Binds the given variable referred in this expression to the given value. String values are not yet supported in tensors.
      Parameters:
      name - the variable to bind
      value - the value this becomes bound to
      Returns:
      this for chaining
    • setMissingValue

      public FunctionEvaluator setMissingValue(com.yahoo.tensor.Tensor value)
      Sets the default value to use for variables which are not bound
      Parameters:
      value - the default value
      Returns:
      this for chaining
    • setMissingValue

      public FunctionEvaluator setMissingValue(double value)
      Sets the default value to use for variables which are not bound
      Parameters:
      value - the default value
      Returns:
      this for chaining
    • evaluate

      public com.yahoo.tensor.Tensor evaluate()
    • function

      public com.yahoo.searchlib.rankingexpression.ExpressionFunction function()
      Returns the function evaluated by this
    • context

      public LazyArrayContext context()