Key Driver Analysis
Project description
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
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
- RWA Web: A Free, Comprehensive, Web-Based, and User-Friendly Tool for Relative Weight Analyses by Scott Tonidandel and James M. LeBreton
- Relative Importance Analysis: A Useful Supplement to Regression Analysis by Scott Tonidandel and James M. LeBreton
- Determining the Statistical Significance of Relative Weights by Scott Tonidandel et al
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
Built Distribution
File details
Details for the file key-driver-analysis-0.1.2.tar.gz
.
File metadata
- Download URL: key-driver-analysis-0.1.2.tar.gz
- Upload date:
- Size: 4.0 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.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.8.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | bba8448b29b16370b76100da11b28adf472ce2656593d9fdc8e6fc23e579f6ab |
|
MD5 | e6bd48a4244e7db01078de6241185991 |
|
BLAKE2b-256 | 6309d7f6e5f017f7415a17e1da07e1c0a4dc170c5b44311943e7a3731518c09d |
File details
Details for the file key_driver_analysis-0.1.2-py3-none-any.whl
.
File metadata
- Download URL: key_driver_analysis-0.1.2-py3-none-any.whl
- Upload date:
- Size: 4.3 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.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.8.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d8101fda8a385092f6f88858a1eb0a18c8892bd1739e4370bc9e23b9c7e6bfd9 |
|
MD5 | 3796345dca2f80aee24439497d40ad70 |
|
BLAKE2b-256 | 51e856300e5863cfb80e5ccc7a38b78dd054257566b8e3795916f032eae456ed |