Logic Error Detection Algorithm Based on RNN with Threshold Selection

Author(s):  
Taku Matsumoto ◽  
Yutaka Watanobe ◽  
Keita Nakamura ◽  
Yunosuke Teshima

Logical errors in source code can be detected by probabilities obtained from a language model trained by the recurrent neural network (RNN). Using the probabilities and determining thresholds, places that are likely to be logic errors can be enumerated. However, when the threshold is set inappropriately, user may miss true logical errors because of passive extraction or unnecessary elements obtained from excessive extraction. Moreover, the probabilities of output from the language model are different for each task, so the threshold should be selected properly. In this paper, we propose a logic error detection algorithm using an RNN and an automatic threshold determination method. The proposed method selects thresholds using incorrect codes and can enhance the detection performance of the trained language model. For evaluating the proposed method, experiments with data from an online judge system, which is one of the educational systems that provide the automated judge for many programming tasks, are conducted. The experimental results show that the selected thresholds can be used to improve the logic error detection performance of the trained language model.

Symmetry ◽  
2021 ◽  
Vol 13 (2) ◽  
pp. 247
Author(s):  
Md. Mostafizer Rahman ◽  
Yutaka Watanobe ◽  
Keita Nakamura

Programming is a vital skill in computer science and engineering-related disciplines. However, developing source code is an error-prone task. Logical errors in code are particularly hard to identify for both students and professionals, and a single error is unexpected to end-users. At present, conventional compilers have difficulty identifying many of the errors (especially logical errors) that can occur in code. To mitigate this problem, we propose a language model for evaluating source codes using a bidirectional long short-term memory (BiLSTM) neural network. We trained the BiLSTM model with a large number of source codes with tuning various hyperparameters. We then used the model to evaluate incorrect code and assessed the model’s performance in three principal areas: source code error detection, suggestions for incorrect code repair, and erroneous code classification. Experimental results showed that the proposed BiLSTM model achieved 50.88% correctness in identifying errors and providing suggestions. Moreover, the model achieved an F-score of approximately 97%, outperforming other state-of-the-art models (recurrent neural networks (RNNs) and long short-term memory (LSTM)).


2019 ◽  
Vol 55 ◽  
pp. 187-199 ◽  
Author(s):  
Rahhal Errattahi ◽  
Asmaa EL Hannani ◽  
Thomas Hain ◽  
Hassan Ouahmane

2015 ◽  
Author(s):  
Tsuyoshi Morioka ◽  
Tomoharu Iwata ◽  
Takaaki Hori ◽  
Tetsunori Kobayashi

Sign in / Sign up

Export Citation Format

Share Document