Skip to content

Commit d18a814

Browse files
committed
Update docs
1 parent 96cf55c commit d18a814

File tree

2 files changed

+31
-6
lines changed

2 files changed

+31
-6
lines changed

climada/util/calibrate/base.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,9 @@ class Input:
6666
"cost" between them. The optimization algorithm will try to minimize this
6767
number. The first argument is the true/correct values (:py:attr:`data`), the
6868
second argument is the estimated/predicted values, and the third argument is the
69-
:py:attr:`data_weights`.
69+
:py:attr:`data_weights`. The cost function is intended to operate on
70+
``numpy.ndarray`` objects.
71+
Dataframes are transformed using :py:attr:`df_to_numpy`.
7072
bounds : Mapping (str, {Bounds, tuple(float, float)}), optional
7173
The bounds for the parameters. Keys: parameter names. Values:
7274
``scipy.minimize.Bounds`` instance or tuple of minimum and maximum value.
@@ -86,15 +88,15 @@ class Input:
8688
:py:attr:`data`, insert this value. Defaults to NaN, in which case the impact
8789
from the model is ignored. Set this to zero to explicitly calibrate to zero
8890
impacts in these cases.
89-
df_to_numpy : Callable
91+
df_to_numpy : Callable, optional
9092
A function that transforms a pandas.DataFrame into a numpy.ndarray to be
9193
inserted into the :py:attr:`cost_func`. By default, this will flatten the data
9294
frame.
9395
data_weights : pandas.DataFrame, optional
9496
Weights for each entry in :py:attr:`data`. Must have the exact same index and
9597
columns. If ``None``, the weights will be ignored (equivalent to the same weight
9698
for each event).
97-
missing_data_value : float, optional
99+
missing_weights_value : float, optional
98100
Same as :py:attr:`missing_data_value`, but for :py:attr:`data_weights`.
99101
assign_centroids : bool, optional
100102
If ``True`` (default), assign the hazard centroids to the exposure when this
@@ -450,13 +452,13 @@ def _target_func(
450452
451453
Parameters
452454
----------
453-
data : pandas.DataFrame
455+
data : nd.ndarray
454456
The reference data used for calibration. By default, this is
455457
:py:attr:`Input.data`.
456-
predicted : pandas.DataFrame
458+
predicted : nd.ndarray
457459
The impact predicted by the data calibration after it has been transformed
458460
into a dataframe by :py:attr:`Input.impact_to_dataframe`.
459-
weights : pandas.DataFrame
461+
weights : nd.ndarray
460462
The relative weight for each data/entry pair.
461463
462464
Returns

doc/api/climada/climada.util.calibrate.rst

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,23 @@
44
Impact Function Calibration Module
55
==================================
66

7+
What's New?
8+
-----------
9+
10+
Since CLIMADA v6.0.1, some functionality of this module has been changed.
11+
When upgrading to a newer version of CLIMADA, please mind the following changes:
12+
13+
* :py:class:`~climada.util.calibrate.base.Input` received additional attributes.
14+
We now support optional weights that are passed to the cost function.
15+
Therefore, the cost function must support an additional, optional argument.
16+
* :py:attr:`~climada.util.calibrate.base.Input.cost_func` now receives numpy arrays.
17+
An additional attribute :py:attr:`~climada.util.calibrate.base.Input.df_to_numpy` was
18+
added to transform ``pandas.DataFrame`` objects to ``np.ndarray``.
19+
By default, it returns a flattened array.
20+
* This module now exports cost functions that support optional weights, see
21+
:py:mod:`climada.util.calibrate.cost_func`.
22+
* :ref:`Ensemble optimizers <ensemble-optimizers>` have been addded.
23+
724
Base Classes
825
------------
926

@@ -13,6 +30,10 @@ Generic classes for defining the data structures of this module.
1330
:members:
1431
:private-members:
1532

33+
.. automodule:: climada.util.calibrate.cost_func
34+
:members:
35+
:private-members:
36+
1637
Bayesian Optimizer
1738
------------------
1839

@@ -33,6 +54,8 @@ Calibration based on the ``scipy.optimize`` module.
3354
:show-inheritance:
3455
:inherited-members: abc.ABC
3556

57+
.. _ensemble-optimizers:
58+
3659
Ensemble Optimizers
3760
-------------------
3861

0 commit comments

Comments
 (0)