adaptive.IntegratorLearner¶
IntegratorLearner
¶
Bases: BaseLearner
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
function
|
callable: X → Y
|
The function to learn. |
required |
bounds
|
pair of reals
|
The bounds of the interval on which to learn 'function'. |
required |
tol
|
float
|
Relative tolerance of the error to the integral, this means that
the learner is done when: |
required |
Attributes:
| Name | Type | Description |
|---|---|---|
approximating_intervals |
set of intervals
|
The intervals that can be used in the determination of the integral. |
n |
int
|
The total number of evaluated points. |
igral |
float
|
The integral value in |
err |
float
|
The absolute error associated with |
max_ivals |
int, default: 1000
|
Maximum number of intervals that can be present in the calculation of the integral. If this amount exceeds max_ivals, the interval with the smallest error will be discarded. |
Functions:
| Name | Description |
|---|---|
done : bool |
Returns whether the |
plot : hv.Scatter |
Plots all the points that are evaluated. |
Source code in adaptive/learner/integrator_learner.py
x_mapping
instance-attribute
¶
x_mapping: dict[float, SortedSet] = defaultdict(lambda: SortedSet([], key=attrgetter('rdepth')))
new
¶
new() -> IntegratorLearner
tell
¶
Source code in adaptive/learner/integrator_learner.py
tell_pending
¶
propagate_removed
¶
Source code in adaptive/learner/integrator_learner.py
add_ival
¶
Source code in adaptive/learner/integrator_learner.py
ask
¶
Choose points for learners.
Source code in adaptive/learner/integrator_learner.py
pop_from_stack
¶
Source code in adaptive/learner/integrator_learner.py
remove_unfinished
¶
done
¶
Source code in adaptive/learner/integrator_learner.py
loss
¶
plot
¶
Source code in adaptive/learner/integrator_learner.py
to_numpy
¶
to_dataframe
¶
to_dataframe(with_default_function_args: bool = True, function_prefix: str = 'function.', x_name: str = 'x', y_name: str = 'y') -> DataFrame
Return the data as a pandas.DataFrame.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
with_default_function_args
|
bool
|
Include the |
True
|
function_prefix
|
str
|
Prefix to the |
'function.'
|
x_name
|
str
|
Name of the input value, by default "x" |
'x'
|
y_name
|
str
|
Name of the output value, by default "y" |
'y'
|
Returns:
| Type | Description |
|---|---|
DataFrame
|
|
Raises:
| Type | Description |
|---|---|
ImportError
|
If |
Source code in adaptive/learner/integrator_learner.py
load_dataframe
¶
load_dataframe(df: DataFrame, with_default_function_args: bool = True, function_prefix: str = 'function.', x_name: str = 'x', y_name: str = 'y') -> None
Load data from a pandas.DataFrame.
If with_default_function_args is True, then learner.function's
default arguments are set (using functools.partial) from the values
in the pandas.DataFrame.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
with_default_function_args
|
bool
|
Include the |
True
|
function_prefix
|
str
|
Prefix to the |
'function.'
|
x_name
|
str
|
Name of the input value, by default "x" |
'x'
|
y_name
|
str
|
Name of the output value, by default "y" |
'y'
|