<!DOCTYPE article PUBLIC "-//NLM//DTD JATS (Z39.96) Journal Archiving and Interchange DTD v1.0 20120330//EN" "JATS-archivearticle1.dtd">
<article xmlns:xlink="http://www.w3.org/1999/xlink">
  <front>
    <journal-meta>
      <issn pub-type="ppub">1613-0073</issn>
    </journal-meta>
    <article-meta>
      <title-group>
        <article-title>Assessing the Utility of C Com ments with SVM and Naïve Bayes Classifier</article-title>
      </title-group>
      <contrib-group>
        <contrib contrib-type="author">
          <string-name>Aritra Mitra</string-name>
          <email>aritramitra2002@gmail.com</email>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <contrib contrib-type="editor">
          <string-name>Machine Learning, Natural Language Processing, SVM, Naïve Bayes Classifier</string-name>
        </contrib>
        <aff id="aff0">
          <label>0</label>
          <institution>Indian Institute of Technology</institution>
          ,
          <addr-line>Kharagpur (IIT-KGP), West Bengal-721302</addr-line>
          ,
          <country country="IN">India</country>
        </aff>
      </contrib-group>
      <abstract>
        <p>Comments are very useful to the flow of code development. With the increasing use of code in commonplace life, commenting the codes becomes a hassle for rookie coders, and often they do not even think commenting as a part of the development process. This in general causes the quality of comments to degrade, and a considerable amount of useless comments are found in such codes. In these experiments, the usefulness of C comments are evaluated using Support Vector Machine (SVM) and Naïve Bayes Classifier. The results of the experiments create a baseline for better results that can be found in the future through more research. Based on these findings, more complex and intricate machine learning models can be created that can improve the accuracy achieved in performing said task.</p>
      </abstract>
    </article-meta>
  </front>
  <body>
    <sec id="sec-1">
      <title>-</title>
      <p>CEUR
ceur-ws.org</p>
    </sec>
    <sec id="sec-2">
      <title>1. Introduction</title>
      <p>
        Comments play an essential role in code development [
        <xref ref-type="bibr" rid="ref1">1</xref>
        ], consuming a significant amount of
time to enhance code readability [
        <xref ref-type="bibr" rid="ref2">2</xref>
        ]. However, not all comments contribute to this objective.
As coding becomes more commonplace, novice programmers tend to overlook the art of
commenting, leading to a deterioration in both the quality and quantity of comments [
        <xref ref-type="bibr" rid="ref3">3</xref>
        ]. Many
comments turn out to be unproductive, and sifting through lengthy comments only to discover
their futility can be frustrating and time-consuming.
      </p>
      <p>
        Various deep learning-based automatic commenting models can boost the quantity of
comments [
        <xref ref-type="bibr" rid="ref4">4</xref>
        ]. Regrettably, there has been insuficient research dedicated to addressing the issue of
comment quality. Nevertheless, recent eforts are addressing these challenges by developing
machine learning models capable of identifying and categorizing comments based on their
usefulness.
      </p>
      <p>
        The author has explored a range of Machine Learning (ML) models in pursuit of solutions to
this problem. This paper aims to answer critical questions as part of the Information Retrieval
in Software Engineering (IRSE) shared task at the Forum for Information Retrieval Evaluation
(FIRE) 2022 [
        <xref ref-type="bibr" rid="ref5">5</xref>
        ], conducted under the team name FaultySegment:
https://cse.iitkgp.ac.in/~aritra.mitra/ (A. Mitra)
CEUR
Workshop
Proceedings
      </p>
      <p>© 2023 Copyright for this paper by its authors. Use permitted under Creative Commons License Attribution 4.0 International (CC BY 4.0).
• What level of complexity is necessary for a Machine Learning model to reliably distinguish
useful comments from useless ones?
• How do well-known general-purpose models like SVM and Naïve Bayes Classifier perform
in this context, even if they are not built for this particular scenario?</p>
      <p>This paper aims to demonstrate that models such as SVM or Naïve Bayes Classifier can serve
as efective starting points for tackling this problem. More complex models can be built upon
these foundations, while also considering the risk of overfitting.</p>
      <p>In addition to the aforementioned objectives, this paper also addresses the crucial question
of whether the dataset for the learning task can be augmented with data generated by large
language models, such as GPT-3. This consideration plays a pivotal role in exploring the
potential of leveraging artificial intelligence for improving comment quality assessment. By
evaluating the impact of augmenting the dataset with AI-generated data, the study aims to shed
light on the benefits and challenges of integrating advanced language models into the machine
learning pipeline. This inquiry represents a significant aspect of the research, emphasizing the
intersection of human-written and AI-generated content in the context of comment quality
evaluation.</p>
    </sec>
    <sec id="sec-3">
      <title>2. Related Work</title>
      <p>
        Software metadata [
        <xref ref-type="bibr" rid="ref6">6</xref>
        ] plays a crucial role in the maintenance of code and its subsequent
understanding. Numerous tools have been developed to assist in extracting knowledge from
software metadata, which includes runtime traces and structural attributes of code [
        <xref ref-type="bibr" rid="ref10 ref7 ref8 ref9">7, 8, 9, 10,
11, 12, 13, 14, 15</xref>
        ].
      </p>
      <p>In the realm of mining code comments and assessing their quality, several authors have
conducted research. Steidl et al. [16] employ techniques such as Levenshtein distance and
comment length to gauge the similarity of words in code-comment pairs, efectively filtering
out trivial and non-informative comments. Rahman et al. [17] focus on distinguishing useful
from non-useful code review comments within review portals, drawing insights from attributes
identified in a survey conducted with Microsoft developers [ 18]. Majumdar et al. [19, 20, 21, 22]
have introduced a framework for evaluating comments based on concepts crucial for code
comprehension. Their approach involves the development of textual and code correlation
features, utilizing a knowledge graph to semantically interpret the information within comments.
These approaches employ both semantic and structural features to address the prediction
problem of distinguishing useful from non-useful comments, ultimately contributing to the
process of decluttering codebases</p>
      <p>
        In light of the emergence of large language models, such as GPT-3.5 or llama [23], it becomes
crucial to assess the quality of code comments and compare them to human interpretation. The
IRSE track at FIRE 2023 [
        <xref ref-type="bibr" rid="ref5">5</xref>
        ] expands upon the approach presented in a prior work [19]. It delves
into the exploration of various vector space models [24] and features for binary classification
and evaluation of comments, specifically in the context of their role in comprehending code.
Furthermore, this track conducts a comparative analysis of the prediction model’s performance
when GPT-generated labels for code and comment quality, extracted from open-source software,
are included.
      </p>
    </sec>
    <sec id="sec-4">
      <title>3. Task and Dataset Description</title>
      <p>In this section, a description of the task at hand and the dataset provided are given. The task at
IRSE, FIRE 2023 was as follows: A binary code comment quality classification model needs to be
augmented with generated code and comment pairs that can improve the accuracy of the model.
The corresponding dataset was split into two:
• The training dataset with 8048 entries, and
• The testing dataset with 1000 entries.</p>
      <p>The training dataset was shufled, and split into 70% for training the models, and 30% for
cross-validation. The data was labelled as follows:
• Useful: Comments that are useful for code comprehension
• Not Useful: Comments that are not useful for code comprehension</p>
    </sec>
    <sec id="sec-5">
      <title>4. Augmentation</title>
      <p>The dataset augmentation process involved the integration of data generated by GPT-3, a
powerful language model, to enrich the existing dataset. By leveraging GPT-3’s natural language
generation capabilities, additional comment data was created to expand the diversity and scale
of the dataset. This augmentation strategy aimed to introduce a broader spectrum of comments,
encompassing a wide range of writing styles, structures, and content. The incorporation of
GPT-3 generated data was carried out to assess its potential in enhancing the training of machine
learning models for comment quality evaluation. This approach allowed for the exploration
of how AI-generated content could complement human-written data, contributing to a more
comprehensive and robust dataset for improved model performance.</p>
    </sec>
    <sec id="sec-6">
      <title>5. System Description</title>
      <sec id="sec-6-1">
        <title>5.1. Text Preprocessing</title>
        <p>All the links, punctuations, numbers and stop words have been removed. Then all words which
have a POS tag other than Noun, Verb, Adverb and Adjective are removed. Lemmatization is
used for grouping together the diferent forms of a word into a single word. NLTK wordnet
[25] is used for lemmatization. Both training and testing datasets use same preprocessing steps.</p>
      </sec>
      <sec id="sec-6-2">
        <title>5.2. Feature Extraction</title>
        <p>TfidfVectorizer [ 26] is used for converting the text into numerical features. Tokenizer by Keras
[27] library is used, along with TfidfVectorizer that was used from SciKit-Learn library.</p>
      </sec>
      <sec id="sec-6-3">
        <title>5.3. Machine Learning Models</title>
        <p>Two runs have been submitted for the task: one using Support Vector Machine (SVM) model,
and another with Naïve Bayes classifer model. We have used the SciKit-Learn library for both
of the models, with the parameters for the SVM model as follows:
• C: (regularization parameter) = 1
• kernel: (kernel type) = ’linear’</p>
      </sec>
    </sec>
    <sec id="sec-7">
      <title>6. Findings</title>
      <sec id="sec-7-1">
        <title>6.1. Without Augmentations</title>
        <p>With these parameters set for the SVM model, the validation set gives a 77.26708074534162%
accuracy score, along with an F1 score of 0.786464410735123.</p>
        <p>Also, with the Naïve Bayes Classifier, the validation set gives a 60.993788819875775% accuracy
score, along with an F1 score of 0.699233716475096.</p>
      </sec>
      <sec id="sec-7-2">
        <title>6.2. With Augmentation</title>
        <p>With these parameters set for the SVM model, the validation set gives a 77.64842840512223%
accuracy score, along with an F1 score of 0.7830939828521743.</p>
        <p>Also, with the Naïve Bayes Classifier, the validation set gives a 64.0279394644936% accuracy
score, along with an F1 score of 0.695431994330003.</p>
      </sec>
    </sec>
    <sec id="sec-8">
      <title>7. Conclusion</title>
      <p>The tasks were accomplished employing basic machine learning models like SVM and the Naïve
Bayes Classifier. The outcomes obtained from the SVM classifier indicate that there is room
for enhancement, enabling the development of more intricate models that align better with
the problem statement and yield superior results. Notably, Srijoni Majumdar et al. [28] have
already achieved superior results using neural networks, and the author anticipates continuous
improvement in these results over time.</p>
    </sec>
    <sec id="sec-9">
      <title>Acknowledgments</title>
      <p>Thanks to the creators of IRSE FIRE for giving this wonderful opportunity to work on such a
project, and their constant technical support throughout the timespan.
from multi-threaded applications using pin, in: 2016 IEEE International Conference on
Software Quality, Reliability and Security (QRS), IEEE, 2016, pp. 25–32.
[11] S. Majumdar, N. Chatterjee, P. P. Das, A. Chakrabarti, A mathematical framework for design
discovery from multi-threaded applications using neural sequence solvers, Innovations in
Systems and Software Engineering 17 (2021) 289–307.
[12] S. Majumdar, N. Chatterjee, P. Pratim Das, A. Chakrabarti, Dcube_ nn d cube nn: Tool
for dynamic design discovery from multi-threaded applications using neural sequence
models, Advanced Computing and Systems for Security: Volume 14 (2021) 75–92.
[13] J. Siegmund, N. Peitek, C. Parnin, S. Apel, J. Hofmeister, C. Kästner, A. Begel, A. Bethmann,
A. Brechmann, Measuring neural eficiency of program comprehension, in: Proceedings
of the 2017 11th Joint Meeting on Foundations of Software Engineering, 2017, pp. 140–150.
[14] Y. Wang, H. Le, A. D. Gotmare, N. D. Bui, J. Li, S. C. Hoi, Codet5+: Open code large
language models for code understanding and generation, arXiv preprint arXiv:2305.07922
(2023).
[15] J. L. Freitas, D. da Cruz, P. R. Henriques, A comment analysis approach for program
comprehension, Annual Software Engineering Workshop (SEW), IEEE, 2012, pp. 11–20.
[16] D. Steidl, B. Hummel, E. Juergens, Quality analysis of source code comments, International</p>
      <p>Conference on Program Comprehension (ICPC), IEEE, 2013, pp. 83–92.
[17] M. M. Rahman, C. K. Roy, R. G. Kula, Predicting usefulness of code review comments using
textual features and developer experience, International Conference on Mining Software
Repositories (MSR), IEEE, 2017, pp. 215–226.
[18] A. Bosu, M. Greiler, C. Bird, Characteristics of useful code reviews: An empirical study at
microsoft, Working Conference on Mining Software Repositories, IEEE, 2015, pp. 146–156.
[19] S. Majumdar, A. Bansal, P. P. Das, P. D. Clough, K. Datta, S. K. Ghosh, Automated evaluation
of comments to aid software maintenance, Journal of Software: Evolution and Process 34
(2022) e2463.
[20] S. Majumdar, S. Papdeja, P. P. Das, S. K. Ghosh, Comment-mine—a semantic search
approach to program comprehension from code comments, in: Advanced Computing and
Systems for Security, Springer, 2020, pp. 29–42.
[21] S. Majumdar, A. Bandyopadhyay, S. Chattopadhyay, P. P. Das, P. D. Clough, P. Majumder,
Overview of the irse track at fire 2022: Information retrieval in software engineering, in:
Forum for Information Retrieval Evaluation, ACM, 2022.
[22] S. Majumdar, A. Bandyopadhyay, P. P. Das, P. Clough, S. Chattopadhyay, P. Majumder,
Can we predict useful comments in source codes?-analysis of findings from information
retrieval in software engineering track@ fire 2022, in: Proceedings of the 14th Annual
Meeting of the Forum for Information Retrieval Evaluation, 2022, pp. 15–17.
[23] T. Brown, B. Mann, N. Ryder, M. Subbiah, J. D. Kaplan, P. Dhariwal, A. Neelakantan,
P. Shyam, G. Sastry, A. Askell, et al., Language models are few-shot learners, Advances in
neural information processing systems 33 (2020) 1877–1901.
[24] S. Majumdar, A. Varshney, P. P. Das, P. D. Clough, S. Chattopadhyay, An efective
lowdimensional software code representation using bert and elmo, in: 2022 IEEE 22nd
International Conference on Software Quality, Reliability and Security (QRS), IEEE, 2022,
pp. 763–774.
[25] E. Loper, S. Bird, Nltk: The natural language toolkit, 2002. URL: https://arxiv.org/abs/cs/
0205028. doi:10.48550/ARXIV.CS/0205028.
[26] V. Kumar, B. Subba, A tfidfvectorizer and svm based sentiment analysis framework for
text data corpus, in: 2020 National Conference on Communications (NCC), 2020, pp. 1–6.
doi:10.1109/NCC48643.2020.9056085.
[27] N. Ketkar, Introduction to Keras, 2017, pp. 95–109. doi:10.1007/978-1-4842-2766-4_7.
[28] S. Majumdar, A. Bansal, P. P. Das, P. D. Clough, K. Datta, S. K. Ghosh,
Automated evaluation of comments to aid software maintenance, Journal of
Software: Evolution and Process 34 (2022) e2463. URL: https://onlinelibrary.
wiley.com/doi/abs/10.1002/smr.2463. doi:https://doi.org/10.1002/smr.2463.
arXiv:https://onlinelibrary.wiley.com/doi/pdf/10.1002/smr.2463.</p>
    </sec>
  </body>
  <back>
    <ref-list>
      <ref id="ref1">
        <mixed-citation>
          [1]
          <string-name>
            <given-names>B.</given-names>
            <surname>Fluri</surname>
          </string-name>
          ,
          <string-name>
            <given-names>M.</given-names>
            <surname>Würsch</surname>
          </string-name>
          ,
          <string-name>
            <given-names>H.</given-names>
            <surname>Gall</surname>
          </string-name>
          ,
          <article-title>Do code and comments co-evolve? on the relation between source code and comment changes</article-title>
          ,
          <year>2007</year>
          , pp.
          <fpage>70</fpage>
          -
          <lpage>79</lpage>
          . doi:
          <volume>10</volume>
          .1109/WCRE.
          <year>2007</year>
          .
          <volume>21</volume>
          .
        </mixed-citation>
      </ref>
      <ref id="ref2">
        <mixed-citation>
          [2]
          <string-name>
            <given-names>M.</given-names>
            <surname>Kajko-Mattsson</surname>
          </string-name>
          ,
          <article-title>A survey of documentation practice within corrective maintenance</article-title>
          ,
          <source>Empirical Software Engineering</source>
          <volume>10</volume>
          (
          <year>2005</year>
          )
          <fpage>31</fpage>
          -
          <lpage>55</lpage>
          . URL: https://doi.org/10.1023/B:LIDA.
          <volume>0000048322</volume>
          .42751.ca. doi:
          <volume>10</volume>
          .1023/B:LIDA.
          <volume>0000048322</volume>
          .42751.ca.
        </mixed-citation>
      </ref>
      <ref id="ref3">
        <mixed-citation>
          [3]
          <string-name>
            <given-names>J.</given-names>
            <surname>Raskin</surname>
          </string-name>
          ,
          <article-title>Comments are more important than code</article-title>
          ,
          <source>ACM Queue 3</source>
          (
          <year>2005</year>
          )
          <fpage>64</fpage>
          -.
          <source>doi:10. 1145/1053331</source>
          .1053354.
        </mixed-citation>
      </ref>
      <ref id="ref4">
        <mixed-citation>
          [4]
          <string-name>
            <given-names>E.</given-names>
            <surname>Wong</surname>
          </string-name>
          ,
          <string-name>
            <given-names>J.</given-names>
            <surname>Yang</surname>
          </string-name>
          ,
          <string-name>
            <given-names>L.</given-names>
            <surname>Tan</surname>
          </string-name>
          ,
          <article-title>Autocomment: Mining question and answer sites for automatic comment generation</article-title>
          ,
          <source>in: 2013 28th IEEE/ACM International Conference on Automated Software Engineering (ASE)</source>
          ,
          <year>2013</year>
          , pp.
          <fpage>562</fpage>
          -
          <lpage>567</lpage>
          . doi:
          <volume>10</volume>
          .1109/ASE.
          <year>2013</year>
          .
          <volume>6693113</volume>
          .
        </mixed-citation>
      </ref>
      <ref id="ref5">
        <mixed-citation>
          [5]
          <string-name>
            <given-names>S.</given-names>
            <surname>Majumdar</surname>
          </string-name>
          ,
          <string-name>
            <given-names>S.</given-names>
            <surname>Paul</surname>
          </string-name>
          ,
          <string-name>
            <given-names>D.</given-names>
            <surname>Paul</surname>
          </string-name>
          ,
          <string-name>
            <given-names>A.</given-names>
            <surname>Bandyopadhyay</surname>
          </string-name>
          ,
          <string-name>
            <given-names>B.</given-names>
            <surname>Dave</surname>
          </string-name>
          ,
          <string-name>
            <given-names>S.</given-names>
            <surname>Chattopadhyay</surname>
          </string-name>
          ,
          <string-name>
            <surname>P. P. Das</surname>
            ,
            <given-names>P. D.</given-names>
          </string-name>
          <string-name>
            <surname>Clough</surname>
            ,
            <given-names>P.</given-names>
          </string-name>
          <string-name>
            <surname>Majumder</surname>
          </string-name>
          ,
          <article-title>Generative ai for software metadata: Overview of the information retrieval in software engineering track at fire 2023, in: Forum for Information Retrieval Evaluation</article-title>
          ,
          <string-name>
            <surname>ACM</surname>
          </string-name>
          ,
          <year>2023</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref6">
        <mixed-citation>
          [6]
          <string-name>
            <given-names>S.</given-names>
            <surname>C. B. de Souza</surname>
          </string-name>
          ,
          <string-name>
            <given-names>N.</given-names>
            <surname>Anquetil</surname>
          </string-name>
          ,
          <string-name>
            <surname>K. M. de Oliveira</surname>
          </string-name>
          ,
          <article-title>A study of the documentation essential to software maintenance</article-title>
          ,
          <source>Conference on Design of communication, ACM</source>
          ,
          <year>2005</year>
          , pp.
          <fpage>68</fpage>
          -
          <lpage>75</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref7">
        <mixed-citation>
          [7]
          <string-name>
            <given-names>L.</given-names>
            <surname>Tan</surname>
          </string-name>
          ,
          <string-name>
            <given-names>D.</given-names>
            <surname>Yuan</surname>
          </string-name>
          ,
          <string-name>
            <given-names>Y.</given-names>
            <surname>Zhou</surname>
          </string-name>
          ,
          <article-title>Hotcomments: how to make program comments more useful?, in: Conference on Programming language design and implementation (SIGPLAN)</article-title>
          , ACM,
          <year>2007</year>
          , pp.
          <fpage>20</fpage>
          -
          <lpage>27</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref8">
        <mixed-citation>
          [8]
          <string-name>
            <given-names>S.</given-names>
            <surname>Majumdar</surname>
          </string-name>
          ,
          <string-name>
            <given-names>S.</given-names>
            <surname>Papdeja</surname>
          </string-name>
          ,
          <string-name>
            <surname>P. P. Das</surname>
            ,
            <given-names>S. K.</given-names>
          </string-name>
          <string-name>
            <surname>Ghosh</surname>
          </string-name>
          ,
          <article-title>Smartkt: a search framework to assist program comprehension using smart knowledge transfer</article-title>
          ,
          <source>in: 2019 IEEE 19th International Conference on Software Quality, Reliability and Security (QRS)</source>
          , IEEE,
          <year>2019</year>
          , pp.
          <fpage>97</fpage>
          -
          <lpage>108</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref9">
        <mixed-citation>
          [9]
          <string-name>
            <given-names>N.</given-names>
            <surname>Chatterjee</surname>
          </string-name>
          ,
          <string-name>
            <given-names>S.</given-names>
            <surname>Majumdar</surname>
          </string-name>
          ,
          <string-name>
            <given-names>S. R.</given-names>
            <surname>Sahoo</surname>
          </string-name>
          ,
          <string-name>
            <surname>P. P. Das</surname>
          </string-name>
          ,
          <article-title>Debugging multi-threaded applications using pin-augmented gdb (pgdb)</article-title>
          ,
          <source>in: International conference on software engineering research and practice (SERP)</source>
          . Springer,
          <year>2015</year>
          , pp.
          <fpage>109</fpage>
          -
          <lpage>115</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref10">
        <mixed-citation>
          [10]
          <string-name>
            <given-names>S.</given-names>
            <surname>Majumdar</surname>
          </string-name>
          ,
          <string-name>
            <given-names>N.</given-names>
            <surname>Chatterjee</surname>
          </string-name>
          ,
          <string-name>
            <given-names>S. R.</given-names>
            <surname>Sahoo</surname>
          </string-name>
          ,
          <string-name>
            <surname>P. P. Das</surname>
          </string-name>
          ,
          <article-title>D-cube: tool for dynamic design discovery</article-title>
        </mixed-citation>
      </ref>
    </ref-list>
  </back>
</article>