Skip to main content

SAFEPG

img

A Novel SAFE Model for Predicting Climate-Related Extreme Losses

Table of contents

Introduction

The frequency-severity model has been widely adopted to analyze highly right-skewed data in actuarial science. To make the model more interpretable, we expect a predictor has the same direction of impact on both the frequency and severity. However, the compotemporary use of the frequence-severity model typically yields inconsistent signs. To this end, we propose a novel sign-aligned regularization term to facilitate the sign consistency between the components in the frequency-severity model to enhance interpretability. We also demonstrate our design of the penalty leads to an algorithm which is quite efficient in analyzing large-scale data and its superior performance with both simulation and real examples.

Installation

You can use pip to install this package.

pip install SAFEPG

Quick start

The usages are similar with scikit-learn:

model = SafeModel()
model.fit(x=x, y=y, k=k, lambda_=ulam)

Usage

Generate simulation data

SAFEPG provides a simulation data generation function to test functions in the library:

from SAFEPG.SAFEPG import SafeModel
import numpy as np
from scipy.stats import poisson, gamma

np.random.seed(0)
n = 100
p = 5
x = np.random.randn(n, p)
beta_true = np.full(5, 0.1)
gamma_true = np.array([1, 1, 1, -1, -1])

mu = x @ beta_true
k = poisson.rvs(mu=np.exp(mu))
alpha_val = 1
theta = np.exp(x @ gamma_true) / alpha_val
y = gamma.rvs(a=alpha_val, scale=theta)

lambda_val = [1.0]
ind_p = np.array([1, 1, 1, 0, 0])

model = SafeModel()
model.fit(x=x, y=y, k=k, lambda_=lambda_val, ind_p = ind_p)

Getting help

Any questions or suggestions please contact: yikai-zhang@uiowa.edu

Metadata

Release files for SAFEPG 1.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for SAFEPG 1.0.1
File Size Uploaded
safepg-1.0.1.tar.gz 3.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for SAFEPG 1.0.1
File Interpreter ABI Platform
safepg-1.0.1-py3-none-any.whl Python 3 none any Details

Total release size: 6.7 kB

Release files / safepg-1.0.1.tar.gz

Download URL safepg-1.0.1.tar.gz
Size 3.5 kB
Tags Source
SHA-256 checksum
How to use checksums
c55e2371f01a06e1aecd82fda6015ad063367ade1c0e8b42897bc282bcfc9a6c
BLAKE2b-256 checksum
How to use checksums
3ebbc1957c56deef2bd08ff654ef026e81846082a5ea7cb8c646ee09c4b76d7a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.9

Release files / safepg-1.0.1-py3-none-any.whl

Download URL safepg-1.0.1-py3-none-any.whl
Size 3.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
aba562fc6f234b5ee1bd2e0cf2192fc4f26f9cf162613906eb3e1d02abc1a39b
BLAKE2b-256 checksum
How to use checksums
6e273df1cff4b8a2fb7688b110837bbc1245b27d802941ad6d6e97f6c1a83672
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.9

Release history Release notifications | RSS feed

This release

1.0.1 This release

2 release files

1.0.0

2 release files

0.3.1

2 release files

0.2.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page