This internship project builds a machine learning model to predict whether a machine is likely to fail based on operational and sensor-related readings.
The goal is to classify machine records into:
0: No failure1: Failure
The final model uses a Random Forest Classifier because it performs well on tabular data, handles non-linear relationships, and provides feature importance for interpretation.
The dataset contains 944 records and the following columns:
| Column | Description |
|---|---|
footfall |
Number of people or activity count around the machine |
tempMode |
Temperature mode value |
AQ |
Air quality reading |
USS |
Ultrasonic sensor reading |
CS |
Current sensor reading |
VOC |
Volatile organic compound reading |
RP |
Rotational position or related machine parameter |
IP |
Input pressure or related machine parameter |
Temperature |
Temperature reading |
fail |
Target variable showing machine failure status |
Target distribution:
- No failure: 551 records
- Failure: 393 records
.
+-- machine_failure_data.csv
+-- major_project_machine_failure.ipynb
+-- src/
| +-- train_model.py
| +-- model_comparison.py
| +-- data_quality_check.py
| +-- predict.py
| +-- run_pipeline.py
| +-- config.py
+-- tests/
| +-- test_project.py
+-- models/
+-- reports/
+-- app.py
+-- sample_input.csv
+-- README.md
+-- PROJECT_REPORT.md
+-- MODEL_CARD.md
+-- PORTFOLIO_NOTES.md
+-- DATA_DICTIONARY.md
+-- TOP_IMPROVEMENTS.md
+-- IMPROVEMENT_TIPS.md
+-- SUBMISSION_CHECKLIST.md
+-- PRESENTATION_OUTLINE.md
+-- requirements.txt
+-- minor_project_python_basics.md
- Load and inspect the dataset.
- Check missing values and class distribution.
- Split the data using a stratified train-test split.
- Train a Random Forest Classifier.
- Evaluate the model using accuracy, precision, recall, F1-score, and confusion matrix.
- Analyze feature importance.
- Save the trained model for reuse.
Install dependencies:
pip install -r requirements.txtRun the training script:
python src/train_model.pyCompare multiple models:
python src/model_comparison.pyGenerate a data quality report:
python src/data_quality_check.pyRun the complete pipeline:
python -m src.run_pipelineRun a sample prediction:
python src/predict.pyRun validation tests:
python -m unittest discover -s testsRun the optional prediction dashboard:
streamlit run app.pyThe trained model will be saved in:
models/random_forest_machine_failure_model.joblib
The metrics report will be saved in:
reports/model_metrics.txt
Additional generated reports:
reports/data_quality_report.txt
reports/feature_summary.csv
reports/model_comparison.csv
reports/feature_importance.csv
reports/test_predictions.csv
Important improvement notes are documented in:
TOP_IMPROVEMENTS.md
IMPROVEMENT_TIPS.md
- Python
- Pandas
- Scikit-learn
- Joblib
- Jupyter Notebook
- Streamlit
- Centralized project configuration in
src/config.py - One-command pipeline runner
- Basic validation tests
- Model card with intended use and limitations
- Portfolio notes for GitHub or resume use
- Test accuracy: 91.01%
- Cross-validation accuracy: 87.29%
- Most important features:
VOC,AQ, andUSS
The project demonstrates an end-to-end machine learning workflow for predictive maintenance. By using sensor and operational features, the model can help identify machine failure risk and support early maintenance decisions.