Skip to main content

Reusable modelling, pricing, governance, and reporting utilities.

Project description

Insurance-Pricing

A reusable toolkit for insurance modeling, pricing, governance, and reporting.

Overview

Insurance-Pricing (ins_pricing) is an enterprise-grade Python library designed for machine learning model training, pricing calculations, and model governance workflows in the insurance industry.

Core Modules

Module Description
modelling ML model training (GLM, XGBoost, ResNet, FT-Transformer, GNN) and model interpretability (SHAP, permutation importance)
pricing Factor table construction, numeric binning, premium calibration, exposure calculation, PSI monitoring
production Model prediction, batch scoring, data drift detection, production metrics monitoring
governance Model registry, version management, approval workflows, audit logging
reporting Report generation (Markdown format), report scheduling
utils Data validation, performance profiling, device management, logging configuration

Quick Start

# Model training with Bayesian optimization
from ins_pricing import bayesopt as ropt

model = ropt.BayesOptModel(
    train_data, test_data,
    model_name='my_model',
    resp_nme='target',
    weight_nme='weight',
    factor_nmes=feature_list,
    cate_list=categorical_features,
)
model.bayesopt_xgb(max_evals=100)      # Train XGBoost
model.bayesopt_resnet(max_evals=50)    # Train ResNet
model.bayesopt_ft(max_evals=50)        # Train FT-Transformer

# Pricing: build factor table
from ins_pricing.pricing import build_factor_table
factors = build_factor_table(
    df,
    factor_col='age_band',
    loss_col='claim_amount',
    exposure_col='exposure',
)

# Production: batch scoring
from ins_pricing.production import batch_score
scores = batch_score(model.trainers['xgb'].predict, df)

# Model governance
from ins_pricing.governance import ModelRegistry
registry = ModelRegistry('models.json')
registry.register(model_name, version, metrics=metrics)

Project Structure

ins_pricing/
├── cli/                    # Command-line entry points
├── modelling/
│   ├── core/bayesopt/     # ML model training core
│   ├── explain/           # Model interpretability
│   └── plotting/          # Model visualization
├── pricing/               # Insurance pricing module
├── production/            # Production deployment module
├── governance/            # Model governance
├── reporting/             # Report generation
├── utils/                 # Utilities
└── tests/                 # Test suite

Installation

# Basic installation
pip install ins_pricing

# Full installation (all optional dependencies)
pip install ins_pricing[all]

# Install specific extras
pip install ins_pricing[bayesopt]    # Model training
pip install ins_pricing[explain]     # Model explanation
pip install ins_pricing[plotting]    # Visualization
pip install ins_pricing[gnn]         # Graph neural networks

Multi-platform & GPU installation notes

  • PyTorch (CPU/GPU/MPS): Install the correct PyTorch build for your platform/GPU first (CUDA on Linux/Windows, ROCm on supported AMD platforms, or MPS on Apple Silicon). Then install the optional extras you need (e.g., bayesopt, explain, or gnn). This avoids pip pulling a mismatched wheel.
  • Torch Geometric (GNN): torch-geometric often requires platform-specific wheels (e.g., torch-scatter, torch-sparse). Follow the official PyG installation instructions for your CUDA/ROCm/CPU environment, then install ins_pricing[gnn].
  • Multi-GPU: Training code will use CUDA when available and can enable multi-GPU via torch.distributed/DataParallel where supported. On Windows, CUDA DDP is not supported and will fall back to single-GPU or DataParallel where possible.

Requirements

  • Python >= 3.9
  • Core dependencies: numpy >= 1.20, pandas >= 1.4

License

Proprietary

Project details


Release history Release notifications | RSS feed

Download files

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

Source Distribution

ins_pricing-0.3.1.tar.gz (243.1 kB view details)

Uploaded Source

Built Distribution

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

ins_pricing-0.3.1-py3-none-any.whl (297.9 kB view details)

Uploaded Python 3

File details

Details for the file ins_pricing-0.3.1.tar.gz.

File metadata

  • Download URL: ins_pricing-0.3.1.tar.gz
  • Upload date:
  • Size: 243.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.9

File hashes

Hashes for ins_pricing-0.3.1.tar.gz
Algorithm Hash digest
SHA256 124f117f2c60d21aa7aa8771ab8bd7c7062d3e1bfb1101cb759500312c8f1a9b
MD5 930b2e3e9a39926cd684c5e8e8e92139
BLAKE2b-256 aa2fcbb6b17e48417ec89718f2edb13b22df0f2ecceba83c94a0a26e8b42ea31

See more details on using hashes here.

File details

Details for the file ins_pricing-0.3.1-py3-none-any.whl.

File metadata

  • Download URL: ins_pricing-0.3.1-py3-none-any.whl
  • Upload date:
  • Size: 297.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.9

File hashes

Hashes for ins_pricing-0.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 a259d998524f239b34cd3b0fd91da5fc13a2840a584d5d89f834fd415503d916
MD5 8c047cdb980afca7978cbb4fc0e000e3
BLAKE2b-256 28e1c0ac06a9afb14fe6a29aca4de4bd24c5c2456a42e234e6cdc4256cc393d0

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