Skip to content

Repository files navigation

CS-Predictor — Concrete Compressive Strength Prediction

CI Python License: MIT

An ML-based regression model that predicts the compressive strength of concrete (MPa) using its mix composition and curing age.


📋 Table of Contents


Overview

Concrete compressive strength is a critical property in civil engineering. This project builds, evaluates, and compares several ML regression models to accurately predict it from the following input features:

Feature Unit Description
Cement kg/m³ Cement component
Blast Furnace Slag kg/m³ Slag component
Fly Ash kg/m³ Fly ash component
Water kg/m³ Water content
Superplasticizer kg/m³ Superplasticizer component
Coarse Aggregate kg/m³ Coarse aggregate
Fine Aggregate kg/m³ Fine aggregate
Age days Curing age
Concrete CS MPa Target: compressive strength

Dataset

  • Source: UCI Machine Learning Repository — Concrete Compressive Strength
  • Samples: 1,030 instances
  • Features: 8 input features + 1 target
  • File: data/raw/concrete_data.csv

Project Structure

CS-Predictor/
├── .github/workflows/      # CI/CD pipelines
├── data/
│   ├── raw/                # Original dataset
│   ├── processed/          # Cleaned & preprocessed data
│   └── external/           # External reference data
├── models/
│   ├── trained/            # Serialised model files (.joblib)
│   ├── preprocessing/      # Scaler / encoder files
│   └── metadata/           # Model metrics & metadata JSON
├── notebooks/              # Exploratory & modelling notebooks
├── src/                    # Source package
│   ├── data/               # Data loading & preprocessing
│   ├── features/           # Feature engineering & selection
│   ├── models/             # Training, prediction, selection
│   ├── evaluation/         # Metrics & evaluation helpers
│   ├── visualization/      # Plotting utilities
│   └── pipeline/           # End-to-end training pipeline
├── app/                    # Streamlit prediction app
├── scripts/                # CLI entry-point scripts
├── tests/                  # Unit & integration tests
├── config/                 # YAML configuration files
├── reports/                # Figures, CSVs, HTML reports
├── requirements.txt
└── pyproject.toml

Installation

# 1. Clone the repository
git clone https://github.com/pathumzcode/CS-Predictor-An-ML-Based-Concrete-Compressive-Strength-Prediction-Model.git
cd CS-Predictor-An-ML-Based-Concrete-Compressive-Strength-Prediction-Model

# 2. Create a virtual environment
python -m venv venv
source venv/bin/activate   # Windows: venv\Scripts\activate

# 3. Install dependencies
pip install -r requirements.txt

# 4. Copy and configure environment variables
cp .env.example .env

Usage

Train the Model

python scripts/train_model.py

Evaluate the Model

python scripts/evaluate_model.py

Generate Reports

python scripts/generate_reports.py

Launch the Flask Web App

# Windows PowerShell (using the project venv)
.\venv\Scripts\Activate.ps1
pip install -r requirements.txt
python app\app.py

Open http://127.0.0.1:5000 in your browser.

Run Tests

pytest --cov=src

Model Performance

Model R² RMSE (MPa) MAE (MPa)
Random Forest ~0.92 ~4.5 ~3.1
XGBoost ~0.93 ~4.3 ~2.9
Gradient Boosting ~0.91 ~4.7 ~3.3

Results will be updated after full model training. See reports/evaluation/ for detailed outputs.


Contributing

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/my-feature)
  3. Commit your changes (git commit -m 'Add my feature')
  4. Push to the branch (git push origin feature/my-feature)
  5. Open a Pull Request into main

License

Distributed under the MIT License. See LICENSE for more information.

About

CS-Predictor ML is a Machine Learning-based regression model designed to predict the compressive strength of concrete using its mix composition and age. The project includes data preprocessing, exploratory data analysis, feature engineering, model training, evaluation, and performance comparison to develop an accurate and reliable prediction model.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages