Predicting the Understandability of Computational Notebooks through Code Metrics Analysis

Fuente: arXiv
Salvato in:
Dettagli Bibliografici
Autori principali: Ghahfarokhi, Mojtaba Mostafavi, Asadi, Alireza, Asgari, Arash, Mohammadi, Bardia, Heydarnoori, Abbas, Rizi, Masih Beigi
Natura: Preprint
Pubblicazione: 2024
Soggetti:
Accesso online:
Tags: Aggiungi Tag
Nessun Tag, puoi essere il primo ad aggiungerne!!
_version_ 1866908410920828928
author Ghahfarokhi, Mojtaba Mostafavi
Asadi, Alireza
Asgari, Arash
Mohammadi, Bardia
Heydarnoori, Abbas
Rizi, Masih Beigi
author_facet Ghahfarokhi, Mojtaba Mostafavi
Asadi, Alireza
Asgari, Arash
Mohammadi, Bardia
Heydarnoori, Abbas
Rizi, Masih Beigi
contents Computational notebooks are the primary coding tools for data scientists, but their code quality remains understudied and often poor. Given the importance of maintainability and reusability, enhancing code understandability is essential. Traditional methods for assessing understandability typically rely on limited questionnaires or metadata like likes and votes, which may not reflect actual code clarity. To address this, we propose a novel approach that leverages user opinions from software repositories to assess the understandability of Jupyter notebooks. We conducted a case study using 542,051 Kaggle Jupyter notebooks compiled in the DistilKaggle dataset. To identify user comments related to code understandability, we used a fine-tuned DistilBERT transformer. We then introduced a new metric, i.e., User Opinion Code Understandability (UOCU), based on the number of relevant comments, their upvotes, and notebook views. UOCU proved significantly more effective than prior methods. We further enhanced it by combining UOCU with total upvotes in a hybrid approach. Using this improved metric, we collected 34 notebook-level metrics from 132,723 final notebooks and trained machine learning models to predict understandability. Our best model, a Random Forest classifier, achieved 89% accuracy in classifying the understandability level of notebook code. This work demonstrates the value of user opinion signals and notebook metrics in building scalable, accurate measures of code understandability.
format Preprint
id arxiv_https___arxiv_org_abs_2406_10989
institution arXiv
publishDate 2024
record_format arxiv
spellingShingle Predicting the Understandability of Computational Notebooks through Code Metrics Analysis
Ghahfarokhi, Mojtaba Mostafavi
Asadi, Alireza
Asgari, Arash
Mohammadi, Bardia
Heydarnoori, Abbas
Rizi, Masih Beigi
Software Engineering
Artificial Intelligence
Computational notebooks are the primary coding tools for data scientists, but their code quality remains understudied and often poor. Given the importance of maintainability and reusability, enhancing code understandability is essential. Traditional methods for assessing understandability typically rely on limited questionnaires or metadata like likes and votes, which may not reflect actual code clarity. To address this, we propose a novel approach that leverages user opinions from software repositories to assess the understandability of Jupyter notebooks. We conducted a case study using 542,051 Kaggle Jupyter notebooks compiled in the DistilKaggle dataset. To identify user comments related to code understandability, we used a fine-tuned DistilBERT transformer. We then introduced a new metric, i.e., User Opinion Code Understandability (UOCU), based on the number of relevant comments, their upvotes, and notebook views. UOCU proved significantly more effective than prior methods. We further enhanced it by combining UOCU with total upvotes in a hybrid approach. Using this improved metric, we collected 34 notebook-level metrics from 132,723 final notebooks and trained machine learning models to predict understandability. Our best model, a Random Forest classifier, achieved 89% accuracy in classifying the understandability level of notebook code. This work demonstrates the value of user opinion signals and notebook metrics in building scalable, accurate measures of code understandability.
title Predicting the Understandability of Computational Notebooks through Code Metrics Analysis
topic Software Engineering
Artificial Intelligence
url https://arxiv.org/abs/2406.10989