Skip to main content

The frequency-severity model has been widely adopted to analyze highly right-skewed data

Project description

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

safepg-1.0.1.tar.gz (3.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

safepg-1.0.1-py3-none-any.whl (3.2 kB view details)

Uploaded Python 3

File details

Details for the file safepg-1.0.1.tar.gz.

File metadata

  • Download URL: safepg-1.0.1.tar.gz
  • Upload date:
  • Size: 3.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for safepg-1.0.1.tar.gz
Algorithm Hash digest
SHA256 c55e2371f01a06e1aecd82fda6015ad063367ade1c0e8b42897bc282bcfc9a6c
MD5 6f5a3daec44d594270358fa9881a1293
BLAKE2b-256 3ebbc1957c56deef2bd08ff654ef026e81846082a5ea7cb8c646ee09c4b76d7a

See more details on using hashes here.

File details

Details for the file safepg-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: safepg-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 3.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for safepg-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 aba562fc6f234b5ee1bd2e0cf2192fc4f26f9cf162613906eb3e1d02abc1a39b
MD5 0ae5f04a36d6d3d01821365e9f19d886
BLAKE2b-256 6e273df1cff4b8a2fb7688b110837bbc1245b27d802941ad6d6e97f6c1a83672

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page