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

model_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.

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

Uploaded Python 3

File details

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

File metadata

  • Download URL: model_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 model_measure-0.0.1.tar.gz
Algorithm Hash digest
SHA256 8c80a50e2faf4873ec34ab7d4c0044dcdc88eaf436498eb6968a670931ad43a9
MD5 d9168df849c895ca88db933b15162d91
BLAKE2b-256 18363c7482b29c48c75cfbdd53c910ef2579aea3277cc9f5a917369fc5f3ee1a

See more details on using hashes here.

File details

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

File metadata

  • Download URL: model_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 model_measure-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 071dc668f45151b98310a4623b6b2e03d0f0158f6e844d66fc3b00f583dc93cf
MD5 c8da875312f0fa23fe024110b609ed48
BLAKE2b-256 3a8ab1604b0279b04c65545bb8455542012dfb93c75fa82e21bae43a13dd6cea

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