Skip to main content

Machine learning model measurement

Project description

Author: Dhivya Nagasubramanian

Purpose:

The purpose of this package is to provide an efficient method for calculating and analyzing cumulative event rates, cumulative non-event rates, and the Kolmogorov-Smirnov (KS) statistic in datasets. It is particularly useful for evaluating the performance of predictive models in fields like credit scoring, risk analysis, and marketing campaigns, where distinguishing between "events" (e.g., defaults, purchases, etc.) and "non-events" is essential.

This package automates the following key calculations:

Cumulative Event and Non-Event Rates: It computes cumulative event and non-event rates over time or samples. These rates are critical for evaluating the predictive model's ability to distinguish between events and non-events.

Cumulative Random Rate: It tracks the cumulative rate of random events, allowing for comparison between actual events and a random baseline.

Kolmogorov-Smirnov (KS) Statistic: The package computes the KS statistic, which measures the maximum difference between the cumulative event rate and the cumulative non-event rate. This statistic is a key indicator of model discrimination, with higher values indicating better model performance.

Lift: The Lift metric measures the improvement in predictive accuracy over random selection. It quantifies how much more likely an event is to occur in a given segment of a population compared to the average likelihood across the entire population. Lift is crucial for evaluating the effectiveness of predictive models in targeting high-probability events.

Population Stability Index (PSI): PSI is a tool to monitor the stability of model distributions over time or between different segments. It quantifies shifts in the distribution of a target variable (e.g., predicted probabilities) between different time periods or groups, helping analysts assess whether the model remains relevant or if recalibration is necessary.

---------------------------------------------------------------------------------------------------------------------------------------------

Requirements packages:

NumPy - Adds support for large, multi-dimensional arrays, matrices and high-level mathematical functions to operate on these arrays.
random - generate random numbers with in the set limits.
pandas - Dataframe utility.

---------------------------------------------------------------------------------------------------------------------------------------------

Installation Instructions:

pip install model-measure

---------------------------------------------------------------------------------------------------------------------------------------------
How to use it :

There are two main functions of this framework.

1. generate_propensity_score_dataset()

2. marketing_measure(data,prob,ID,target, i_percent,bins)

---------------------------------------------------------------------------------------------------------------------------------------------

How to test the package with out data ?

Step1 - Run with "generate_propensity_score_dataset"

eg: df_example = generate_random_data().

Step2 - Run marketing_measure(data,prob,ID,target, i_percent,bins)

eg: dfresult = marketing_measure(data,propensity_score,customer_id,target, 0.1,10)

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

maodel_measure-0.0.1.tar.gz (3.4 kB view details)

Uploaded Source

Built Distribution

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

maodel_measure-0.0.1-py3-none-any.whl (3.7 kB view details)

Uploaded Python 3

File details

Details for the file maodel_measure-0.0.1.tar.gz.

File metadata

  • Download URL: maodel_measure-0.0.1.tar.gz
  • Upload date:
  • Size: 3.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for maodel_measure-0.0.1.tar.gz
Algorithm Hash digest
SHA256 2f626193ba97e6a3685da679bc2568286d123922eb5c3f42536303330955aba3
MD5 f0a5da888d9fbde52717729203aae889
BLAKE2b-256 c7a490d21be62acdb2e944e457cc0e699728999bfe96db2f57d4948ab51e4958

See more details on using hashes here.

File details

Details for the file maodel_measure-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: maodel_measure-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 3.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for maodel_measure-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 b5064ce9db9ac6d325aaf23cca6ab7036253fc1a510ac25ca254c53f59681ab5
MD5 2f849d3ad97e1737021eaf75e007acc1
BLAKE2b-256 770f28ad0a059f99ef8288c85a05c465aa19e2e86e0cef3aabccc83d9b4e68a1

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