rippy
ReInsurance Pricing in PYthon!
Getting Started
Install rippy from pypi:
pip install rippy
Introduction
Rippy is a simple, fast and lightweight simulation-based reinsurance modeling package. It has two main components:
-
Frequency-Severity, otherwise known as compound distribution simulation
Rippy contains the
FrequencySeverityModelclass to set up and simulate from compound distributions with a variety of frequency and severity distributionsfrom rippy import FrequencySeverityModel, Distributions claims = FrequencySeverityModel(Distributions.Poisson(5),Distributions.Pareto(0.5,100000)).generate()
-
Reinsurance contract calculation
Rippy can then calculate the recoveries of a number of types of reinsurance contract for the simulated claims.
from rippy import XoL xol_layer = XoL(name="Layer 1", limit=1000000, excess=100000, premium=1000) xol_layer.apply(claims) xol_layer.print_summary()
Rippy is based on the scientific python stack of numpy and scipy for fast performance. It can optionally run on a GPU for extremely fast performance. It is designed for interoperability with numpy and ndarrays, so for example the simulated claims can be operated on with numpy ufuncs:
import numpy as np
capped_claims = np.minimum(claims,2000000)
Under the hood/bonnet, rippy represents the simulations of the Frequency-Severity model in sparse storage, keeping two lists of simulation indices and values:
| sim_index | values |
|---|---|
| 0 | 13231.12 |
| 0 | 432.7 |
| 2 | 78935.12 |
| 3 | 3213.9 |
| 3 | 43843.1 |
| ... | ... |
Frequency-Severity simulations can be aggregated (summed within a sim_index), which results in a standard np.ndarray
aggregate_claims = claims.aggregate()
np.array([13663.82,0,78935,12,47957.0,....])
Configuring the simulation settings
The global number of simulations can be changed from the config class (the default is 100,000 simulations)
from rippy import config
config.n_sims = 1000000
The global random seed can also be configured from the config class
config.set_random_seed(123456)
Rippy uses the default_rng class of the numpy.random module. This can also be configured using the config.rng property.
Using a GPU
GPU support requires a CUDA compatible GPU. Internally rippy uses the cupy library. Install the dependencies by running
pip install rippy[gpu]
To enable GPU mode, set the RIPPY_USE_GPU environment variable to 1.
export RIPPY_USE_GPU=1
on Linux or
set RIPPY_USE_GPU=1
on Windows. Set it to anythin else to revert to using a CPU
Project Status
Rippy is currently a proof of concept. There are a limited number of supported distributions and reinsurance contracts. We are working on:
- Adding more distributions and loss generation types
- Adding support for Catastrophe loss generation and reinsurance contracts
- Adding support for more reinsurance contract types (Surplus, Stop Loss etc)
- Grouping reinsurance contracts into programs and structures
- Stratified sampling and Quasi-Monte Carlo methods
- Reporting dashboards
Issues
Please log issues in github
Contributing
You are welcome to contribute pull requests
Metadata
Release files for rippy 0.0.8
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| rippy-0.0.8.tar.gz | 17.3 kB | Without provenance | Details for rippy-0.0.8.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| rippy-0.0.8-py3-none-any.whl | Python 3 | none | any | Details for rippy-0.0.8-py3-none-any.whl |
Total release size: 31.4 kB
Release files / rippy-0.0.8.tar.gz
| Download URL | rippy-0.0.8.tar.gz |
|---|---|
| Size | 17.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
8fd0d650e52e1843ffff64f0957c97eba55a5ddb86c28e71f60eb86c3a4a7354
|
|
BLAKE2b-256 checksum How to use checksums |
28f5f74254360da671ab13a950cefc14d90c833ab1bef2421359d9d42aecdb19
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.10.12
|
Release files / rippy-0.0.8-py3-none-any.whl
| Download URL | rippy-0.0.8-py3-none-any.whl |
|---|---|
| Size | 14.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
df39ce21dcba97b4ef9190bc209439b0c67198e793c8b0e1bf7f51f0a36b2141
|
|
BLAKE2b-256 checksum How to use checksums |
be4d5e701446410f62d1d7ad787b19813ad833df1c82a6dfafc483ea074e9edb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.10.12
|
Security for rippy 0.0.8
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.