Skip to main content

Statistical and Machine Learning tools from Mirabolic

Project description

Mirabolic

Tools for statistical modeling and analysis.

Neural Nets for GLM regression

GLMs (Generalized Linear Models) are a relatively broad class of statistical model first popularlized in the 1970s. These have grown popular in the actuarial literature as a method of predicting insurance claims costs and frequency.

With the appropriate loss function, GLMs can be formulated as types of neural nets. To illustrate this, we perform Poisson regression in Keras using a nearly trivial network and a custom loss function. Expressing a GLM as a neural net opens the possibility of extending the neural net before or after the GLM component. For instance, suppose we build three subnets that each computed a single feature, and then feed the three outputs as inputs into the Poisson regression net. This single larger network would allow the three subnets to engineer their individual features such that the loss function of the joint network was optimized. This approach provides a straightforward way of performing non-linear feature engineering but retaining the explainability of a GLM.

To see the code in action, run

python sample_poisson.py

This will generate some Poisson-distributed data and corresponding features and then try to recover the "betas" (i.e., the linear coefficients of the GLM), outputting both the true and recovered values.

We also include the loss function required for negative binomial regression, which can be useful when modeling count data with higher variance.

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

mirabolic-0.0.9.tar.gz (10.3 kB view details)

Uploaded Source

Built Distribution

mirabolic-0.0.9-py3-none-any.whl (10.2 kB view details)

Uploaded Python 3

File details

Details for the file mirabolic-0.0.9.tar.gz.

File metadata

  • Download URL: mirabolic-0.0.9.tar.gz
  • Upload date:
  • Size: 10.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.23.0 requests-toolbelt/0.9.1 tqdm/4.49.0 CPython/3.8.5

File hashes

Hashes for mirabolic-0.0.9.tar.gz
Algorithm Hash digest
SHA256 4c1cb5a9c967cb92321fa540cfe78f4ff13e1253297e84751b305fdd7627229f
MD5 676ab95d369d1c6d719f6fbeacc841d6
BLAKE2b-256 c6d50ac7b879531bc1e1118c209a8c057f9d93c6661afdc5ff9ee4f65a64632d

See more details on using hashes here.

File details

Details for the file mirabolic-0.0.9-py3-none-any.whl.

File metadata

  • Download URL: mirabolic-0.0.9-py3-none-any.whl
  • Upload date:
  • Size: 10.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.23.0 requests-toolbelt/0.9.1 tqdm/4.49.0 CPython/3.8.5

File hashes

Hashes for mirabolic-0.0.9-py3-none-any.whl
Algorithm Hash digest
SHA256 3ebf79368ec7828643658b5974efecec1040584553314db0ddfaca048ece6dfa
MD5 17b2d90aea7e469a7681087f4f93569a
BLAKE2b-256 211d9f905963b3ca2287ed34e350f44d3955a0748cb0d50cf8923e27ee1f23ae

See more details on using hashes here.

Supported by

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