Skip to content

Conversation

@Sakeebhasan123456
Copy link

No description provided.

i did changess in  feature importance and genrate visuaalization ,also add tensorflow
download scikeras  library for using Keras Classifier and keras Regressor
SHAP Calculation for TensorFlow Models:

Modified calculate_shap_values to use shap.DeepExplainer for TensorFlow models.

Handling SHAP Output:

Ensured that the output from shap.DeepExplainer is correctly wrapped in a shap.Explanation object for consistency.
Handling Predictions from TensorFlow Models:

TensorFlow models return predictions differently. For regression, they output continuous values. For classification, they might output probabilities or logits.
We adjust y_pred accordingly, converting probabilities to class labels when necessary.
Model Type Parameter:

Added model_type parameter to indicate whether the model is a TensorFlow or scikit-learn model.
Default is 'sklearn' for backward compatibility.
Classification Handling:

For binary classification, we threshold probabilities at 0.5.
For multi-class classification, we use np.argmax to get class labels.
please install scikeras libarary
Copy link
Owner

@ombhojane ombhojane left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

request change no 1:
image
in utils, there are some functions are missing, that's why CI was failed.

request change no 2:
also create a new file same as main.py, but this time, use tensorflow model imports instead of scikitlearn models we used earlier
in following snippets:
image

here scikit learn models has been used, same you have to use tensorflow models

here's the reference for tensorflow models: https://github.com/tensorflow/models/tree/master/official

@ombhojane
Copy link
Owner

example tf model (neural network models):
model = Sequential([
Dense(256, activation='relu', input_shape=input_shape),
Dropout(0.3),
Dense(128, activation='relu'),
Dropout(0.3),
Dense(64, activation='relu'),
Dropout(0.3),
Dense(32, activation='relu'),
Dense(num_classes, activation='softmax')
])
model.compile(optimizer='adam', loss='sparse_categorical_crossentropy', metrics=['accuracy'])
return model

You may tryout with smaller models.

Note: have the previous scikitlearn support as it is, just in core.py add tensorflow models support, like when user use any tensorflow models in usage it'll be executable

@ombhojane ombhojane mentioned this pull request Oct 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants