646 lines
24 KiB
HTML
Executable File
646 lines
24 KiB
HTML
Executable File
<?xml version="1.0" encoding="utf-8"?>
|
||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
|
||
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
|
||
<head>
|
||
<!-- 2025-12-28 Sun 20:49 -->
|
||
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
|
||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||
<title>ise_week_3</title>
|
||
<meta name="generator" content="Org Mode" />
|
||
<style type="text/css">
|
||
#content { max-width: 60em; margin: auto; }
|
||
.title { text-align: center;
|
||
margin-bottom: .2em; }
|
||
.subtitle { text-align: center;
|
||
font-size: medium;
|
||
font-weight: bold;
|
||
margin-top:0; }
|
||
.todo { font-family: monospace; color: red; }
|
||
.done { font-family: monospace; color: green; }
|
||
.priority { font-family: monospace; color: orange; }
|
||
.tag { background-color: #eee; font-family: monospace;
|
||
padding: 2px; font-size: 80%; font-weight: normal; }
|
||
.timestamp { color: #bebebe; }
|
||
.timestamp-kwd { color: #5f9ea0; }
|
||
.org-right { margin-left: auto; margin-right: 0px; text-align: right; }
|
||
.org-left { margin-left: 0px; margin-right: auto; text-align: left; }
|
||
.org-center { margin-left: auto; margin-right: auto; text-align: center; }
|
||
.underline { text-decoration: underline; }
|
||
#postamble p, #preamble p { font-size: 90%; margin: .2em; }
|
||
p.verse { margin-left: 3%; }
|
||
pre {
|
||
border: 1px solid #e6e6e6;
|
||
border-radius: 3px;
|
||
background-color: #f2f2f2;
|
||
padding: 8pt;
|
||
font-family: monospace;
|
||
overflow: auto;
|
||
margin: 1.2em;
|
||
}
|
||
pre.src {
|
||
position: relative;
|
||
overflow: auto;
|
||
}
|
||
pre.src:before {
|
||
display: none;
|
||
position: absolute;
|
||
top: -8px;
|
||
right: 12px;
|
||
padding: 3px;
|
||
color: #555;
|
||
background-color: #f2f2f299;
|
||
}
|
||
pre.src:hover:before { display: inline; margin-top: 14px;}
|
||
/* Languages per Org manual */
|
||
pre.src-asymptote:before { content: 'Asymptote'; }
|
||
pre.src-awk:before { content: 'Awk'; }
|
||
pre.src-authinfo::before { content: 'Authinfo'; }
|
||
pre.src-C:before { content: 'C'; }
|
||
/* pre.src-C++ doesn't work in CSS */
|
||
pre.src-clojure:before { content: 'Clojure'; }
|
||
pre.src-css:before { content: 'CSS'; }
|
||
pre.src-D:before { content: 'D'; }
|
||
pre.src-ditaa:before { content: 'ditaa'; }
|
||
pre.src-dot:before { content: 'Graphviz'; }
|
||
pre.src-calc:before { content: 'Emacs Calc'; }
|
||
pre.src-emacs-lisp:before { content: 'Emacs Lisp'; }
|
||
pre.src-fortran:before { content: 'Fortran'; }
|
||
pre.src-gnuplot:before { content: 'gnuplot'; }
|
||
pre.src-haskell:before { content: 'Haskell'; }
|
||
pre.src-hledger:before { content: 'hledger'; }
|
||
pre.src-java:before { content: 'Java'; }
|
||
pre.src-js:before { content: 'Javascript'; }
|
||
pre.src-latex:before { content: 'LaTeX'; }
|
||
pre.src-ledger:before { content: 'Ledger'; }
|
||
pre.src-lisp:before { content: 'Lisp'; }
|
||
pre.src-lilypond:before { content: 'Lilypond'; }
|
||
pre.src-lua:before { content: 'Lua'; }
|
||
pre.src-matlab:before { content: 'MATLAB'; }
|
||
pre.src-mscgen:before { content: 'Mscgen'; }
|
||
pre.src-ocaml:before { content: 'Objective Caml'; }
|
||
pre.src-octave:before { content: 'Octave'; }
|
||
pre.src-org:before { content: 'Org mode'; }
|
||
pre.src-oz:before { content: 'OZ'; }
|
||
pre.src-plantuml:before { content: 'Plantuml'; }
|
||
pre.src-processing:before { content: 'Processing.js'; }
|
||
pre.src-python:before { content: 'Python'; }
|
||
pre.src-R:before { content: 'R'; }
|
||
pre.src-ruby:before { content: 'Ruby'; }
|
||
pre.src-sass:before { content: 'Sass'; }
|
||
pre.src-scheme:before { content: 'Scheme'; }
|
||
pre.src-screen:before { content: 'Gnu Screen'; }
|
||
pre.src-sed:before { content: 'Sed'; }
|
||
pre.src-sh:before { content: 'shell'; }
|
||
pre.src-sql:before { content: 'SQL'; }
|
||
pre.src-sqlite:before { content: 'SQLite'; }
|
||
/* additional languages in org.el's org-babel-load-languages alist */
|
||
pre.src-forth:before { content: 'Forth'; }
|
||
pre.src-io:before { content: 'IO'; }
|
||
pre.src-J:before { content: 'J'; }
|
||
pre.src-makefile:before { content: 'Makefile'; }
|
||
pre.src-maxima:before { content: 'Maxima'; }
|
||
pre.src-perl:before { content: 'Perl'; }
|
||
pre.src-picolisp:before { content: 'Pico Lisp'; }
|
||
pre.src-scala:before { content: 'Scala'; }
|
||
pre.src-shell:before { content: 'Shell Script'; }
|
||
pre.src-ebnf2ps:before { content: 'ebfn2ps'; }
|
||
/* additional language identifiers per "defun org-babel-execute"
|
||
in ob-*.el */
|
||
pre.src-cpp:before { content: 'C++'; }
|
||
pre.src-abc:before { content: 'ABC'; }
|
||
pre.src-coq:before { content: 'Coq'; }
|
||
pre.src-groovy:before { content: 'Groovy'; }
|
||
/* additional language identifiers from org-babel-shell-names in
|
||
ob-shell.el: ob-shell is the only babel language using a lambda to put
|
||
the execution function name together. */
|
||
pre.src-bash:before { content: 'bash'; }
|
||
pre.src-csh:before { content: 'csh'; }
|
||
pre.src-ash:before { content: 'ash'; }
|
||
pre.src-dash:before { content: 'dash'; }
|
||
pre.src-ksh:before { content: 'ksh'; }
|
||
pre.src-mksh:before { content: 'mksh'; }
|
||
pre.src-posh:before { content: 'posh'; }
|
||
/* Additional Emacs modes also supported by the LaTeX listings package */
|
||
pre.src-ada:before { content: 'Ada'; }
|
||
pre.src-asm:before { content: 'Assembler'; }
|
||
pre.src-caml:before { content: 'Caml'; }
|
||
pre.src-delphi:before { content: 'Delphi'; }
|
||
pre.src-html:before { content: 'HTML'; }
|
||
pre.src-idl:before { content: 'IDL'; }
|
||
pre.src-mercury:before { content: 'Mercury'; }
|
||
pre.src-metapost:before { content: 'MetaPost'; }
|
||
pre.src-modula-2:before { content: 'Modula-2'; }
|
||
pre.src-pascal:before { content: 'Pascal'; }
|
||
pre.src-ps:before { content: 'PostScript'; }
|
||
pre.src-prolog:before { content: 'Prolog'; }
|
||
pre.src-simula:before { content: 'Simula'; }
|
||
pre.src-tcl:before { content: 'tcl'; }
|
||
pre.src-tex:before { content: 'TeX'; }
|
||
pre.src-plain-tex:before { content: 'Plain TeX'; }
|
||
pre.src-verilog:before { content: 'Verilog'; }
|
||
pre.src-vhdl:before { content: 'VHDL'; }
|
||
pre.src-xml:before { content: 'XML'; }
|
||
pre.src-nxml:before { content: 'XML'; }
|
||
/* add a generic configuration mode; LaTeX export needs an additional
|
||
(add-to-list 'org-latex-listings-langs '(conf " ")) in .emacs */
|
||
pre.src-conf:before { content: 'Configuration File'; }
|
||
|
||
table { border-collapse:collapse; }
|
||
caption.t-above { caption-side: top; }
|
||
caption.t-bottom { caption-side: bottom; }
|
||
td, th { vertical-align:top; }
|
||
th.org-right { text-align: center; }
|
||
th.org-left { text-align: center; }
|
||
th.org-center { text-align: center; }
|
||
td.org-right { text-align: right; }
|
||
td.org-left { text-align: left; }
|
||
td.org-center { text-align: center; }
|
||
dt { font-weight: bold; }
|
||
.footpara { display: inline; }
|
||
.footdef { margin-bottom: 1em; }
|
||
.figure { padding: 1em; }
|
||
.figure p { text-align: center; }
|
||
.equation-container {
|
||
display: table;
|
||
text-align: center;
|
||
width: 100%;
|
||
}
|
||
.equation {
|
||
vertical-align: middle;
|
||
}
|
||
.equation-label {
|
||
display: table-cell;
|
||
text-align: right;
|
||
vertical-align: middle;
|
||
}
|
||
.inlinetask {
|
||
padding: 10px;
|
||
border: 2px solid gray;
|
||
margin: 10px;
|
||
background: #ffffcc;
|
||
}
|
||
#org-div-home-and-up
|
||
{ text-align: right; font-size: 70%; white-space: nowrap; }
|
||
textarea { overflow-x: auto; }
|
||
.linenr { font-size: smaller }
|
||
.code-highlighted { background-color: #ffff00; }
|
||
.org-info-js_info-navigation { border-style: none; }
|
||
#org-info-js_console-label
|
||
{ font-size: 10px; font-weight: bold; white-space: nowrap; }
|
||
.org-info-js_search-highlight
|
||
{ background-color: #ffff00; color: #000000; font-weight: bold; }
|
||
.org-svg { }
|
||
</style>
|
||
|
||
<link rel="stylesheet" href="/assets/styles/style.css" />
|
||
<link rel="stylesheet" href="/assets/styles/bigger-picture.min.css" />
|
||
<link rel="stylesheet" href="/assets/styles/media.css" />
|
||
|
||
<script src="/assets/scripts/script.js" defer></script>
|
||
<script src="/assets/scripts/search.js" defer></script>
|
||
<script src="/assets/scripts/bigger-picture.min.js" defer></script>
|
||
<script src="/assets/scripts/svg-pan-zoom.min.js" defer></script>
|
||
<script src="/assets/scripts/gallery-init.js" defer></script>
|
||
</head>
|
||
<body>
|
||
<div id="preamble" class="status">
|
||
|
||
<div class="banner-header">
|
||
<div class="banner-left">
|
||
<a href="/20241210233721-brain_moc.html"> <img src="/assets/gr.png" alt="Site Logo" class="banner-logo" /> </a>
|
||
<div id="updated">Updated: 2025-12-28 Sun 19:48</div>
|
||
</div>
|
||
|
||
<div class="banner-search">
|
||
<input id="search-box"
|
||
type="search"
|
||
placeholder="Search notes…"
|
||
aria-label="Search notes"
|
||
autocomplete="off" />
|
||
<div id="search-results"></div>
|
||
</div>
|
||
|
||
<button id="close-all">Close All</button>
|
||
</div>
|
||
</div>
|
||
<div id="stack-root">
|
||
<div class="stack-track">
|
||
<article class="stack-pane pane-root" data-url="/20250329142725-ise_week_3.html">
|
||
<div id="content" class="content">
|
||
<div class="title-section">
|
||
<div class="title-controls">
|
||
<button class="pane-fullscreen" aria-label="Fullscreen">F</button>
|
||
<button class="pane-edit" aria-label="Edit pane">E</button>
|
||
<button class="pane-close" aria-label="Close pane">×</button>
|
||
</div>
|
||
<h1 class="title">ise<sub>week</sub><sub>3</sub></h1>
|
||
<div class="title-metadata">
|
||
<span class="metadata-item">
|
||
<span class="metadata-label">planted:</span>
|
||
<span class="metadata-value">2025-03-29</span>
|
||
</span>
|
||
<span class="metadata-item">
|
||
<span class="metadata-label">last tended to:</span>
|
||
<span class="metadata-value">2025-12-28</span>
|
||
</span>
|
||
</div>
|
||
</div>
|
||
<div id="outline-container-org19cc2b6" class="outline-2">
|
||
<h2 id="org19cc2b6"><a href="#org19cc2b6"><span class="done DONE">DONE</span> Classic Code Complexity Metrics (pages 8-27)</a></h2>
|
||
</div>
|
||
<div id="outline-container-org6391118" class="outline-2">
|
||
<h2 id="org6391118"><a href="#org6391118"><span class="done DONE">DONE</span> How to Mine Bugs for Learning? (pages 37-43)</a></h2>
|
||
</div>
|
||
<div id="outline-container-orgcd5e9b1" class="outline-2">
|
||
<h2 id="orgcd5e9b1"><a href="#orgcd5e9b1"><span class="done DONE">DONE</span> Cross Project Prediction (HDP) (pages 50-60)</a></h2>
|
||
</div>
|
||
|
||
<div id="outline-container-org87eee99" class="outline-2">
|
||
<h2 id="org87eee99"><a href="#org87eee99">3.1 Intelligent Software Engineering: Classic Metrics</a></h2>
|
||
<div class="outline-text-2" id="text-org87eee99">
|
||
</div>
|
||
<div id="outline-container-orge9fb22e" class="outline-3">
|
||
<h3 id="orge9fb22e"><a href="#orge9fb22e">Software Defect Prediction</a></h3>
|
||
<div class="outline-text-3" id="text-orge9fb22e">
|
||
<ul class="org-ul">
|
||
<li>The foundation of software defect prediction lies in metric identification.</li>
|
||
<li>This was a key research direction in the 1980s.</li>
|
||
<li>Metrics aim to quantify properties of code to detect potential defects and improve quality.</li>
|
||
</ul>
|
||
</div>
|
||
</div>
|
||
<div id="outline-container-orgd6556eb" class="outline-3">
|
||
<h3 id="orgd6556eb"><a href="#orgd6556eb">Classic Code Metrics</a></h3>
|
||
<div class="outline-text-3" id="text-orgd6556eb">
|
||
</div>
|
||
<div id="outline-container-orga291112" class="outline-4">
|
||
<h4 id="orga291112"><a href="#orga291112">1. McCabe Cyclomatic Complexity</a></h4>
|
||
<div class="outline-text-4" id="text-orga291112">
|
||
<ul class="org-ul">
|
||
<li>Purpose: Measures the complexity of code based on the number of linearly independent paths in the code’s flow graph.</li>
|
||
</ul>
|
||
</div>
|
||
<ul class="org-ul">
|
||
<li><a id="org612ec3c"></a><a href="#org612ec3c">Why it Matters</a><br />
|
||
<div class="outline-text-5" id="text-org612ec3c">
|
||
<ul class="org-ul">
|
||
<li>More conditional statements = More possible execution paths = Higher complexity.</li>
|
||
<li>Useful for identifying complex, hard-to-test, and error-prone code.</li>
|
||
</ul>
|
||
</div>
|
||
</li>
|
||
<li><a id="org204a594"></a><a href="#org204a594">Simple Definition</a><br />
|
||
<div class="outline-text-5" id="text-org204a594">
|
||
<ul class="org-ul">
|
||
<li>McCabe Complexity = Number of simple conditions + 1</li>
|
||
</ul>
|
||
</div>
|
||
</li>
|
||
<li><a id="org2d9d405"></a><a href="#org2d9d405">What is a “Simple Condition”?</a><br />
|
||
<div class="outline-text-5" id="text-org2d9d405">
|
||
<ul class="org-ul">
|
||
<li>A conditional without logical connectors (AND, OR).</li>
|
||
<li>Examples:
|
||
<ul class="org-ul">
|
||
<li>if (a > b)</li>
|
||
<li>while (a > b)</li>
|
||
<li>for (a=b; a > b; b++)</li>
|
||
<li>do {…} while (a > b)</li>
|
||
</ul></li>
|
||
</ul>
|
||
</div>
|
||
</li>
|
||
<li><a id="org0960ea5"></a><a href="#org0960ea5">Compound Conditions</a><br />
|
||
<div class="outline-text-5" id="text-org0960ea5">
|
||
<ul class="org-ul">
|
||
<li>Count each simple condition inside:
|
||
<ul class="org-ul">
|
||
<li>if (a > b || a > 2) → 2 simple conditions</li>
|
||
<li>if (a > b && a > 2) → 2 simple conditions</li>
|
||
</ul></li>
|
||
</ul>
|
||
</div>
|
||
</li>
|
||
<li><a id="orgcef1371"></a><a href="#orgcef1371">Use Case</a><br />
|
||
<div class="outline-text-5" id="text-orgcef1371">
|
||
<ul class="org-ul">
|
||
<li>Helps determine test case count needed for complete branch coverage.</li>
|
||
</ul>
|
||
</div>
|
||
</li>
|
||
</ul>
|
||
</div>
|
||
<div id="outline-container-orge15d2c5" class="outline-4">
|
||
<h4 id="orge15d2c5"><a href="#orge15d2c5">2. Halstead Complexity Measures</a></h4>
|
||
<div class="outline-text-4" id="text-orge15d2c5">
|
||
<ul class="org-ul">
|
||
<li>Purpose: Measures complexity based on the operators and operands used in code.</li>
|
||
</ul>
|
||
</div>
|
||
<ul class="org-ul">
|
||
<li><a id="orgf81e75c"></a><a href="#orgf81e75c">Definitions:</a><br />
|
||
<div class="outline-text-5" id="text-orgf81e75c">
|
||
<ul class="org-ul">
|
||
<li>n1: Number of distinct operators (e.g., !=, !, %, /, *, +, &&, ||)</li>
|
||
<li>n2: Number of distinct operands (e.g., variable names, constants, types like bool, char)</li>
|
||
<li>N1: Total occurrences of operators</li>
|
||
<li>N2: Total occurrences of operands</li>
|
||
</ul>
|
||
</div>
|
||
</li>
|
||
<li><a id="org365c6d4"></a><a href="#org365c6d4">Why Use Halstead?</a><br />
|
||
<div class="outline-text-5" id="text-org365c6d4">
|
||
<ul class="org-ul">
|
||
<li>Evaluates:
|
||
<ul class="org-ul">
|
||
<li>Code length</li>
|
||
<li>Code vocabulary</li>
|
||
<li>Effort required to implement or understand the code</li>
|
||
<li>Potential bugs</li>
|
||
</ul></li>
|
||
</ul>
|
||
</div>
|
||
</li>
|
||
</ul>
|
||
</div>
|
||
<div id="outline-container-org9ba3b18" class="outline-4">
|
||
<h4 id="org9ba3b18"><a href="#org9ba3b18">3. Lines of Code (LOC)</a></h4>
|
||
<div class="outline-text-4" id="text-org9ba3b18">
|
||
<ul class="org-ul">
|
||
<li>LOC: Total number of lines in a program.</li>
|
||
<li>Comment Lines: Lines containing only comments.</li>
|
||
</ul>
|
||
</div>
|
||
<ul class="org-ul">
|
||
<li><a id="org23fce49"></a><a href="#org23fce49">Usefulness:</a><br />
|
||
<div class="outline-text-5" id="text-org23fce49">
|
||
<ul class="org-ul">
|
||
<li>Simple indicator of:
|
||
<ul class="org-ul">
|
||
<li>Code size</li>
|
||
<li>Code density</li>
|
||
<li>Maintainability and readability</li>
|
||
</ul></li>
|
||
</ul>
|
||
</div>
|
||
</li>
|
||
</ul>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<div id="outline-container-org8a68fcf" class="outline-2">
|
||
<h2 id="org8a68fcf"><a href="#org8a68fcf">3.2 Intelligent Software Engineering: Within-Project Prediction</a></h2>
|
||
<div class="outline-text-2" id="text-org8a68fcf">
|
||
</div>
|
||
<div id="outline-container-orga892094" class="outline-3">
|
||
<h3 id="orga892094"><a href="#orga892094">Just-in-Time (JIT) Defect Prediction</a></h3>
|
||
<div class="outline-text-3" id="text-orga892094">
|
||
<ul class="org-ul">
|
||
<li>Based on the classic work by Kim et al. (2008).</li>
|
||
<li>Focuses on predicting defects at the commit/change level rather than file or module level.</li>
|
||
</ul>
|
||
</div>
|
||
</div>
|
||
<div id="outline-container-orga3c288d" class="outline-3">
|
||
<h3 id="orga3c288d"><a href="#orga3c288d">Steps in the JIT Defect Prediction Pipeline:</a></h3>
|
||
<div class="outline-text-3" id="text-orga3c288d">
|
||
<ol class="org-ol">
|
||
<li>File-level changes are extracted from a project’s revision history.</li>
|
||
<li>Bug fix changes are identified using keywords in SCM (Source Code Management) change log messages.</li>
|
||
<li>Bug-introducing and clean changes are identified by tracing backwards from the bug fix commits.</li>
|
||
<li>A classification model (e.g., SVM) is trained on these labeled examples.</li>
|
||
<li>Once trained, the classifier can predict if new code changes are likely to be buggy or clean.</li>
|
||
</ol>
|
||
</div>
|
||
</div>
|
||
<div id="outline-container-orgfa52f81" class="outline-3">
|
||
<h3 id="orgfa52f81"><a href="#orgfa52f81">Change-wise Prediction Details</a></h3>
|
||
<div class="outline-text-3" id="text-orgfa52f81">
|
||
</div>
|
||
<div id="outline-container-org0a63721" class="outline-4">
|
||
<h4 id="org0a63721"><a href="#org0a63721">Change History Extraction</a></h4>
|
||
<div class="outline-text-4" id="text-org0a63721">
|
||
<ul class="org-ul">
|
||
<li>Collected information includes:
|
||
<ul class="org-ul">
|
||
<li>Change log</li>
|
||
<li>Author</li>
|
||
<li>Change date</li>
|
||
<li>Source code</li>
|
||
<li>Change delta</li>
|
||
<li>Change metadata</li>
|
||
</ul></li>
|
||
</ul>
|
||
</div>
|
||
</div>
|
||
<div id="outline-container-org2ddd9ed" class="outline-4">
|
||
<h4 id="org2ddd9ed"><a href="#org2ddd9ed">Identifying Bug-Introducing Changes</a></h4>
|
||
<div class="outline-text-4" id="text-org2ddd9ed">
|
||
</div>
|
||
<ul class="org-ul">
|
||
<li><a id="orgd06feb1"></a><a href="#orgd06feb1">Step 1: Search for Bug Fixes</a><br />
|
||
<div class="outline-text-5" id="text-orgd06feb1">
|
||
<ul class="org-ul">
|
||
<li>Use keywords (e.g., “fix”, “bug”, “patch”) to find bug-fixing commits.</li>
|
||
</ul>
|
||
</div>
|
||
</li>
|
||
<li><a id="org4c1df24"></a><a href="#org4c1df24">Step 2: Use the SZZ Algorithm</a><br />
|
||
<div class="outline-text-5" id="text-org4c1df24">
|
||
<ul class="org-ul">
|
||
<li>Determine what was changed in bug fixes.</li>
|
||
<li>Produces a list of regions (“hunks”) showing differences between two revisions.</li>
|
||
<li>Deleted or modified code in each hunk is treated as the location of a bug.</li>
|
||
<li>Traces origin of this code to find the earlier bug-introducing changes.</li>
|
||
</ul>
|
||
</div>
|
||
</li>
|
||
</ul>
|
||
</div>
|
||
</div>
|
||
<div id="outline-container-org6c5e240" class="outline-3">
|
||
<h3 id="org6c5e240"><a href="#org6c5e240">Example Walkthrough</a></h3>
|
||
<div class="outline-text-3" id="text-org6c5e240">
|
||
</div>
|
||
<div id="outline-container-orgde2c287" class="outline-4">
|
||
<h4 id="orgde2c287"><a href="#orgde2c287">Revision 1:</a></h4>
|
||
<div class="outline-text-4" id="text-orgde2c287">
|
||
<ul class="org-ul">
|
||
<li>Initial creation of a function `bar`.</li>
|
||
<li>Introduces a bug: `if (report == null)` (should be `!=`).</li>
|
||
<li>SCM annotate shows all lines as modified in revision 1 by “kim”.</li>
|
||
</ul>
|
||
</div>
|
||
</div>
|
||
<div id="outline-container-org5e39eeb" class="outline-4">
|
||
<h4 id="org5e39eeb"><a href="#org5e39eeb">Revision 2:</a></h4>
|
||
<div class="outline-text-4" id="text-org5e39eeb">
|
||
<ul class="org-ul">
|
||
<li>Two changes:
|
||
<ul class="org-ul">
|
||
<li>Function `bar` renamed to `foo`.</li>
|
||
<li>Argument changed from `report` to `report.str` in `println`.</li>
|
||
</ul></li>
|
||
<li>Annotate output shows lines 1 and 4 were last modified by “ejw” in revision 2.</li>
|
||
</ul>
|
||
</div>
|
||
</div>
|
||
<div id="outline-container-org243f1c6" class="outline-4">
|
||
<h4 id="org243f1c6"><a href="#org243f1c6">Revision 3:</a></h4>
|
||
<div class="outline-text-4" id="text-org243f1c6">
|
||
<ul class="org-ul">
|
||
<li>Bug fix applied: changes `==` to `!=` on line 3.</li>
|
||
<li>SZZ algorithm compares revisions 3 and 2, identifying line 3 as modified.</li>
|
||
<li>Traces line 3’s origin back to revision 1 — identifying the bug-introducing change.</li>
|
||
</ul>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<div id="outline-container-org9d7d1ea" class="outline-2">
|
||
<h2 id="org9d7d1ea"><a href="#org9d7d1ea">3.3 Intelligent Software Engineering: Cross-Project Prediction (HDP)</a></h2>
|
||
<div class="outline-text-2" id="text-org9d7d1ea">
|
||
</div>
|
||
<div id="outline-container-orgfd6fb51" class="outline-3">
|
||
<h3 id="orgfd6fb51"><a href="#orgfd6fb51">Heterogeneous Defect Prediction (HDP)</a></h3>
|
||
<div class="outline-text-3" id="text-orgfd6fb51">
|
||
<ul class="org-ul">
|
||
<li>Based on the work by Nam and Kim (2015).</li>
|
||
<li>Motivation: Metrics used for defect prediction often differ across projects.</li>
|
||
<li>Goal: Address the metric mismatching problem across projects (heterogeneous settings).</li>
|
||
<li>Classifier agnostic — can be used with any machine learning model.</li>
|
||
</ul>
|
||
</div>
|
||
</div>
|
||
<div id="outline-container-orga36432f" class="outline-3">
|
||
<h3 id="orga36432f"><a href="#orga36432f">HDP Architecture</a></h3>
|
||
<div class="outline-text-3" id="text-orga36432f">
|
||
</div>
|
||
<div id="outline-container-orge763408" class="outline-4">
|
||
<h4 id="orge763408"><a href="#orge763408">Metric Selection in Source Datasets</a></h4>
|
||
<div class="outline-text-4" id="text-orge763408">
|
||
<ul class="org-ul">
|
||
<li>Uses well-known feature selection methods:
|
||
<ul class="org-ul">
|
||
<li>Gain ratio</li>
|
||
<li>Chi-square</li>
|
||
<li>Relief-F</li>
|
||
<li>Significance attribute evaluation</li>
|
||
</ul></li>
|
||
<li>Empirical testing used to choose the best approach.</li>
|
||
<li>Top 15% metrics per source project are selected.</li>
|
||
<li>Metric mismatching arises because each project may prioritize different metrics.</li>
|
||
</ul>
|
||
</div>
|
||
</div>
|
||
<div id="outline-container-org14b585c" class="outline-4">
|
||
<h4 id="org14b585c"><a href="#org14b585c">Matching Source and Target Metrics</a></h4>
|
||
<div class="outline-text-4" id="text-org14b585c">
|
||
</div>
|
||
<ul class="org-ul">
|
||
<li><a id="org6875229"></a><a href="#org6875229">Key Steps:</a><br />
|
||
<div class="outline-text-5" id="text-org6875229">
|
||
<ol class="org-ol">
|
||
<li>Pair all metrics from source and target projects.</li>
|
||
<li>Remove poorly matched metrics based on a cutoff threshold for matching scores.</li>
|
||
<li>Apply maximum weighted bipartite matching to select the best group of matched metric pairs:
|
||
<ul class="org-ul">
|
||
<li>Goal: Maximize sum of matching scores.</li>
|
||
<li>Ensure no duplicated metrics are selected.</li>
|
||
</ul></li>
|
||
</ol>
|
||
</div>
|
||
</li>
|
||
<li><a id="orgad2bbff"></a><a href="#orgad2bbff">Example:</a><br />
|
||
<div class="outline-text-5" id="text-orgad2bbff">
|
||
<ul class="org-ul">
|
||
<li>2 source metrics: X1, X2</li>
|
||
<li>2 target metrics: Y1, Y2</li>
|
||
<li>Matching pairs: (X1,Y1), (X1,Y2), (X2,Y1), (X2,Y2)</li>
|
||
</ul>
|
||
|
||
<p>
|
||
After applying a cutoff threshold of 0.30:
|
||
</p>
|
||
<ul class="org-ul">
|
||
<li>Group 1: (X1,Y1) and (X2,Y2) with total score 1.3 (=0.8+0.5)</li>
|
||
<li>Group 2: (X2,Y1) with score 0.4 (Stands alone (can’t be paired with any other remaining pair without duplication)).</li>
|
||
<li>Group 1 is chosen as the matched metric set.</li>
|
||
</ul>
|
||
</div>
|
||
</li>
|
||
</ul>
|
||
</div>
|
||
</div>
|
||
<div id="outline-container-org4ddb653" class="outline-3">
|
||
<h3 id="org4ddb653"><a href="#org4ddb653">Methods for Calculating Matching Scores</a></h3>
|
||
<div class="outline-text-3" id="text-org4ddb653">
|
||
</div>
|
||
<div id="outline-container-org9309882" class="outline-4">
|
||
<h4 id="org9309882"><a href="#org9309882">Percentile-Based Method</a></h4>
|
||
<div class="outline-text-4" id="text-org9309882">
|
||
<ul class="org-ul">
|
||
<li>Compares 9 percentiles (10th, 20th, …, 90th) between source and target metric values.</li>
|
||
<li>Uses the formula:
|
||
Pij(n) = 1 - |spij(n) - bpij(n)| / bpij(n)
|
||
<ul class="org-ul">
|
||
<li>spij(n): smaller percentile value</li>
|
||
<li>bpij(n): bigger percentile value</li>
|
||
</ul></li>
|
||
<li>Matching score is 1 when all percentiles are identical.</li>
|
||
</ul>
|
||
</div>
|
||
</div>
|
||
<div id="outline-container-org1e3b3a3" class="outline-4">
|
||
<h4 id="org1e3b3a3"><a href="#org1e3b3a3">Kolmogorov-Smirnov (KS) Test Method</a></h4>
|
||
<div class="outline-text-4" id="text-org1e3b3a3">
|
||
<ul class="org-ul">
|
||
<li>Non-parametric two-sample test.</li>
|
||
<li>Useful when distributions are unknown or have unequal variances.</li>
|
||
<li>Computes a p-value to indicate the similarity.</li>
|
||
<li>Matching score derived from the p-value.</li>
|
||
</ul>
|
||
</div>
|
||
</div>
|
||
<div id="outline-container-orga5d0f74" class="outline-4">
|
||
<h4 id="orga5d0f74"><a href="#orga5d0f74">Spearman’s Rank Correlation Coefficient Method</a></h4>
|
||
<div class="outline-text-4" id="text-orga5d0f74">
|
||
<ul class="org-ul">
|
||
<li>Measures correlation between two sets of values.</li>
|
||
<li>If dataset sizes differ, randomly sample the larger set to match sizes.</li>
|
||
</ul>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<div id="outline-container-orgca058ba" class="outline-3">
|
||
<h3 id="orgca058ba"><a href="#orgca058ba">Classifier Independence</a></h3>
|
||
<div class="outline-text-3" id="text-orgca058ba">
|
||
<ul class="org-ul">
|
||
<li>HDP approach can be paired with any machine learning algorithm (e.g., SVM, RF, etc.)</li>
|
||
</ul>
|
||
|
||
<p class="backlinks-section" id="backlinks">
|
||
Backlinks
|
||
</p>
|
||
<ul class="org-ul backlinks-list">
|
||
<li><a href="20250329114733-ise.html#ID-c69e4c4d-2fb4-4cf1-a835-a235cf6db8e9">ise</a></li>
|
||
</ul>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div></article></div></div>
|
||
<div id="postamble" class="status">
|
||
<footer>
|
||
<div class="copyright-container">
|
||
<div class="copyright">
|
||
Copyright © 2022-2025 Zaine Qayyum. All rights reserved unless otherwise noted.</div></div>
|
||
<div class="generated">
|
||
Created with <a href="https://www.gnu.org/software/emacs/">Emacs</a> 30.2 (<a href="https://orgmode.org">Org</a> mode 9.7.11) on <a href="https://www.archlinux.org/">Arch</a> <a href="https://www.gnu.org">GNU</a>/<a href="https://www.kernel.org/">Linux</a>
|
||
</div>
|
||
</footer>
|
||
</div>
|
||
</body>
|
||
</html>
|