Abstract
Over the years, programmers have improved their programming skills and can now write code in many different languages to solve problems. A lot of new code is being generated all over the world regularly. Since a programming problem can be solved in many different languages, it is quite difficult to identify the problem from the written source code. Therefore, a classification model is needed to help programmers identify the problems built (written/developed) in Multi-Programming Languages (MPLs). This classification model can help programmers learn better programming. However, source code classification models based on deep learning are still lacking in the field of programming education and software engineering. To address this gap, we propose a stacked Bidirectional Long Short-Term Memory (Bi-LSTM) neural network-based model for classifying source codes developed in MPLs. To accomplish this research, we collect a large number of real-world source codes from the Aizu Online Judge (AOJ) system. The proposed model is trained, validated, and tested on the AOJ dataset. Various hyperparameters are fine-tuned to improve the performance of the model. Based on the experimental results, the proposed model achieves an accuracy of about 93% and an F1-score of 89.24%. Moreover, the proposed model outperforms the state-of-the-art models in terms of other evaluation matrices such as precision (90.12%) and recall (89.48%).
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
Similar content being viewed by others
References
Dam, H.K., Tran, T., Pham, T.: A deep language model for software code, ArXiv abs/1608.02715 (2016)
Gilda, S.: Source code classification using neural networks. In: 2017 14th International Joint Conference on Computer Science and Software Engineering (JCSSE), pp. 1–6 (2017)
Ohashi, H., Watanobe, Y.: Convolutional neural network for classification of source codes. In: 2019 IEEE 13th International Symposium on Embedded Multicore/Many-Core Systems-on-Chip (MCSoC), pp. 194–200 (2019)
Rahman, M.M., Watanobe, Y., Nakamura, K.: A bidirectional LSTM language model for code evaluation and repair. Symmetry 13(2), 247 (2021)
Rahman, M.M., Watanobe, Y., Nakamura, K.: Source code assessment and classification based on estimated error probability using attentive LSTM language model and its application in programming education. Appl. Sci. 10(8), 2973 (2020)
Rahman, M.M., Watanobe, Y., Nakamura, K.: A neural network based intelligent support model for program code completion. Sci. Program. 2020, 1–18 (2020)
Attia, M., Samih, Y., Elkahky, A., Kallmeyer, L.: Multilingual multi-class sentiment classification using convolutional neural networks. In: The Proceedings of the Eleventh International Conference on Language Resources and Evaluation (LREC 2018), Miyazaki, Japan (2018)
Mutuvi, S., Boros, E., Doucet, A., Jatowt, A., Lejeune, G., Odeo, M.: Multilingual epidemiological text classification: a comparative study. In: The Proceedings of the 28th International Conference on Computational Linguistics, Barcelona, Spain (2020)
Hameed, Z., Garcia-Zapirain, B.: Sentiment classification using a single-layered BiLSTM model. IEEE Access 8, 73992–74001 (2020)
Larkey, L. S., Croft, W. B.: Combining classifiers in text categorization. In: Proceedings of the 19th Annual International ACM SIGIR Conference on Research and Development in Information Retrieval, ser. SIGIR 1996, Zurich, Switzerland, pp. 289–297. ACM (1996)
Lewis, D.D., Gale, W.A.: A sequential algorithm for training text classifiers. In: Croft, B.W., van Rijsbergen, C.J. (eds.) Proceedings of the 17th Annual International ACM SIGIR Conference on Research and Development in Information Retrieval, ser. SIGIR 1994, Dublin, Ireland, pp. 3–12. Springer, New York (1994). https://doi.org/10.1007/978-1-4471-2099-5_1
Ugurel, S., Krovetz, R., Giles, C. L.: What’s the code? Automatic classification of source code archives. In: Proceedings of the Eighth ACM SIGKDD International Conference on Knowledge Discovery and Data Mining, ser. KDD 2002, Edmonton, Alberta, Canada, pp. 632–638. ACM (2002)
Reyes, J., RamÃrez, D., Paciello, J.: Automatic classification of source code archives by programming language: a deep learning approach. In: 2016 International Conference on Computational Science and Computational Intelligence (CSCI), pp. 514–519 (2016)
Schuster, M., Paliwal, K.K.: Bidirectional recurrent neural networks. IEEE Trans. Signal Process. 45(11), 2673–2681 (1997)
Cui, Z., Ke, R., Pu, Z., Wang, Y.: Stacked bidirectional and unidirectional LSTM recurrent neural network for forecasting network-wide traffic state with missing values. arXiv:2005.11627 (2020)
Hermans, M., Schrauwen, B.: Training and analyzing deep recurrent neural networks. In: Proceedings of the 26th International Conference on Neural Information Processing Systems (NIPS 2013), vol. 1, pp. 190–198. Curran Associates Inc., Red Hook, NY, USA (2013)
Watanobe, Y.: Aizu online judge [Online] (2018). https://onlinejudge.u-aizu.ac
Aizu online judge: Developers site (API) [Online]. http://developers.u-aizu.ac.jp/index
Intisar, C. M., Watanobe, Y., Poudel, M., Bhalla, S.: Classification of programming problems based on topic modeling. In Proceedings of the 2019 7th International Conference on Information and Education Technology (ICIET 2019). Association for Computing Machinery, New York, NY, USA, pp. 275–283 (2019)
International Business Machines (IBM): Project CodeNet (2021). https://github.com/IBM/Project_CodeNet
Loper, E., Bird, S.: NLTK: the natural language toolkit. In: Proceedings of ACL Workshop Effective Tools Methodologies Teaching Natural Languages Processing and Computational Linguistics, Philadelphia, PA, USA, pp. 1–8 (2002)
Goodfellow, I., Bengio, Y., Courville, A.: Deep Learning. MIT Press, Cambridge (2016)
Szandała, T.: Review and comparison of commonly used activation functions for deep neural networks. In: Bhoi, A., Mallick, P., Liu, C.M., Balas, V. (eds.) Bio-inspired Neurocomputing. Studies in Computational Intelligence, vol. 903. Springer, Singapore (2021). https://doi.org/10.1007/978-981-15-5495-7_11
Acknowledgement
This research was supported by the Japan Society for the Promotion of Science (JSPS) under KAKENHI (Grant Number 19K12252).
Author information
Authors and Affiliations
Corresponding author
Editor information
Editors and Affiliations
Ethics declarations
The authors declare that they have no conflict of interests.
Rights and permissions
Copyright information
© 2021 Springer Nature Switzerland AG
About this paper
Cite this paper
Rahman, M.M., Watanobe, Y., Kiran, R.U., Kabir, R. (2021). A Stacked Bidirectional LSTM Model for Classifying Source Codes Built in MPLs. In: Kamp, M., et al. Machine Learning and Principles and Practice of Knowledge Discovery in Databases. ECML PKDD 2021. Communications in Computer and Information Science, vol 1525. Springer, Cham. https://doi.org/10.1007/978-3-030-93733-1_5
Download citation
DOI: https://doi.org/10.1007/978-3-030-93733-1_5
Published:
Publisher Name: Springer, Cham
Print ISBN: 978-3-030-93732-4
Online ISBN: 978-3-030-93733-1
eBook Packages: Computer ScienceComputer Science (R0)