fit.result¶
Result of optimization.
OptimizationResult
¶
Bases: ObjectJSONEncoder
Result of optimization problem.
Initialize optimization result.
Provides access to the FitParameters, the individual fits, and the trajectories of the fits. The settings and the id of the problem are stored with the result, a report of the fit needs them.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
parameters
|
Iterable[FitParameter]
|
fit parameters of the optimization problem. |
required |
fits
|
list[OptimizeResult]
|
results of the single optimizations. |
required |
trajectories
|
list
|
trajectories of the single optimizations. |
required |
sid
|
str | None
|
identifier of the result, created from the time by default. |
None
|
opid
|
str | None
|
id of the optimization problem the result belongs to. |
None
|
settings
|
FitSettings | dict[str, Any] | None
|
settings the fit was run with. |
None
|
settings_stored
property
¶
Settings the fit was run with.
Raises:
| Type | Description |
|---|---|
ValueError
|
if the result carries no settings, e.g., because it was created by hand. |
from_json
staticmethod
¶
Load OptimizationResult from Path or str.
:param json_info: :return:
parameter_set
¶
Get the parameters of a single optimization run.
The runs are ordered by increasing cost, so k=0 is the best fit.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
k
|
int
|
index of the run in the results ordered by cost. |
0
|
sid
|
str | None
|
identifier of the set, |
None
|
Returns:
| Type | Description |
|---|---|
ParameterSet
|
The parameter set of the run. |
Raises:
| Type | Description |
|---|---|
IndexError
|
if the result has no run |
parameter_sets
¶
Get the parameters of the best optimization runs.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
size
|
int
|
number of runs, ordered by increasing cost. |
1
|
Returns:
| Type | Description |
|---|---|
ParameterSets
|
The parameter sets of the best runs. |
combine
staticmethod
¶
Combine results from multiple parameter fitting experiments.
Raises:
| Type | Description |
|---|---|
ValueError
|
if no results are given. |
process_traces
staticmethod
¶
Process the trajectories of the optimizations.
process_fits
staticmethod
¶
Process the optimization results, sorted by increasing cost.
bound_warnings
¶
Warn about optimal parameters which ended up on their bounds.
A parameter on its bound means that the optimum is outside of the box in which the parameter was allowed to vary.
The distance to a bound is relative to the interval of the parameter. The optimization runs in logarithmic parameter space, so the distance is measured there as well whenever the bounds and the value are positive.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
parameters
|
list[FitParameter]
|
fitted parameters with their bounds. |
required |
x
|
ndarray
|
optimal values of the parameters. |
required |
rtol
|
float
|
relative distance to a bound which is reported. |
0.05
|
Returns:
| Type | Description |
|---|---|
list[str]
|
Messages for the parameters which are within |