Skip to content

Latest commit

 

History

3 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 

Repository files navigation

🌱 SpringForge — Architecture Classifier

Large-scale dataset generation & machine learning pipeline for Spring Boot architecture prediction

SpringForge Architecture Classifier is the data collection, feature extraction, and machine learning training pipeline used to automatically detect the architectural style of Spring Boot projects:

  • MVC Architecture
  • Layered Architecture
  • Clean Architecture

This repository powers the architecture prediction backend used by the SpringForge IntelliJ Plugin, enabling architecture-aware code generation using LLMs.


📌 Repository Purpose

This repository provides:

✔ 1. Large-scale GitHub mining

Collect thousands of Spring Boot repositories using keyword & time-range-based crawling.

✔ 2. Static code analysis engine

Extract 58 high-signal architecture features using staticAnalyzer.py.

✔ 3. Dataset builder

Generate high-quality supervised datasets for model training.

✔ 4. Full ML training notebook

A complete notebook for:

  • Data exploration
  • Visualization
  • Preprocessing
  • Dimensionality reduction (PCA)
  • Model training & tuning (RandomForest)
  • Model export

✔ 5. Trained model artifacts

Used directly by the production FastAPI backend & IntelliJ plugin.


🏗️ Repository Structure

SPRINGFORGE-ARCHITECTURE-CLASSIFIER/
│
├── Data Extraction/
│   ├── Scripts/
│   │   ├── staticAnalyzer.py
│   │   ├── architecture_features_advanced.csv
│   │   ├── architecture_features_v2.csv
│
├── Data Gathering \ Scripts/
│   ├── collect_repos.py
│
├── Machine Learning Pipeline/
│   ├── Final Dataset/
│   │   ├── balanced_architecture_dataset.csv
│   │   ├── balanced_architecture_final.csv
│
├── Notebook Files/
│   ├── SpringForge_Architecture_Prediction.ipynb
│   ├── SpringForge_Code_Generation.ipynb
│
└── README.md

🔎 1. GitHub Repository Collector

File: collect_repos.py
Automatically collects and organizes Spring Boot repositories based on:

  • Keywords
  • Year slicing
  • Stars & relevance
  • Pagination & rate limiting

🧠 2. Static Architecture Feature Extractor

File: staticAnalyzer.py

Extracts 58 features, including:

  • Layer inference
  • Cross-layer dependency counts
  • Spring stereotype usage
  • JPA + domain entities
  • File-role detection
  • LOC, class count, method count
  • DTO indicators
  • Spring Web, Data, Boot imports

Outputs:

architecture_features_v2.csv
architecture_features_advanced.csv

📘 3. Dataset Processing & Machine Learning Pipeline

Included Notebook

SpringForge_Architecture_Prediction.ipynb

Contains:

  • EDA (distributions, correlations, imbalance analysis)
  • Preprocessing + feature cleaning
  • PCA dimensionality reduction
  • RandomForest training
  • Hyperparameter tuning
  • Performance evaluation
  • Model export (PCA + RF + scalers + encoders)

Model Performance (Balanced Dataset)

Architecture F1 Score
MVC 0.94
Layered 0.92
Clean 0.89

Overall: 0.91 macro F1


🧪 4. Final Dataset

Located under:

Machine Learning Pipeline / Final Dataset/

Files:

  • balanced_architecture_final.csv
  • balanced_architecture_dataset.csv

Both contain:

  • 6000 MVC samples
  • 6000 Layerated samples
  • 6000 Clean samples

🧩 5. Trained Model Artifacts

Stored in:

Trained Artifacts/

These include:

  • scaler.pkl
  • pca_encoder.pkl
  • rf_pca_model.pkl
  • label_encoder.pkl

Used later by the SpringForge backend (FastAPI) & plugin.


🚀 6. Usage Workflow

1️⃣ Collect Repositories

python collect_repos.py

2️⃣ Extract Features

python staticAnalyzer.py

3️⃣ Train Model

Open Notebook → run all cells.

4️⃣ Export Model

Artifacts automatically saved under Trained Artifacts.


📄 License

MIT License (or your preferred license)


🤝 Contributing

Pull requests, issue reports, and feature suggestions are welcome.


🌟 Acknowledgements

This project powers the SpringForge ecosystem, enabling automated architecture-aware Spring Boot project generation and analysis.

About

This repository contains the machine-learning pipeline, experiments, curated datasets, feature extraction utilities, and trained models required to classify Spring Boot software architectures (Layered / MVC / Clean Architecture) for the SpringForge IntelliJ plugin.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages