Skip to content

Commit

Permalink
docs cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
John S Bogaardt committed Jan 19, 2021
1 parent eb98278 commit 0cb42c0
Show file tree
Hide file tree
Showing 20 changed files with 376 additions and 131 deletions.
2 changes: 1 addition & 1 deletion chainladder/core/pandas.py
Expand Up @@ -230,7 +230,7 @@ def tail(self, n=5):
return self.iloc[-n:]

def sort_index(self, *args, **kwargs):
return self.iloc[self.index.sort_values(self.key_labels).index]
return self.iloc[self.index.sort_values(self.key_labels, *args, **kwargs).index]

def exp(self):
xp = self.get_array_module()
Expand Down
15 changes: 9 additions & 6 deletions chainladder/core/triangle.py
Expand Up @@ -42,8 +42,8 @@ class Triangle(TriangleBase):
omitted then date format will be inferred by pandas.
cumulative : bool
Whether the triangle is cumulative or incremental. This attribute is
required to use the `grain` and `dev_to_val` methods and will be
automatically set when invoking `cum_to_incr` or `incr_to_cum` methods.
required to use the ``grain`` and ``dev_to_val`` methods and will be
automatically set when invoking ``cum_to_incr`` or ``incr_to_cum`` methods.
Attributes
----------
Expand All @@ -56,16 +56,17 @@ class Triangle(TriangleBase):
development : Series
Represents all available levels of the development dimension.
key_labels : list
Represents the `index` axis labels
Represents the ``index`` axis labels
virtual_columns : Series
Represents the subset of columns of the triangle that are virtual.
valuation : DatetimeIndex
Represents all valuation dates of each cell in the Triangle.
origin_grain : str
The grain of the origin vector ('Y', 'Q', 'M')
development_grain : str
The grain of the development vector ('Y', 'Q', 'M')
shape : tuple
The 4D shape of the triangle instance with axes corresponding to (index,
columns, origin, development)
The 4D shape of the triangle instance with axes corresponding to (index, columns, origin, development)
link_ratio, age_to_age
Displays age-to-age ratios for the triangle.
valuation_date : date
Expand Down Expand Up @@ -318,7 +319,9 @@ def dev_to_val(self, inplace=False):
Returns
-------
Updated instance of triangle with valuation periods.
Triangle
Updated instance of the triangle with valuation periods.
"""
if self.is_val_tri:
if inplace:
Expand Down
4 changes: 2 additions & 2 deletions chainladder/tails/bondy.py
Expand Up @@ -21,7 +21,7 @@ class TailBondy(TailBase):
age can be used.
attachment_age: int (default=None)
The age at which to attach the fitted curve. If None, then the latest
age is used. Measures of variability from original `ldf_` are retained
age is used. Measures of variability from original ``ldf_`` are retained
when being used in conjunction with the MackChainladder method.
Attributes
Expand All @@ -41,7 +41,7 @@ class TailBondy(TailBase):
std_err_ : Triangle
std_err with tail factor applied
earliest_ldf_ : DataFrame
Based on the `earliest_age` selection, this shows the seed `ldf_` used
Based on the ``earliest_age`` selection, this shows the seed ``ldf_`` used
in fitting the Bondy exponent.
See also
Expand Down
4 changes: 2 additions & 2 deletions chainladder/tails/clark.py
Expand Up @@ -17,7 +17,7 @@ class TailClark(TailBase):
Options are 'loglogistic' and 'weibull'
attachment_age: int (default=None)
The age at which to attach the fitted curve. If None, then the latest
age is used. Measures of variability from original `ldf_` are retained
age is used. Measures of variability from original ``ldf_`` are retained
when being used in conjunction with the MackChainladder method.
Attributes
Expand All @@ -33,7 +33,7 @@ class TailClark(TailBase):
omega_ : DataFrame
Estimates of the omega parameter of the growth curve.
elr_ : DataFrame
The Expected Loss Ratio parameter. This only exists when a `sample_weight`
The Expected Loss Ratio parameter. This only exists when a ``sample_weight``
is provided to the Estimator.
scale_ : DataFrame
The scale parameter of the model.
Expand Down
2 changes: 1 addition & 1 deletion chainladder/tails/constant.py
Expand Up @@ -18,7 +18,7 @@ class TailConstant(TailBase):
of each successive LDF to 50% of the previous LDF.
attachment_age: int (default=None)
The age at which to attach the fitted curve. If None, then the latest
age is used. Measures of variability from original `ldf_` are retained
age is used. Measures of variability from original ``ldf_`` are retained
when being used in conjunction with the MackChainladder method.
Attributes
Expand Down
2 changes: 1 addition & 1 deletion chainladder/tails/curve.py
Expand Up @@ -28,7 +28,7 @@ class TailCurve(TailBase):
in either the ``exponential`` or ``inverse_power`` fits.
attachment_age: int (default=None)
The age at which to attach the fitted curve. If None, then the latest
age is used. Measures of variability from original `ldf_` are retained
age is used. Measures of variability from original ``ldf_`` are retained
when being used in conjunction with the MackChainladder method.
Attributes
Expand Down
11 changes: 5 additions & 6 deletions docs/conf.py
Expand Up @@ -42,9 +42,8 @@

extensions = ['sphinx.ext.autodoc', 'numpydoc', 'sphinx_gallery.gen_gallery',
'sphinx.ext.githubpages', 'nbsphinx', 'sphinx.ext.mathjax',
'sphinx.ext.autosummary', 'sphinx_gallery.load_style']

numpydoc_class_members_toctree = False
'sphinx.ext.autosummary', 'sphinx_gallery.load_style',
'IPython.sphinxext.ipython_console_highlighting']

# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
Expand Down Expand Up @@ -146,7 +145,7 @@
# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ['images']
html_static_path = ['_static/images']

# -- Options for HTMLHelp output ------------------------------------------
# If false, no module index is generated.
Expand Down Expand Up @@ -239,8 +238,8 @@ def make_carousel_thumbs(app, exception):

def setup(app):
# to hide/show the prompt in code examples:
app.add_javascript('js/copybutton.js')
app.add_javascript('js/extra.js')
app.add_js_file('js/copybutton.js')
app.add_js_file('js/extra.js')
app.connect('build-finished', make_carousel_thumbs)


Expand Down
36 changes: 0 additions & 36 deletions docs/install.rst

This file was deleted.

18 changes: 17 additions & 1 deletion docs/modules/classes.rst
Expand Up @@ -25,7 +25,7 @@ Classes

.. autosummary::
:toctree: generated/
:template: class.rst
:template: class_inherited.rst

Triangle
DevelopmentCorrelation
Expand Down Expand Up @@ -155,3 +155,19 @@ Classes
Tabs
CSpacer
RSpacer

Functions
---------
.. currentmodule:: chainladder

.. autosummary::
:toctree: generated/
:template: function.rst

load_sample
read_pickle
read_json
concat
load_sample
minimum
maximum
81 changes: 81 additions & 0 deletions docs/modules/index.rst
@@ -0,0 +1,81 @@
..
File to ..include in a document with a very big table of content, to
give it 'style'
.. raw:: html

<style type="text/css">
div.bodywrapper blockquote {
margin: 0 ;
}
div.toctree-wrapper ul {
margin: 0 ;
padding-left: 0px ;
}
li.toctree-l1 {
padding: 0 ;
list-style-type: none;
font-size: 150% ;
font-family: Arial, sans-serif;
background-color: #BED4EB;
font-weight: normal;
color: #212224;
margin-left : 0;
font-weight: bold;
}
li.toctree-l1 a {
padding: 0 0 0 10px ;
}
li.toctree-l2 {
padding: 0.25em 0 0.25em 0 ;
list-style-type: none;
background-color: #FFFFFF;
font-size: 90% ;
font-weight: bold;
}
li.toctree-l2 ul {
padding-left: 40px ;
}
li.toctree-l3 {
font-size: 70% ;
list-style-type: none;
font-weight: normal;
}
li.toctree-l4 {
font-size: 85% ;
list-style-type: none;
font-weight: normal;
}
</style>



:parenttoc: True

.. title:: User guide: contents

.. _user_guide:

=======================
Chainladder User guide
=======================


.. toctree::
:numbered:
:maxdepth: 2

triangle
development
tails
methods
workflow
utilities
10 changes: 5 additions & 5 deletions docs/modules/methods.rst
Expand Up @@ -8,8 +8,8 @@ Common Properties
=================
All IBNR estimators have ``ibnr_``, ``ultimate_``, ``full_triangle_`` and
``full_expectation_`` attributes. In addition, they carry over the transformed
triangle as `X_` along with all of its properties. Finally, the following
estimators implement the `predict` method which allows them to be used on
triangle as ``X_`` along with all of its properties. Finally, the following
estimators implement the ``predict`` method which allows them to be used on
different Triangles.

.. _chainladder:
Expand Down Expand Up @@ -58,7 +58,7 @@ Mack Chainladder
The :class:`MackChainladder` model can be regarded as a special form of a
weighted linear regression through the origin for each development period. By using
a regression framework, statistics about the variability of the data and the parameter
estimates allows for the estimation of prediciton errors. The Mack Chainladder
estimates allows for the estimation of prediction errors. The Mack Chainladder
method is the most basic of stochastic methods.


Expand Down Expand Up @@ -130,8 +130,8 @@ The generalized formula is:
.. math::
\sum_{k=0}^{n-1}(1-\frac{1}{CDF}) + Apriori\times (1-\frac{1}{CDF})^{n}
`n=0` yields the expected loss method, `n=1` yields the traditional BF method,
and finally when `n` is sufficiently large, the method converges to the
``n=0`` yields the expected loss method, ``n=1`` yields the traditional BF method,
and finally when ``n`` is sufficiently large, the method converges to the
traditional CL method.

.. figure:: /auto_examples/images/sphx_glr_plot_benktander_001.png
Expand Down
14 changes: 7 additions & 7 deletions docs/modules/tails.rst
Expand Up @@ -86,10 +86,10 @@ are supported.

In general, ``inverse_power`` fit produce more conservative tail estimates than
the ``exponential`` fit. Both are fit using basic OLS regression on transformed
`X` and `y` values.
``X`` and ``y`` values.

For exponential curve fitting, we use fit a regression to the natural log of
the development portion of a link-ratio, `f`.
the development portion of a link-ratio, ``f``.


Extrapolation Period
Expand All @@ -106,22 +106,22 @@ asymptotic value.

Regression parameters
----------------------
Underlying the curve fit is an OLS regression which generates both a `slope_`
and `intercept_` term.
Underlying the curve fit is an OLS regression which generates both a ``slope_``
and ``intercept_`` term.

For the `exponential` curve fit with slope, b and intercept a, the tail factor
For the ``exponential`` curve fit with slope, b and intercept a, the tail factor
is:

.. math::
\prod_{i}^{N}1+exp(\beta X+\alpha )
For the `inverse_power` curve, the tail factor is:
For the ``inverse_power`` curve, the tail factor is:

.. math::
\prod_{i}^{N}1+exp(\alpha) X^{\beta}
Deriving the `tail_` factor manually:
Deriving the ``tail_`` factor manually:

>>> import chainladder as cl
>>> import numpy as np
Expand Down

0 comments on commit 0cb42c0

Please sign in to comment.