- 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 TypeMethodDescriptionargAt
(int index) Return the argument value with the givenindex
.int
arity()
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.ofDouble
(double x, double y) Create a new sample point from the given argument and sample result.ofDouble
(double x1, double x2, double y) Create a new sample point from the given argument and sample result.ofDouble
(double x1, double x2, double x3, double y) Create a new sample point from the given argument and sample result.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
Return the argument value with the givenindex
.- Parameters:
index
- the argument index- Returns:
- the argument value with the given
index
- Throws:
ArrayIndexOutOfBoundsException
- if the givenindex
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
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 emptyNullPointerException
- if the argument array isnull
-
ofDouble
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 argumenty
- the sample point result- Returns:
- a new sample point
-
ofDouble
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 argumentx2
- the second argumenty
- the sample point result- Returns:
- a new sample point
-
ofDouble
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 argumentx2
- the second argumentx3
- the second argumenty
- the sample point result- Returns:
- a new sample point
-