Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Manufacturing Batch Clustering System

An end-to-end Machine Learning and web application for classifying industrial chemical production batches into operational performance clusters using K-Means clustering.


📌 Table of Contents

  1. Overview
  2. Project Architecture
  3. Features
  4. Machine Learning Model & Clusters
  5. Project Structure
  6. Setup & Installation
  7. API Endpoints

🔬 Overview

This project classifies chemical batch manufacturing data in real-time. By analyzing 10 key production variables (such as temperature, pressure, reaction time, yield, purity, and energy consumption), an unsupervised K-Means Clustering model assigns each batch to one of three operational quality categories.


🏗 Project Architecture

The application is structured into a modern two-tier architecture:

  • Frontend (React + Vite + CSS3): A clean, responsive industrial UI that collects process input variables and presents real-time cluster classifications.
  • Backend (Python Flask + Scikit-Learn): REST API service that accepts JSON payload, scales inputs with a pre-trained StandardScaler, and predicts the cluster using a trained KMeans model (joblib).
graph TD
    UI[React Frontend UI] -->|POST /get_clusters| API[Flask Backend API]
    API --> SCALER[StandardScaler - scaler.pkl]
    SCALER --> MODEL[K-Means Model - kmeans_model.pkl]
    MODEL -->|Cluster ID| API
    API -->|JSON Response: Cluster, Name, Description| UI
Loading

✨ Features

  • Real-time Batch Classification: Predicts cluster membership instantly upon form submission.
  • Multi-variable Parameter Input: Evaluates 10 distinct physical & chemical metrics:
    • Temperature (°C) & Pressure (atm)
    • Reaction Time (min) & Cooling Time (min)
    • Catalyst Loading (%) & pH Level
    • Yield (%) & Purity (%)
    • Energy (kWh) & Mixing Speed (RPM)
  • Pre-trained ML Models: Uses Scikit-Learn KMeans and StandardScaler loaded via joblib.
  • Clean Industrial UI: Responsive React interface designed with an emphasis on clarity and accessibility.

📊 Machine Learning Model & Clusters

The model segments production batches into three distinct operational profiles:

Cluster ID Cluster Name Profile & Description
0 Optimised Production High purity and yield accompanied by low operating costs.
1 Standard Production Moderate purity and yield with baseline production costs.
2 High Risk Production Low purity and yield paired with high energy/operating costs.

📁 Project Structure

manifacturing_batch_clustering_system/
│
├── backend/                  # Flask REST API
│   ├── app.py                # Main Flask application & routes
│   ├── requirments.txt       # Python dependencies
│   └── model/                # Pre-trained ML models
│       ├── kmeans_model.pkl  # Trained KMeans model
│       └── scaler.pkl        # Fitted StandardScaler object
│
├── batch-clustering/         # React Frontend (Vite)
│   ├── src/
│   │   ├── App.jsx           # Parent App component
│   │   ├── FormData.jsx      # Batch parameter input form & result display
│   │   ├── index.css         # Styling rules & design system
│   │   └── main.jsx          # Entry point
│   ├── package.json          # Node dependencies
│   └── vite.config.js        # Vite configuration
│
├── data/                     # Raw & processed manufacturing datasets
└── clustering_system.ipynb   # Jupyter Notebook for EDA, preprocessing, and model training

🚀 Setup & Installation

Prerequisites

  • Python 3.8+
  • Node.js 16+ & npm

1. Backend Setup (Flask API)

  1. Navigate to the backend directory:

    cd backend
  2. Create and activate a Python virtual environment:

    python -m venv venv
    # On Windows:
    venv\Scripts\activate
    # On macOS/Linux:
    source venv/bin/activate
  3. Install required dependencies:

    pip install flask flask-cors joblib pandas scikit-learn
  4. Start the Flask API server:

    python app.py

    The server runs locally at http://127.0.0.1:5001/


2. Frontend Setup (React + Vite)

  1. Open a new terminal and navigate to the frontend directory:

    cd batch-clustering
  2. Install Node packages:

    npm install
  3. Start the Vite development server:

    npm run dev
  4. Open your browser and navigate to http://localhost:5173/ (or the URL outputted by Vite).


🔌 API Endpoints

GET /

  • Description: Health check endpoint.
  • Response: "Manufacturing API is running Successfully"

POST /get_clusters

  • Description: Accepts batch metrics and returns predicted cluster info.
  • Request Body Example:
    {
      "temperature": 129,
      "pressure": 2.5,
      "reaction_time": 45,
      "catalyst_loading": 1.2,
      "pH": 7.0,
      "yield_pct": 94.5,
      "purity_pct": 98.2,
      "energy": 320,
      "cooling_time": 15,
      "mixing_speed": 1500
    }
  • Response Example:
    {
      "status": "success",
      "cluster": 0,
      "name": "Optimised Production",
      "description": "High Purity and Yield with low Operating Cost"
    }

📄 License

This repository is maintained for industrial manufacturing process analytics.

About

AM L and web application for classifying industrial chemical production batches into operational performance clusters using K-Means clustering. Flask REST API backend and React + Vite frontend with real-time batch classification.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages