objective
Objective
Base class for objective functions.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
model
|
Model
|
Numerical model to call. |
required |
loss
|
Loss
|
Loss function to use. |
required |
xdata
|
dict[str, ndarray]
|
Input x data. |
required |
ydata
|
dict[str, ndarray]
|
Output y data to calculate loss against. |
required |
negate
|
Literal[1, -1]
|
Set to |
1
|
Source code in slimfit/objective.py
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
|
ScipyObjective
Bases: Objective
Objective function for use with scipy.optimize.minimize or ScipyMinimizer.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
model
|
Model
|
Numerical model to call. |
required |
loss
|
Loss
|
Loss function to use. |
required |
xdata
|
dict[str, ndarray]
|
Input x data. |
required |
ydata
|
dict[str, ndarray]
|
Output y data to calculate loss against. |
required |
shapes
|
dict[str, Shape]
|
Shapes of the parameters. |
required |
negate
|
Literal[1, -1]
|
Whether to negate the objective function output (negate for maximization). |
1
|
Source code in slimfit/objective.py
51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 |
|
__call__(x)
Call the objective function.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
x
|
ndarray
|
Array of concatenated parameters. |
required |
Returns:
Type | Description |
---|---|
float
|
Objective value. |
Source code in slimfit/objective.py
76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 |
|
pack(parameter_values)
Pack a dictionary of parameter_name together as array
Source code in slimfit/objective.py
150 151 152 153 154 155 |
|
unpack(x, shapes)
Unpack a ndim 1 array of concatenated parameter values into a dictionary of parameter name: parameter_value where parameter values are cast back to their specified shapes.
Source code in slimfit/objective.py
137 138 139 140 141 142 143 144 145 146 147 |
|