Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improved the model accuracy, corrected some problems with kmain.py, added the ablation study, improved README #11

Merged
merged 8 commits into from
Dec 11, 2020

Conversation

thevoxium
Copy link
Contributor

@thevoxium thevoxium commented Dec 6, 2020

I have changed the kmain.py file to include the best working model. It achieved 81.7% accuracy on the test case.

Partially fixes #8.

Copy link
Owner

@americast americast left a comment

Choose a reason for hiding this comment

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

Thanks a lot for the PR @thevoxium! It would be great if you could please outline the changes you have made in brief and update the README with the improved accuracy. Moreover, would it be possible to also provide the model file?

@thevoxium
Copy link
Contributor Author

I used google colab to train the model, using tensorflow backend. theano was not using GPU there. That's why I have not given the model file.

@thevoxium
Copy link
Contributor Author

But I have experimented with 17 model architectures and this one works the best.

@americast
Copy link
Owner

Hi @thevoxium, you may download the model file from colab and send it as a commit here.

It is really great that you experimented with a lot of model architectures. Would you mind placing a table in the README file mentioning this ablation study, with the corresponding accuracy percentages?

@thevoxium
Copy link
Contributor Author

The model was trained with tensorflow backend, will it be compatible with the theano one?

@thevoxium
Copy link
Contributor Author

I will make the required changes in README. Thanks for the suggestion.

@americast
Copy link
Owner

The model was trained with tensorflow backend, will it be compatible with the theano one?

If you are saving the model file with Keras, it should be compatible. Nevertheless, you may send it here and I can help you check that out.

@thevoxium thevoxium marked this pull request as draft December 6, 2020 15:53
Copy link
Owner

@americast americast left a comment

Choose a reason for hiding this comment

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

@thevoxium The README looks awesome! Thanks a lot for the commit. However, it would be great to have a markdown supported table in place of an image. It would help other contributors easily add rows later.

@thevoxium thevoxium changed the title Improved the model accuracy, changed the kmain.py file, using another branch Improved the model accuracy, corrected some problems with kmain.py, added the ablation study, improved README Dec 8, 2020
@thevoxium thevoxium marked this pull request as ready for review December 8, 2020 06:35
@thevoxium
Copy link
Contributor Author

thevoxium commented Dec 8, 2020

1. Changed the model architecture

  • Added dense layers, increased training accuracy.
  • Added Regularization to increase test accuracy to 81.78%.

2. Explained the code of kmain.py in the README file.

3. Explained implementation of LRP.

4. Added the ablation study table describing various architectures, train accuracy, and test accuracy.

5. Added the best model file.

Copy link
Owner

@americast americast left a comment

Choose a reason for hiding this comment

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

Awesome @thevoxium! Great job 😄

Some quick fixes I would like to suggest here. In https://github.com/thevoxium/algo_bias/blob/branch_2/kmain.py#L84 it would be great if you can update it with the latest model file name. Same at https://github.com/thevoxium/algo_bias/blob/branch_2/kmain.py#L122. Accordingly, it would be nice to have the model file placed inside the checkpoints/ directory. Other than that, everything else looks fine to me.

README.md Outdated Show resolved Hide resolved
Copy link
Owner

@americast americast left a comment

Choose a reason for hiding this comment

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

Looks great!

README.md Outdated

Next, we ask user for the choice to load previous saved model. Depending on which we load the model or train from beginning. We then ask user the choice to train or test. Depending on the selection, we load a csv file containing data to train or test. We then seperate attributes with target values, namely x_train and y_train. We then compile the model using Adam optimizer and Categorical Crossentropy as loss function. We use Keras' checkpoints to define early stopping (for training) if accuracy does not improve after certain epochs. Then depending on the user choice we train or test the model. If we train the model, then the best performing weights are saved to use them to load the model next time.

If the user chose to test, we print the model accuracy on the test data. Next we do LRP, Layer-wise Relevance Propagation is a method for understanding deep neural networks by running a backward pass to observe how the individual layers of the program work. This technique brings brings explainability to Deep Neural Networks. More information on LRP is given [here](https://link.springer.com/chapter/10.1007/978-3-030-28954-6_10).
Copy link
Collaborator

Choose a reason for hiding this comment

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

Change the line to; Next, we do LRP(Layer-wise Relevance Propagation) which is a....

README.md Outdated
# then we pass model inputs, that is x_train
analysis = analyzer.analyze(x_train)
```
Then we perform the layer wise layer analysis by blocking off the layers and then performing analysis on them.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Change it to -> layer wise analysis....

Copy link
Collaborator

@rakeshbal99 rakeshbal99 left a comment

Choose a reason for hiding this comment

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

PR looks awesome. Great job! Just fix the README.md according to the two comments.

@thevoxium
Copy link
Contributor Author

PR looks awesome. Great job! Just fix the README.md according to the two comments.

I have made the required final changes in the README. Please, review and merge the PR.

@americast
Copy link
Owner

I am unable to reproduce some of the results. Hence, it would be good to have a fixed random seed for all the experiments as outlined in #12.

@americast americast merged commit 42d4018 into americast:master Dec 11, 2020
@americast
Copy link
Owner

This PR also fixes #9.

@thevoxium
Copy link
Contributor Author

Can using different backends affect this? Like using tensorflow instead of theano?

@americast americast mentioned this pull request Dec 11, 2020
@americast
Copy link
Owner

If we have all the possible randomly initialised parameter consistent across experiments, ideally there should not be any difference.

@thevoxium
Copy link
Contributor Author

I will work on this after issue #6. Thanks for the review.

@thevoxium thevoxium deleted the branch_2 branch December 12, 2020 04:54
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.

Improve accuracy of the trained model
3 participants