Skip to content

feat(ml): train fix success predictor #180 - #347

Open
prasiddhi-105 wants to merge 4 commits into
ionfwsrijan:mainfrom
prasiddhi-105:feature/train-fix-success-predictor-180
Open

feat(ml): train fix success predictor #180#347
prasiddhi-105 wants to merge 4 commits into
ionfwsrijan:mainfrom
prasiddhi-105:feature/train-fix-success-predictor-180

Conversation

@prasiddhi-105

Copy link
Copy Markdown

Linked issue

Closes #180

What this PR does

Adds a training script (backend/scripts/train_fix_predictor.py) that fits a Logistic Regression model to predict whether proposed code fixes will pass verification. It reads telemetry data from SQLite or CSV, one-hot encodes features, evaluates performance (accuracy and ROC-AUC) on a 20% test split, and serializes the resulting model to backend/app/ml/models/fix_predictor.pkl.

Type of change

  • Bug fix
  • New feature
  • ML model / training pipeline
  • Refactor (no behaviour change)
  • Documentation
  • Tests only

ML tier (if applicable)

  • Tier 1 — Triage
  • Tier 2 — Predictive
  • Tier 3 — Autonomous
  • Not ML-related

Stack affected

  • Backend
  • Frontend
  • Both

Changes

Backend

  • Created backend/scripts/train_fix_predictor.py:
    • Supports loading telemetry data from SQLite DB or CSV.
    • Enforces minimum sample size (≥ 100 rows) requirement and exits gracefully if data is insufficient.
    • One-hot encodes categorical variables and splits data into an 80/20 train/test split.
    • Fits a LogisticRegression model and outputs accuracy and ROC-AUC scores to stdout.
    • Saves the trained model to backend/app/ml/models/fix_predictor.pkl.
    • Added CLI argument parsing including --help flag support.
  • Updated .gitignore to ensure .pkl model files are ignored.

Frontend

  • No frontend changes.

New dependencies

  • No new dependencies added (scikit-learn, pandas, and joblib are already present).

Database / schema changes

  • No schema changes.

Testing

How did you test this?

  • Tested --help flag: python backend/scripts/train_fix_predictor.py --help.
  • Verified script execution when dataset < 100 samples (correctly prints requirement message and exits).
  • Confirmed fix_predictor.pkl is excluded by .gitignore.

Checklist

  • Tested locally end-to-end
  • New ML model falls back gracefully when model file is absent
  • No new console.error or unhandled Python exceptions introduced
  • Added or updated tests where applicable
  • requirements.txt / package.json updated if new dependencies added
  • New model files (.pkl, .pt, etc.) are gitignored, not committed

Anything reviewers should focus on

Please check feature encoding and metric calculations in train_fix_predictor.py.

Screenshots (if UI changed)

N/A (CLI training script)

@github-actions

Copy link
Copy Markdown

🎉 Thank you @prasiddhi-105 for submitting a Pull Request!

We're excited to review your contribution.

✅ Before Review

  • Ensure all CI checks pass.
  • Complete the PR template.
  • Link the related issue.

Want faster reviews and contributor support?

Join our Discord community:

🔗 https://discord.gg/FcXuyw2Rs

Maintainers and mentors are active there and can help resolve blockers quickly.

Happy Contributing! 🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature] Train fix success predictor

1 participant