This project studies the application of Machine Learning techniques to gas sensor array measurements for gas identification and concentration prediction.
The dataset used in this project is the Gas Sensor Array Drift at Different Concentrations Dataset from the UCI Machine Learning Repository.
The Gas Sensor Array Drift at Different Concentrations dataset contains measurements collected from 16 chemical sensors exposed to 6 different gases at various concentration levels.
According to the UCI Machine Learning Repository, the dataset contains:
- 13,910 measurements
- 128 features
- 16 chemical sensors
- 6 gas classes
- Real-valued sensor features
- No missing values
- Data collected over a period of 36 months
- Data organized into 10 batches
The six gases represented in the dataset are:
| Class | Gas |
|---|---|
| 1 | Ethanol |
| 2 | Ethylene |
| 3 | Ammonia |
| 4 | Acetaldehyde |
| 5 | Acetone |
| 6 | Toluene |
The dataset additionally provides the concentration level associated with each measurement, making it suitable for both classification and regression tasks.
Source: UCI Machine Learning Repository Dataset: Gas Sensor Array Drift at Different Concentrations DOI: https://doi.org/10.24432/C5MK6M
Each observation corresponds to one measurement obtained from the sensor array.
The 128-dimensional feature vector is formed from 8 extracted features for each of the 16 sensors.
The eight features associated with each sensor are:
DR|DR|EMAi0.001EMAi0.01EMAi0.1EMAd0.001EMAd0.01EMAd0.1
Therefore:
16 sensors × 8 features per sensor = 128 features
The features describe both steady-state sensor response and dynamic characteristics of the sensor response.
The original dataset is distributed as multiple batch files in .dat format.
The project investigates how machine learning can be used to analyse the responses of a chemical sensor array.
The project is divided into three Machine Learning tracks:
Predict the gas concentration level from the 128 sensor-derived features.
Predict the type of gas from the sensor measurements.
Discover natural groups in the sensor measurements without using gas labels during model fitting.
The Regression and Classification tracks are evaluated in Review 1 and Review 2, while the complete Clustering track is evaluated in Review 2.
The Review 1 implementation covers:
- Dataset loading
- Dataset shape and structure
- Data type inspection
- Missing-value analysis
- Duplicate analysis
- Outlier analysis
- Target distribution
- Feature distributions
- Correlation analysis
- Feature-target relationships
- Conversion of the original
.datformat into a Pandas DataFrame - Separation of input features and targets
- Duplicate checking
- Outlier analysis
- Feature scaling
- Train-test split
- Feature engineering
- Prevention of data leakage
The following ten regression algorithms are implemented:
- Linear Regression
- Ridge Regression
- Lasso Regression
- ElasticNet Regression
- Polynomial Regression
- Decision Tree Regressor
- Random Forest Regressor
- Gradient Boosting Regressor
- Support Vector Regressor
- K-Nearest Neighbors Regressor
The following five classification algorithms are implemented for Review 1:
- Logistic Regression
- K-Nearest Neighbors
- Gaussian Naive Bayes
- Decision Tree Classifier
- Support Vector Classifier
The regression task uses the gas concentration level as the target variable.
Conceptually:
128 Sensor Features
↓
Preprocessing
↓
Feature Engineering
↓
Regression Model
↓
Predicted Gas Concentration
The regression models are evaluated using:
- R² Score
- Root Mean Squared Error (RMSE)
- Mean Absolute Error (MAE)
The two best-performing models are further evaluated using 5-fold cross-validation.
The classification task predicts the gas being measured.
128 Sensor Features
↓
Preprocessing
↓
Classification Model
↓
Predicted Gas Type
The six classes are:
1 → Ethanol
2 → Ethylene
3 → Ammonia
4 → Acetaldehyde
5 → Acetone
6 → Toluene
For Review 1, the following metrics are considered:
- Accuracy
- Weighted Precision
- Weighted Recall
- Weighted F1-score
- Confusion Matrix
The remaining five classification algorithms will be added for the final Review 2 comparison.
The EDA stage investigates:
df.shape
df.info()
df.describe()The UCI dataset reports no missing values.
Therefore, missing-value imputation is not required. Instead, the project verifies the absence of missing observations before continuing with preprocessing.
Duplicate observations are checked and their presence or absence is reported.
Outliers are investigated using appropriate statistical and visual techniques such as:
- Box plots
- Interquartile Range (IQR)
- Distribution plots
Any treatment of outliers is documented and justified.
Feature distributions are examined to understand:
- Range of sensor responses
- Skewness
- Variability
- Differences between sensor-derived features
A correlation matrix and heatmap are used to investigate relationships between numerical features.
The distributions of:
- Gas classes
- Concentration levels
are analysed to identify imbalance or uneven representation.
The general preprocessing pipeline is:
Raw .dat files
↓
Parse observations
↓
Create DataFrame
↓
Separate features and targets
↓
Check missing values
↓
Check duplicates
↓
Check outliers
↓
Feature engineering
↓
Train-Test Split
↓
Fit scaler on training data
↓
Transform training and test data
↓
Train ML models
↓
Evaluate models
A fixed random state is used wherever applicable to ensure reproducibility.
All preprocessing transformations that learn parameters from the data are fitted only on the training set to avoid data leakage.
The original dataset contains 128 sensor-derived features.
Feature engineering will investigate the relationships between sensor measurements and may include sensor-wise aggregate or interaction features where appropriate.
Any engineered feature included in the final pipeline will be accompanied by an explanation of:
- What the feature represents
- Why it was created
- Why it may improve model performance
Feature engineering decisions will be based on observations from EDA rather than arbitrary transformations.
All regression algorithms are evaluated using the same preprocessed dataset and held-out test set so that model comparisons remain fair.
| Metric | Purpose |
|---|---|
| R² | Measures explained variance |
| RMSE | Penalizes large prediction errors |
| MAE | Measures average absolute prediction error |
The two best regression models are additionally evaluated using 5-fold cross-validation.
| Metric | Purpose |
|---|---|
| Accuracy | Overall proportion of correct predictions |
| Precision | Correctness of positive predictions |
| Recall | Ability to identify samples of a class |
| Weighted F1 | Balance between precision and recall |
| Confusion Matrix | Class-wise prediction analysis |
The project includes visualisations required by the capstone rubric, including:
- Feature distribution plots
- Target distribution
- Correlation heatmap
- Feature-target scatter plots where applicable
- Regression residual plot
- Predicted vs actual plot
- Tree-based feature importance
- Classification confusion matrix
All plots include suitable titles and labelled axes.
The project is implemented using Python and the following libraries:
- Python 3
- Pandas
- NumPy
- Scikit-learn
- Matplotlib
- Seaborn
Additional packages may be included where required for dataset loading or preprocessing.
gas-sensor-ml-capstone/
│
├── README.md
├── requirements.txt
│
├── data/
│ ├── batch1.dat
│ ├── batch2.dat
│ ├── ...
│ └── batch10.dat
│
├── notebooks/
│ ├── regression.ipynb
│ └── classification.ipynb
│
├── models/
│ └── saved_models/
│
└── app/
└── ...
The clustering notebook and final application components will be added as the project progresses toward Review 2.
Vergara, A. (2012). Gas Sensor Array Drift at Different Concentrations. UCI Machine Learning Repository.
DOI:
https://doi.org/10.24432/C5MK6M
Dataset page:
https://archive.ics.uci.edu/dataset/270/gas+sensor+array+drift+dataset+at+different+concentrations
The dataset is licensed under Creative Commons Attribution 4.0 International (CC BY 4.0).
The dataset documentation also states that the dataset is intended for research and requires citation of the associated works.
To ensure reproducible results:
- A fixed random state is used wherever applicable.
- The same train-test split is used when comparing models within a track.
- Preprocessing is fitted only on training data.
- Model parameters and evaluation metrics are recorded.
- Required dependencies are listed in
requirements.txt.
All analysis, interpretation, feature-engineering decisions, and conclusions are developed by the project team.
External sources and borrowed code are cited in the relevant notebook or README sections.
Generative AI assistance, where used, is limited according to the course guidelines and is disclosed in the repository.
- Dataset selection
- Dataset description
- Dataset loading and parsing
- Dataset audit
- Missing-value analysis
- Duplicate analysis
- Outlier analysis
- Exploratory Data Analysis
- Feature engineering
- Train-test split
- Feature scaling
- 10 regression algorithms
- Regression comparison table
- Hyperparameter tuning for at least 2 regression models
- Cross-validation for the best regression models
- Regression visualisations
- Classification Part A — 5 algorithms
- Classification evaluation
The overall goal of this project is to develop a reproducible machine learning pipeline capable of learning useful patterns from chemical gas sensor measurements while comparing multiple machine learning approaches across regression, classification, and clustering tasks.
The final project will compare model performance, analyse the effect of preprocessing and feature engineering, and identify the most suitable approaches for the selected prediction tasks.