Package io.jenetics.prog.regression
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 itsresult()
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
All Methods Static Methods Instance Methods Abstract Methods Modifier and Type Method Description T
argAt(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.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.T
result()
Return the result of the sample point.
-
-
-
Method Detail
-
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 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:
arity()
-
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 emptyNullPointerException
- if the argument array isnull
-
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 argumenty
- 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 argumentx2
- the second argumenty
- 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 argumentx2
- the second argumentx3
- the second argumenty
- the sample point result- Returns:
- a new sample point
-
-