Use this path if you only need to reproduce the final RQ1 v2 and RQ2 v2 analysis notebooks for grading or review.
The repository already includes the prebuilt result files:
results/rq1_main_frame.parquetresults/rq1_main_frame_v2.parquetresults/rq1_szz_pairs.parquet
Because those files are already checked in, you do not need to set up .env, call the GitHub API, or rebuild the main frames just to rerun the notebooks.
git clone <repo-url>
cd CS260-MBILLMCpython3 -m venv .venv
source .venv/bin/activate
python -m pip install --upgrade piprequirements.txt covers the core pipeline dependencies. The notebooks also need the analysis stack.
pip install -r requirements.txt
pip install matplotlib seaborn scipy statsmodels jupyterlab nbconvert ipykernelInteractive:
jupyter lab notebooks/rq1_v2_analysis.ipynb notebooks/rq2_v2_analysis.ipynbHeadless execution:
jupyter nbconvert --to notebook --execute notebooks/rq1_v2_analysis.ipynb --output rq1_v2_analysis.executed.ipynb
jupyter nbconvert --to notebook --execute notebooks/rq2_v2_analysis.ipynb --output rq2_v2_analysis.executed.ipynbNotes:
notebooks/rq1_v2_analysis.ipynbreads../results/rq1_main_frame_v2.parquet,../results/rq1_szz_pairs.parquet, and../results/rq1_main_frame.parquet.notebooks/rq2_v2_analysis.ipynbreads../results/rq1_main_frame_v2.parquet.- If you are only reproducing the submitted results, you can stop here.
Use this path if you want to rebuild the data products from the raw upstream datasets and regenerate the v2 SZZ-backed outputs yourself.
- Python 3.9+ recommended
- Git
- Docker
- Java runtime available on
PATH - Internet access for:
- Hugging Face parquet datasets
- GitHub API requests
- cloning repositories for SZZ
- A GitHub personal access token for the ingest pipeline
git clone <repo-url>
cd CS260-MBILLMCpython3 -m venv .venv
source .venv/bin/activate
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install matplotlib seaborn scipy statsmodels jupyterlab nbconvert ipykernelCopy the template and set your GitHub token:
cp env.example .envenv.example currently expects:
GITHUB_TOKEN=YOUR_TOKENThe ingest script loads .env automatically. Without a token, GitHub API calls will be heavily rate-limited.
This stage creates results/rq1_main_frame.parquet and results/rq1_main_frame.csv.
Full run:
python scripts/rq1_ingest.pyUseful variants:
python scripts/rq1_ingest.py --resume
python scripts/rq1_ingest.py --target_count 100
python scripts/rq1_ingest.py --resume --target_count 100
python scripts/rq1_ingest.py --resume --skip-age
python scripts/rq1_ingest.py --recompute-defects
python scripts/rq1_ingest.py --recompute-locWhat these do:
--resume: continue fromdata/processed/rq1_checkpoint.parquet--target_count N: limit the number of repositories processed--skip-age: skip the repository age step--recompute-defects: recompute only the original defect columns on an existing checkpoint--recompute-loc: recompute onlypr_size_locand dependentfix_sizecolumns on an existing checkpoint
Key outputs and caches:
results/rq1_main_frame.parquetresults/rq1_main_frame.csvdata/processed/rq1_checkpoint.parquet
This stage consumes results/rq1_main_frame.parquet, generates SZZ issue lists and bug-introducing/fixing pairs, and writes the v2 dataset.
Full run with conservative checkpointing:
python scripts/rq1_v2.py --resume --checkpoint-every 1 --szz-timeout 60Useful variants:
python scripts/rq1_v2.py --resume
python scripts/rq1_v2.py --repo "microsoft/TypeScript"
python scripts/rq1_v2.py --limit-repos 25
python scripts/rq1_v2.py --resume --limit-repos 25 --checkpoint-every 1
python scripts/rq1_v2.py --resume --refresh-repos
python scripts/rq1_v2.py --resume --refresh-szz
python scripts/rq1_v2.py --resume --cleanup-repos
python scripts/rq1_v2.py --resume --checkpoint-every 1 --szz-timeout 120What these do:
--resume: reusedata/processed/rq1_v2_checkpoint.parquetand any cached SZZ outputs--repo "owner/repo": process a single repository cohort--limit-repos N: process only the firstNrepositories--refresh-repos: refetch cached Git repositories before SZZ analysis--refresh-szz: rerun SZZ even if cached results already exist--cleanup-repos: delete cloned repositories after processing to save disk--checkpoint-every N: save the v2 checkpoint everyNrepositories--szz-timeout M: stop SZZ afterMminutes per repository and keep partial results when possible
Important implementation details:
scripts/rq1_v2.pybuilds SZZUnleashed with Docker if a jar is not already available.- It then runs the jar locally with
java -jar ..., so Java must also be installed. - Repository clones and SZZ artifacts are cached under
data/cache/.
Key outputs and caches:
results/rq1_main_frame_v2.parquetresults/rq1_main_frame_v2.csvresults/rq1_szz_pairs.parquetdata/processed/rq1_v2_checkpoint.parquetdata/cache/repos/data/cache/szz_issue_lists/data/cache/szz_results/
Optional: if you already have a built SZZ jar, you can point the pipeline at it:
export RQ1_V2_SZZ_JAR=/absolute/path/to/szz_find_bug_introducers-<version>.jar
python scripts/rq1_v2.py --resumeAfter rebuilding the datasets, rerun the notebooks so figures and model outputs are regenerated from the new parquet files.
Interactive:
jupyter lab notebooks/rq1_v2_analysis.ipynb notebooks/rq2_v2_analysis.ipynbHeadless:
jupyter nbconvert --to notebook --execute notebooks/rq1_v2_analysis.ipynb --output rq1_v2_analysis.executed.ipynb
jupyter nbconvert --to notebook --execute notebooks/rq2_v2_analysis.ipynb --output rq2_v2_analysis.executed.ipynbIf you are rebuilding everything from scratch, run the project in this order:
- Set up the virtual environment and install dependencies.
- Create
.envwithGITHUB_TOKEN. - Run
python scripts/rq1_ingest.py --resume. - Run
python scripts/rq1_v2.py --resume --checkpoint-every 1 --szz-timeout 60. - Run
notebooks/rq1_v2_analysis.ipynb. - Run
notebooks/rq2_v2_analysis.ipynb.
- The v1 notebooks are still present:
notebooks/rq1_analysis.ipynbnotebooks/rq2_analysis.ipynb
- The submitted v2 analysis notebooks are:
notebooks/rq1_v2_analysis.ipynbnotebooks/rq2_v2_analysis.ipynb
- For a quick grading pass, the v2 notebooks are the ones you want.
Setup instructions are similar. The human PR related data is hosted on a Google Drive (https://drive.google.com/drive/folders/19iCMv_kun9cSCByykRYFbcRK1HwHZs6o?usp=drive_link) To get started:
- Open the shared Google Drive folder using the link above.
- Copy the files to your own Google Drive.
Once the data is in place, simply execute the notebook RQ3_Analysis.ipynb
All results and analysis are contained within the notebook itself.