Interface Sample<T>

Type Parameters:
T - the sample type

public interface Sample<T>
Represents a sample point used for the symbolic regression task. It consists of an argument array and a result value. The sample point is comparable according its result() value.
Since:
5.0
Version:
5.0
Implementation Requirements:
The dimensionality of the sample point must be at least one, which means arity() >= 1.
  • Method Summary

    Modifier and Type
    Method
    Description
    argAt(int index)
    Return the argument value with the given index.
    int
    Return the dimensionality of the sample point arguments.
    static <T> Sample<T>
    of(T[] sample)
    Create a new sample point from the given argument and sample result.
    static Sample<Double>
    ofDouble(double x, double y)
    Create a new sample point from the given argument and sample result.
    static Sample<Double>
    ofDouble(double x1, double x2, double y)
    Create a new sample point from the given argument and sample result.
    static Sample<Double>
    ofDouble(double x1, double x2, double x3, double y)
    Create a new sample point from the given argument and sample result.
    Return the result of the sample point.
  • Method Details

    • arity

      int arity()
      Return the dimensionality of the sample point arguments.
      Returns:
      the arity of the sample point
    • argAt

      T argAt(int index)
      Return the argument value with the given index.
      Parameters:
      index - the argument index
      Returns:
      the argument value with the given index
      Throws:
      ArrayIndexOutOfBoundsException - if the given index is not within the given range [0, arity)
      See Also:
    • result

      Return the result of the sample point.
      Returns:
      the result of the sample point
    • of

      static <T> Sample<T> of(T[] sample)
      Create a new sample point from the given argument and sample result. It represents the function arguments with the function value: f: sample[0:sample.length-1] -> sample[sample.length-1]. The last array element contains the result, and the first n-1 elements are function arguments.
      Type Parameters:
      T - the sample type
      Parameters:
      sample - the sample point result
      Returns:
      a new sample point
      Throws:
      IllegalArgumentException - if the argument array is empty
      NullPointerException - if the argument array is null
    • ofDouble

      static Sample<Double> ofDouble(double x, double y)
      Create a new sample point from the given argument and sample result. It represents the function arguments with the function value: f: x -> y
      Parameters:
      x - the argument
      y - the sample point result
      Returns:
      a new sample point
    • ofDouble

      static Sample<Double> ofDouble(double x1, double x2, double y)
      Create a new sample point from the given argument and sample result. It represents the function arguments with the function value: f: (x1, x2) -> y
      Parameters:
      x1 - the first argument
      x2 - the second argument
      y - the sample point result
      Returns:
      a new sample point
    • ofDouble

      static Sample<Double> ofDouble(double x1, double x2, double x3, double y)
      Create a new sample point from the given argument and sample result. It represents the function arguments with the function value: f: (x1, x2, x3) -> y
      Parameters:
      x1 - the first argument
      x2 - the second argument
      x3 - the second argument
      y - the sample point result
      Returns:
      a new sample point