Feature selection using XAI
Project description
feature selection
Advanced feature selection using explainable AI
Developed by Yaganteeswarudu Akkem , L Saran Kaanth , Sujith Kumar Reddy
Examples of How To Use Feature selection
Install package by using below syntax
pip install xai-feature-selection==0.3
Consume package by using below syntax
from xai_feature_selection.feature_selection import FeatureSelect
from xai_feature_selection.model_prediction import Model
Currently xai_feature_selection built to work for classification and regression problems
Use below algorithms to test regession
1)LinearRegression
2)RandomForestRegressor
Use below algorithm for classification
1)LogisticRegression
Below is the syntax to retrieve best features after calculating feature importance
file_path: location of csv file in your system
predict_columns : in classification or regression , column which is going to be predicted
model_type_choice : 0 - Regression
1 - Classification
model_choice :
For regression
0 - LinearRegression
1 - RandomForestRegressor
for classification
0 - LogisticRegression
Once all parameters choosen , simply use below syntax to call Model , to calculate LIME and SHAP values and finally Feature select method will return important features
if predict_columns and file_path:
model = Model(
model_type=model_type_choice,
model_choice=model_choice,
data_file_path=file_path,
predict_columns=predict_columns,
)
model.train()
lime_data, shap_data = model.explain()
feature_handler = FeatureSelect(
shap_data=shap_data, lime_data=lime_data
)
feature_handler.prepare_weights()
feature_handler.calculate_feature_values()
feature_handler.get_best_feature_data()
print(feature_handler.get_best_feature_data())
Note :
Its very important if you pass more appropriate pre-processed data ( without null values , outliers and so on ) , you will expect more better features from algorithm
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
Built Distribution
Hashes for xai_feature_selection-0.3.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 546c73edaa9bae8b8b9c46af3b12dac78324043339ac7e3d864e7b4ad1141341 |
|
MD5 | b15e16fb6d338a50157a966bb07b881b |
|
BLAKE2b-256 | 1a57a25b454e185e403164741a17046ee42148e881d307aee296547fcd161cbb |
Hashes for xai_feature_selection-0.3-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ea74155b217eb4f30e9e005e0579384de6e8eb69deca726952c5d1ffbc04972d |
|
MD5 | a699e1109366d85f2882fe872a8cc7de |
|
BLAKE2b-256 | 29c5d18b0fd97ca8f821a2d460777868cf28ff637a3ab0aa47b6c8ce424cd277 |