Skip to content

harshithkumar29/harshith

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Deploy

Deploy Link

Live Demo: https://harshithk-5e98bim4d-harshith-kumars-projects-7f4b7494.vercel.app

Update this link after deployment (e.g., Vercel URL for the frontend). If your backend is hosted separately, ensure NEXT_PUBLIC_API_BASE in frontend/.env.local points to your public FastAPI API URL.

Note: Links like http://localhost:3000 or http://localhost:8000 only work on your own computer while the servers are running. They will not work for others viewing the README on GitHub. Use the public Deploy Link above for sharing.

Student Performance Predictor using Bayes’ Theorem

  • Frontend: Next.js (React) + TailwindCSS + Chart.js
  • Backend: FastAPI (Python)
  • ML: Naive Bayes (scikit-learn)
  • Data: Synthetic CSV

Setup

Backend

  1. Open a terminal in backend/ and create a virtual env (optional).
  2. Install deps: pip install -r requirements.txt
  3. Generate data (optional, backend auto-generates if missing): python generate_student_data.py
  4. Run API: uvicorn main:app --reload --host 0.0.0.0 --port 8000

Frontend

  1. Open a terminal in frontend/.
  2. Install deps: npm install
  3. Run dev server: npm run dev
  4. Optionally configure API URL by creating frontend/.env.local: NEXT_PUBLIC_API_BASE=http://localhost:8000

Pages

  • Home: Title and Bayes’ theorem explanation.
  • Predict: Input form, probability result, factor contribution chart, and report download.
  • Data: Preview of dataset from /sample-data.

API

  • GET /sample-data -> preview rows.
  • POST /predict body: { study_hours, attendance, sleep_hours, internet_usage: 'Low|Medium|High', prev_grade: 'A|B|C|D|F' }

Response: { probability_pass: number, predicted_label: 'Pass'|'Fail', feature_likelihoods: {feature, score}[] }

Notes on Bayes’ theorem

Gaussian Naive Bayes assumes feature independence: log posterior is prior + sum of per-feature log-likelihoods. We normalize the per-feature log-likelihood differences for visualization.

Local Development (run on your machine)

  1. Start backend

  2. Start frontend

  3. If your backend is remote

    • Set NEXT_PUBLIC_API_BASE in frontend/.env.local to your backend URL (e.g., Render):
      • NEXT_PUBLIC_API_BASE=https://YOUR-API.onrender.com
    • Rebuild/redeploy the frontend.

About

Student Performance predictor

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published