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.0.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.0-py3-none-any.whl (3.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: safepg-1.0.0.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.0.tar.gz
Algorithm Hash digest
SHA256 b745302a7cd033ceaed8a9cefe0d4c244b059ad530b28956c4b2627f1d68e03e
MD5 6c51986b0c1172e1a1b00e5366954ca6
BLAKE2b-256 6f4548002f17704365bdb4e1da007a4c0fd87b4d9a293c15a473e609c867f86a

See more details on using hashes here.

File details

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

File metadata

  • Download URL: safepg-1.0.0-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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 691885d02fe6cdb278188db7fc5eb19a021be7cacf81f0a23b5e0f03d18fbaee
MD5 1f6a8def63b420652a1cb8b4b057d816
BLAKE2b-256 3d79549f6db922338c17abccfdbca398654ae3d025443b8a3910127770c0319d

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