Skip to content

Latest commit

 

History

History
163 lines (133 loc) · 8.56 KB

File metadata and controls

163 lines (133 loc) · 8.56 KB

AGENT.MD: ML HACKATHON OPTIMIZATION & PREDICTIVE MODELING GUIDELINES

Executive Summary & Challenge Overview

  • Competition Title: ML Hackathon: The Predictive Modeling Optimization Challenge
  • Domain: Chemical Engineering & Machine Learning (Surrogate Modeling)
  • Goal: Build a data-driven machine learning surrogate model to predict the Overall Yield of Product B (overall_yield) in a continuous non-isothermal chemical reactor operating under series-parallel reaction kinetics.
  • Core Objective: Replace computationally expensive Computational Fluid Dynamics (CFD) and Boundary Value Problem (BVP) differential equation solvers with an instant, highly accurate ML surrogate model.

1. Physical & Chemical System Understanding

Reaction Mechanism

The reactor handles a non-isothermal continuous flow reaction network (Plug Flow / CSTR dynamics):

  1. Desired Reaction: $A \xrightarrow{k_1} B$ (Rate constant $k_1$)
  2. Side Reaction (Decomposition): $B \xrightarrow{k_2} C$ (Rate constant $k_2$)

Physical Trade-offs & Dynamics

  • Kinetic Sensitivity: Temperature dictates rate constants $k_1$ and $k_2$ via the Arrhenius equation: $$k = A \cdot \exp\left(-\frac{E_a}{R \cdot T}\right)$$
  • Yield Curve Non-Linearity:
    • At low temperatures or short residence times, conversion of $A \to B$ is insufficient (low yield of B).
    • At optimal temperatures and residence times, yield of B peaks.
    • At excessively high temperatures or long residence times, product B rapidly undergoes side-reaction $B \to C$ (over-cracking), causing yield of B to drop to 0.0%.
  • Heat Transfer Dynamics: The reactor feed enters at inlet_temperature_K and is heated/cooled by an external jacket at jacket_temperature_K.

2. Dataset Specifications

File Inventory

File Name Row Count Columns Description
train_dataset.csv 150 rows 6 columns Input features + target overall_yield
test_dataset.csv 50 rows 5 columns Unseen operating conditions for evaluation

Features & Target Schema

Field Name Type Unit Description & Role
flow_rate_L_min Float L/min Volumetric flow rate ($F$). Inverse indicator of residence time.
concentration_mol_L Float mol/L Inlet concentration of Reactant A ($C_{A0}$).
inlet_temperature_K Float K Temperature of incoming feed stream ($T_{in}$).
length_m Float m Reactor length ($L$). Directly proportional to reactor volume ($V$).
jacket_temperature_K Float K Temperature of heating jacket ($T_{jacket}$). Controls thermal driving force.
overall_yield Float % Target variable: Yield percentage of Product B at reactor exit.

3. Domain-Specific Feature Engineering Strategy

To win Phase 2 and maximize Phase 1 RMSE performance, raw features must be transformed into kinetic and thermodynamic proxies:

1. Hydrodynamic & Kinetic Residence Time Proxies

  • Space Time / Residence Time Proxy ($\tau$): $$\tau \propto \frac{\text{length_m}}{\text{flow_rate_L_min}}$$
  • Linear Velocity / Flow Ratio: $$v_{\text{rel}} = \frac{\text{flow_rate_L_min}}{\text{length_m}}$$
  • Total Inlet Molar Flow Proxy: $$\dot{n}_{A0} \propto \text{flow_rate_L_min} \times \text{concentration_mol_L}$$
  • Reactant Holding Capacity (Space-Time Molar Load): $$\text{Load} = \frac{\text{length_m} \cdot \text{concentration_mol_L}}{\text{flow_rate_L_min}}$$

2. Thermal Driving Force & Reaction Temperature Proxies

  • Thermal Differential ($\Delta T$): $$\Delta T = \text{jacket_temperature_K} - \text{inlet_temperature_K}$$
  • Effective Mean Temperature ($T_{\text{avg}}$): $$T_{\text{avg}} = \frac{\text{inlet_temperature_K} + \text{jacket_temperature_K}}{2}$$
  • Weighted Log-Mean Temperature Proxy: $$T_{\text{log_mean}} = \frac{\text{jacket_temperature_K} - \text{inlet_temperature_K}}{\ln(\text{jacket_temperature_K} / \text{inlet_temperature_K})}$$

3. Arrhenius Rate Approximations

  • Arrhenius Temperature Factors: $$f_{T_in} = \exp\left(-\frac{1000}{\text{inlet_temperature_K}}\right), \quad f_{T_jacket} = \exp\left(-\frac{1000}{\text{jacket_temperature_K}}\right)$$
  • Estimated Kinetic-Time Product (Reaction Severity Index): $$\text{Severity} = \tau \times \exp\left(-\frac{1000}{T_{\text{avg}}}\right)$$

4. Modeling Architecture & Two-Stage Pipeline

Because overall_yield exhibits strict boundary truncation at 0.0 (due to complete decomposition or unviability), a Two-Stage Classification + Regression Pipeline is recommended:

                          +-------------------------+
                          |   Input Features +      |
                          | Engineered Physical Factors|
                          +------------+------------+
                                       |
                                       v
                         +---------------------------+
                         | Stage 1: Zero-Yield Classifier |
                         | (Predicts: Is Yield > 0?) |
                         +-------------+-------------+
                                       |
                   +-------------------+-------------------+
                   |                                       |
           If Prob(Yield > 0) < Threshold         If Prob(Yield > 0) >= Threshold
                   |                                       |
                   v                                       v
         Set Yield = 0.0                     +----------------------------+
                                             | Stage 2: Regression Model  |
                                             | (Predicts Continuous Yield)|
                                             +--------------+-------------+
                                                            |
                                                            v
                                                  Final Yield Prediction
                                                  (Clipped to [0, 100])

Candidate Algorithms to Ensemble

  1. Gradient Boosting Models: LightGBM, XGBoost, CatBoost
  2. Tree Ensembles: ExtraTreesRegressor, Random Forest
  3. Linear / Regularized Models: Ridge, ElasticNet, Kernel Ridge
  4. Symbolic Regression: PySR / gplearn (to discover closed-form chemical equations)
  5. Multi-Layer Perceptron (MLP): PyTorch / Scikit-Learn MLPRegressor for smooth physics approximations

5. Validation & Evaluation Protocol

Metric

  • Primary Metric: Root Mean Squared Error (RMSE) $$\text{RMSE} = \sqrt{\frac{1}{n} \sum_{i=1}^{n} (y_i - \hat{y}_i)^2}$$

Validation Strategy

  • Repeated Stratified K-Fold CV (5-Fold, 5 Repeats):
    • Bin the target overall_yield into strata (including a dedicated bin for overall_yield == 0) to prevent data leakage and guarantee balanced folds across the small dataset (150 samples).
  • Leakage Prevention:
    • All feature scaling and engineering transformations must be fitted strictly on training folds within each CV loop.

6. Submission Guidelines & Formatting

  • File Name: [TeamName].csv (e.g., Fugacity_Predictions.csv)
  • Row Count: Exactly 50 rows matching the index order of test_dataset.csv.
  • Column Header: Exactly 1 column titled overall_yield.
  • Value Formatting: Continuous floats rounded to at least 3 decimal places.
  • Limit: Only 1 final submission allowed on Unstop.

7. Execution Checklist for AI Agent

  • 1. Data Audit & Preprocessing:
    • Load train_dataset.csv.
    • Check missing values, summary statistics, and percentage of zero-yield cases.
  • 2. Feature Engineering:
    • Generate residence time ($\tau$), temperature gradients ($\Delta T$), severity index, and Arrhenius factors.
  • 3. Cross-Validation Setup:
    • Implement 5-Fold Stratified K-Fold cross-validation benchmark script.
  • 4. Baseline & Model Selection:
    • Train single models (XGBoost, CatBoost, LightGBM, Ridge, ExtraTrees).
    • Train Two-Stage (Classifier + Regressor) pipeline.
  • 5. Hyperparameter Tuning & Ensembling:
    • Optimize hyperparameters using Optuna.
    • Blend top performing models using weighted averaging or stacking.
  • 6. Post-Processing & Validation:
    • Enforce bounds ($0.0 \le \text{yield} \le 100.0$).
    • Zero out predictions where Stage 1 classifier predicts zero-yield.
  • 7. Submission & Notebook Output:
    • Export final predictions to [TeamName].csv.
    • Generate clean, fully documented Jupyter Notebook (.ipynb) for Phase 2 presentation.