Skip to content

Commit

Permalink
Bump version for release and address #117 mutation
Browse files Browse the repository at this point in the history
  • Loading branch information
jbogaardt committed Feb 16, 2021
1 parent 87bbb20 commit 68a1163
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 25 deletions.
9 changes: 6 additions & 3 deletions README.rst
Expand Up @@ -54,6 +54,8 @@ Available Estimators
+------------------------------+------------------+-------------------------+-----------------------+-----------------------+
| `IncrementalAdditive`_ | | `CapeCod`_ | | |
+------------------------------+------------------+-------------------------+-----------------------+-----------------------+
| `CaseOutstanding`_ | | | | |
+------------------------------+------------------+-------------------------+-----------------------+-----------------------+

Documentation
-------------
Expand All @@ -79,9 +81,10 @@ code documentation.
.. _GridSearch: https://chainladder-python.readthedocs.io/en/latest/modules/workflow.html#gridsearch
.. _IncrementalAdditive: https://chainladder-python.readthedocs.io/en/latest/modules/development.html#incremental-additive
.. _CapeCod: https://chainladder-python.readthedocs.io/en/latest/modules/methods.html#cape-cod
.. _ParallelogramOLF: https://chainladder-python.readthedocs.io/en/latest/modules/generated/chainladder.ParallelogramOLF.html#chainladder.ParallelogramOLF
.. _VotingChainladder: https://chainladder-python.readthedocs.io/en/latest/modules/generated/chainladder.VotingChainladder.html#chainladder.VotingChainladder
.. _Trend: https://chainladder-python.readthedocs.io/en/latest/modules/generated/chainladder.Trend.html#chainladder.Trend
.. _ParallelogramOLF: https://chainladder-python.readthedocs.io/en/latest/modules/adjustments.html#parallelogramolf
.. _VotingChainladder: https://chainladder-python.readthedocs.io/en/latest/modules/workflow.html#votingchainladder
.. _Trend: https://chainladder-python.readthedocs.io/en/latest/modules/adjustments.html#trend
.. _CaseOutstanding: https://chainladder-python.readthedocs.io/en/latest/modules/development.html#caseoutstanding
.. _Documentation: https://chainladder-python.readthedocs.io/en/latest/

Getting Started Tutorials
Expand Down
2 changes: 1 addition & 1 deletion chainladder/__init__.py
Expand Up @@ -22,4 +22,4 @@ def auto_sparse(auto_sparse=True):
from chainladder.methods import * # noqa (API Import)
from chainladder.workflow import * # noqa (API Import)

__version__ = "0.7.13"
__version__ = "0.8.0"
2 changes: 2 additions & 0 deletions chainladder/development/outstanding.py
Expand Up @@ -17,6 +17,8 @@ class CaseOutstanding(DevelopmentBase):
into comparable multiplicative patterns for usage with the various IBNR
methods.
.. versionadded:: 0.8.0
Parameters
----------
paid_to_incurred : tuple or list of tuples
Expand Down
40 changes: 20 additions & 20 deletions chainladder/workflow/voting.py
Expand Up @@ -48,10 +48,10 @@ class _BaseChainladderVoting(_BaseVoting, _BaseTriangleEnsemble):
"""

def _broadcast_weights(self, X):
if self.weights.ndim == 3:
weights = np.repeat(self.weights[np.newaxis, ...], X.shape[1], axis=0)
if self.weights.ndim == 4:
weights = np.repeat(self.weights[np.newaxis, ...], X.shape[0], axis=0)
if self.weights_.ndim == 3:
weights = np.repeat(self.weights_[np.newaxis, ...], X.shape[1], axis=0)
if self.weights_.ndim == 4:
weights = np.repeat(self.weights_[np.newaxis, ...], X.shape[0], axis=0)
return weights

def _predict(self, X, sample_weight=None):
Expand All @@ -62,22 +62,22 @@ def _predict(self, X, sample_weight=None):
def fit(self, X, y, sample_weight=None):
"""Get common fit operations."""
names, clfs = self._validate_estimators()

if self.weights is not None:
self.weights = self.weights[..., np.newaxis]
if self.weights.shape[-3] != X.shape[2]:
self.weights_ = self.weights
if self.weights_ is not None:
self.weights_ = self.weights_[..., np.newaxis]
if self.weights_.shape[-3] != X.shape[2]:
raise ValueError('Length of weight arrays do not equal'
f' number of accident periods; found'
f' {self.weights.shape[-3]} weights'
f' {self.weights_.shape[-3]} weights'
f' and {X.shape[2]} accident periods.')
if self.weights.shape[-2] != len(self.estimators):
if self.weights_.shape[-2] != len(self.estimators):
raise ValueError('Number of weight arrays does not equal'
f' number of estimators array; '
f' found {self.weights.shape[-2]} weights'
f' found {self.weights_.shape[-2]} weights'
f' arrays and {len(self.estimators)}'
' estimators.')
else:
self.weights = np.ones(X.shape[:3] + (len(self.estimators), 1))
self.weights_ = np.ones(X.shape[:3] + (len(self.estimators), 1))

self.estimators_ = Parallel(n_jobs=self.n_jobs)(
delayed(_fit_single_estimator)(
Expand Down Expand Up @@ -111,7 +111,7 @@ class VotingChainladder(_BaseChainladderVoting, MethodBase):
Read more in the :ref:`User Guide <voting>`.
.. versionadded:: 0.7.12
.. versionadded:: 0.8.0
Parameters
----------
Expand Down Expand Up @@ -275,20 +275,20 @@ def fit_transform(self, X, y=None, sample_weight=None):
return self.fit(X, y, sample_weight).transform(X, sample_weight=sample_weight)

def _get_ultimate(self, X, sample_weight=None):
if self.weights.ndim < 5:
if self.weights_.ndim < 5:
weights = self._broadcast_weights(X)
elif self.weights.ndim == 5:
if self.weights.shape[0] != X.shape[0]:
elif self.weights_.ndim == 5:
if self.weights_.shape[0] != X.shape[0]:
raise ValueError('Index length (axis 0) of weights does'
' not equal index length of X; found'
f' {self.weights.shape[0]} for weights'
f' {self.weights_.shape[0]} for weights'
f' and {X.shape[0]} for X.')
if self.weights.shape[1] != X.shape[1]:
if self.weights_.shape[1] != X.shape[1]:
raise ValueError('Column length (axis 1) of weights does'
f' not equal column length of X; found'
f' {self.weights.shape[1]} for weights'
f' {self.weights_.shape[1]} for weights'
f' and {X.shape[1]} for X.')
weights = self.weights
weights = self.weights_

ultimate = sum([
est.predict(X, sample_weight).ultimate_ * weights[..., i, :]
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Expand Up @@ -14,7 +14,7 @@
descr = "Chainladder Package - P&C Loss Reserving package "
name = 'chainladder'
url = 'https://github.com/casact/chainladder-python'
version='0.7.13' # Put this in __init__.py
version='0.8.0' # Put this in __init__.py

data_path = ''
setup(
Expand Down

0 comments on commit 68a1163

Please sign in to comment.