This machine learning model predicts relationship compatibility based on behavioral, emotional, and psychological features from two individuals. The system classifies their connection into one of three categories:
0– Just Friends1– Could Work Out2– Strong Match
It uses a trained XGBoost classifier (94.5% accuracy) and supports Random Forest (88.6% accuracy) as an alternative. A web-based quiz interface collects answers for 30 relationship-based questions and sends them to the ML backend for prediction.
git clone https://github.com/<your-username>/LOVE_PREDICT_ML_MODEL.git
cd LOVE_PREDICT_ML_MODEL
# (Optional) Create virtual environment
python3 -m venv venv
source venv/bin/activate # Windows: venv\Scripts\activate
# Install dependencies
pip install -r requirements.txtOr manually:
pip install pandas scikit-learn xgboost joblib flaskpython train_model.pyThis will:
- Load your dataset (CSV)
- Train the XGBoost model
- Save:
xgb_model.pkl– trained modelscaler.pkl– fitted StandardScaler
- Start your Flask server:
python app.py- Send a POST request with all 30 features:
curl -X POST http://localhost:5000/predict \
-H "Content-Type: application/json" \
-d '{ "communication_frequency": 8, "trust_score": 9, ..., "reaction_to_praise": 2 }'- Output:
{
"prediction": 2
}The frontend (HTML/CSS/JS) provides:
- A landing page with explanation
- A 30-question quiz (1 question at a time)
- Disclaimer + accuracy notice
- Sends input to
/predictendpoint and shows compatibility result
LOVE_PREDICT_ML_MODEL/
│
├── model/
│ ├── xgb_model.pkl # Trained model
│ ├── scaler.pkl # StandardScaler
│
├── backend/
│ ├── app.py # Flask app for prediction
│ ├── train_model.py # Model training script
│
├── frontend/
│ ├── index.html # Landing page
│ ├── quiz.html # Quiz form
│ ├── styles.css # UI styling
│ ├── script.js # Question logic + animation
│
├── data/
│ ├── your_dataset.csv # 30-feature CSV with labels
│
└── README.md
- This tool is for entertainment and educational use only.
- It is not meant for serious relationship decisions.
- Accuracy:
- XGBoost: 94.5%
- Random Forest: 88.6%
pandasscikit-learnxgboostjoblibflask- (Optional)
uvicorn,fastapiif using a FastAPI backend
Deepan
Made with for AI + Relationship Fun
This project is open-sourced under the MIT License.