Software Engineering Laboratory Department of Computer Science Graduate
情報検索技術に基づくベクトル表現と 深層学習を用いたコード片の類似性判定法 井上研究室 横井 一輝 Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University
情報検索技術に基づくベクトル化 • 情報検索技術に基づくベクトル表現を用いて コード片をベクトル化 – LSI (Latent Semantic Indexing) 主成分分析による潜在的意味表現 – LDA (Latent Dirichlet Allocation) ベイズ学習による潜在ディリクレ配分 – PV-DBo. W 文書ベクトルDoc 2 Vecの一種 – PV-DM 文書ベクトルDoc 2 Vecの一種 – WV-avg (Word 2 Vec-average) 単語ベクトルWord 2 Vecの平均ベクトル • 情報検索技術に基づくコード片のベクトル表現 の特徴調査[2]で用いられた手法を選択 [2] Kazuki Yokoi et al. , "Investigating Vector-based Detection of Code Clones Using Big. Clone. Bench", APSEC, pp. 699700, 2018 6 Department of Computer Science, Graduate School of Information Science and Technology, Osaka University
LSI (Latent Semantic Indexing)[5] • 特徴 – 主成分分析による潜在的意味解析 – 高速に次元圧縮 • 主成分分析 – 多次元ベクトルをなるべく 情報の損失が少なくなるように 低次元に圧縮する手法 2次元を 1次元に圧縮 [3] S. Deerwester et. al. , "Indexing by latent semantic analysis. " Journal of the American society for information science. vol. 41. no. 6, pp. 391 -407, 1990. Department of Computer Science, Graduate School of Information Science and Technology, Osaka University 7
評価実験 1. Google Code Jam(GCJ)[5] を用いた精度評価 2. Google Code Jam(GCJ)を用いた実行時間 3. Big. Clone. Bench(BCB)[6] を用いた精度評価 • 比較評価対象: 6つ – ベクトル表現を用いた提案手法 5種 – Deep. Sim:最新のコード片類似性判定法 [5] https: //codingcompetitions. withgoogle. com/codejam [6] Jeffrey Svajlenko et al. , “Towards a big data curated benchmark of inter-project code clones”, ICSME, pp. 476 -480, 2014. 10 Department of Computer Science, Graduate School of Information Science and Technology, Osaka University
GCJ を用いた精度評価:概要 • Google Code Jam(GCJ) を用いた精度評価 – 競技プログラミング Google Code Jamにて 同一の問題に回答したソースコードを 類似コード片として精度評価 – 評価指標:適合率,再現率,F値 • 10分割交差検証により精度評価 • Deep. Sim 論文[1]と同じ条件で実験してるため Deep. Sim の値は論文から引用 [1] Gang Zhao et al. , “Deepsim: Deep learning code functional similarity. ”, ESEC/FSE, pp. 141 -151, 2018. 11 Department of Computer Science, Graduate School of Information Science and Technology, Osaka University
GCJ を用いた精度評価:結果 適合率 再現率 F値 0. 71 0. 82 0. 76 LSI 0. 96 0. 93 0. 94 LDA 0. 61 0. 54 0. 55 PV-DBo. W 0. 86 0. 88 0. 86 PV-DM 0. 68 0. 89 0. 75 WV-avg 0. 90 0. 91 0. 88 Deep. Sim 提案手法 ※ Deep. Sim は論文より引用 提案手法の中ではLSI+NNが最も精度が高い Deep. Simと比較して,LSI+NNの方が精度が高い 12 Department of Computer Science, Graduate School of Information Science and Technology, Osaka University
GCJ を用いた実行時間評価:概要 • Google Code Jam(GCJ)を用いた実行時間評価 • データセット全体の 9割を学習し, 1割を推定するために所要した時間を測定 • 実験環境 – CPU: Xeon E 5 2. 7 GHz 4コア – GPU: Quadro 5000 16 GB – メモリ: 32 GB 13 Department of Computer Science, Graduate School of Information Science and Technology, Osaka University
GCJ を用いた実行時間評価:結果 学習時間 70, 503 [秒] 27 [秒] LSI 210 [秒] 21 [秒] LDA 228 [秒] 21 [秒] PV-DBo. W 224 [秒] 25 [秒] PV-DM 533 [秒] 25 [秒] WV-avg 256 [秒] 25 [秒] Deep. Sim 提案手法 推定時間 学習時間 提案手法の方が約350倍高速 推定時間 すべて同程度 14 Department of Computer Science, Graduate School of Information Science and Technology, Osaka University
BCB を用いた精度評価:結果 再現率 適合率 F値 0. 98 0. 97 0. 98 LSI 0. 9955 0. 9996 0. 9976 LDA 0. 9950 0. 9995 0. 9972 PV-DBo. W 0. 9993 0. 9994 PV-DM 0. 9987 0. 9992 0. 9989 WV-avg 0. 9981 0. 9994 0. 9987 Deep. Sim 提案手法 ※ Deep. Sim は論文より引用 全体的に提案手法はDeep. Simより精度が高い 16 Department of Computer Science, Graduate School of Information Science and Technology, Osaka University
- Slides: 19