Skip to content

Repository files navigation

MFP Analyzer

Machine Failure Prediction Web Application

INSY 4325 — Group 12


Quick Start

Windows

Double-click run.bat

Mac / Linux

chmod +x run.sh
./run.sh

Then open http://localhost:5050 in your browser.


Login Credentials

Username Password Role
admin admin123 Admin
analyst analyst123 Data Analyst
engineer engineer123 Maintenance Engineer

How to Use

Step 1 — Clean Data

  • Go to Clean Data in the sidebar
  • Upload sample_data.csv (included) or your own CSV
  • Select cleaning options and click Import & Clean

Expected CSV columns:

Type, Air temperature [K], Process temperature [K],
Rotational speed [rpm], Torque [Nm], Tool wear [min], Machine failure

Step 2 — Select Algorithm

  • Click Test & Score All Algorithms
  • Compare AUC, F1, Precision, Recall across 4 algorithms
  • Click Use this on your preferred algorithm

Step 3 — Train Model

  • Click Train Model to fit on the full cleaned dataset
  • The trained model is saved to the SQLite database
  • Click Deploy to activate the model for predictions

Step 4 — Predict

  • Enter live sensor readings
  • Click Predict to get a risk classification:
    • 🔴 HIGH (≥70%) — immediate action required
    • 🟡 MEDIUM (40–69%) — inspect within 72 hours
    • 🟢 LOW (<40%) — continue normal operations
  • Every prediction is automatically logged to the database

Project Structure

mfp_analyzer/
├── app.py                   Flask application & all routes
├── ml_engine.py             ML pipeline (cleaning, training, prediction)
├── generate_sample_data.py  Synthetic dataset generator
├── sample_data.csv          Ready-to-use sample dataset (2000 rows)
├── requirements.txt
├── run.bat                  Windows launcher
├── run.sh                   Mac/Linux launcher
├── database/
│   └── db.py                SQLite schema, seed users, helpers
└── templates/
    ├── base.html            Sidebar layout & dark theme
    ├── login.html
    ├── dashboard.html
    ├── clean.html
    ├── algorithm.html
    ├── train.html
    ├── predict.html
    └── history.html

Database Schema (SQLite)

Table Key Fields
users user_id, username, password (hashed), role
datasets dataset_id, file_name, row_count, feature_count
cleaning_configs config_id, dataset_id, all cleaning option flags
training_sessions session_id, dataset_id, algorithm, k_folds
ml_models model_id, session_id, metrics, is_deployed, blob
prediction_records prediction_id, model_id, timestamp, risk_class, all inputs

ML Algorithms

Algorithm Strength
Logistic Regression Fast, interpretable, strong AUC
Naive Bayes Works well with small datasets
Decision Tree Highly interpretable
KNN Good non-parametric baseline

Evaluation uses Stratified K-Fold Cross-Validation (default k=5).


Requirements

  • Python 3.10+
  • flask, scikit-learn, pandas, numpy

Install manually: pip install -r requirements.txt

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages