Skip to main content

Key Driver Analysis


Key Driver Analysis also known as Importance Analysis and Relative Importance Analysis. The goal of this analysis is to quantify the relative importance of each of the predictor variables in predicting the target variable. Each of the predictors is commonly referred to as a driver.

For more information on key driver analysis refer to this blog post

Installation


Using pip

PyPi Version

You can install using the pip package manager by running

pip install key-driver-analysis

Alternatively, you could install the latest version directly from Github:

pip install https://github.com/TVS-Motor-Company/key-driver-analysis/key-driver-analysis/archive/master.zip

Using conda

You can install using the conda package manager by running

conda install -c conda-forge key-driver-analysis

From source

Download the source code by cloning the repository or by pressing 'Download ZIP' on this page.

Install by navigating to the proper directory and running:

python setup.py install

Usage


import pandas as pd
import key_driver_analysis as kda

df = pd.DataFrame(data={
        'age': [40, 50, 60, 10, 20, 30, 7, 80, 90],
        'salary': [123, 4423, 56563, 75545, 2345, 2346, 5534, 775, 34345],
        'no_of_cars_owned': [1, 3, 4, 2, 1, 3, 5, 3, 2],
        'no_of_mobiles_purchased': [10, 3, 5, 65, 34, 6, 21, 76, 9]
    })
    print(df)
    target = 'no_of_mobiles_purchased'
    features=set(df.columns.tolist()).difference(set([target]))
    print(f'target --> {target}')
    print(f'features --> {features}')
    rw_df = kda.relative_importance(df,
                                target=target,
                                features=features,
                                verbose=True)
    print(rw_df)
   age  salary  no_of_cars_owned  no_of_mobiles_purchased
0   40     123                 1                       10
1   50    4423                 3                        3
2   60   56563                 4                        5
3   10   75545                 2                       65
4   20    2345                 1                       34
5   30    2346                 3                        6
6    7    5534                 5                       21
7   80     775                 3                       76
8   90   34345                 2                        9
target --> no_of_mobiles_purchased
features --> {'salary', 'no_of_cars_owned', 'age'}
(9, 4)
Dataset size before dropping nulls --> (9, 4)
Dataset size after dropping nulls --> (9, 4)
r2 score --> 0.05963122389990851
            feature  raw_rel_imp  norm_rel_imp
0            salary     0.035140     58.928857
1  no_of_cars_owned     0.019415     32.558853
2               age     0.005076      8.512289

References

Metadata

Release files for key-driver-analysis 0.1.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for key-driver-analysis 0.1.2
File Size Uploaded Provenance Actions
key-driver-analysis-0.1.2.tar.gz 4.0 kB Without provenance Details for key-driver-analysis-0.1.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for key-driver-analysis 0.1.2
File Interpreter ABI Platform Actions
key_driver_analysis-0.1.2-py3-none-any.whl Python 3 none any Details for key_driver_analysis-0.1.2-py3-none-any.whl

Total release size: 8.4 kB

Release files / key-driver-analysis-0.1.2.tar.gz

Download URL key-driver-analysis-0.1.2.tar.gz
Size 4.0 kB
Tags Source
SHA-256 checksum
How to use checksums
bba8448b29b16370b76100da11b28adf472ce2656593d9fdc8e6fc23e579f6ab
BLAKE2b-256 checksum
How to use checksums
6309d7f6e5f017f7415a17e1da07e1c0a4dc170c5b44311943e7a3731518c09d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.8.12

Release files / key_driver_analysis-0.1.2-py3-none-any.whl

Download URL key_driver_analysis-0.1.2-py3-none-any.whl
Size 4.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d8101fda8a385092f6f88858a1eb0a18c8892bd1739e4370bc9e23b9c7e6bfd9
BLAKE2b-256 checksum
How to use checksums
51e856300e5863cfb80e5ccc7a38b78dd054257566b8e3795916f032eae456ed
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.8.12

Security for key-driver-analysis 0.1.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.2 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page