Learning

Develop an e-nose to detect alcohols using machine learning

Identify five alcohol vapours from a compact QCM sensor signature

This electronic-nose example classifies a sample as 1-isobutanol, 1-octanol, 1-propanol, 2-butanol or 2-propanol from five frequency-shift measurements. It shows how a compact softmax model can turn a quartz-crystal microbalance response into an interpretable laboratory decision.

25labelled QCM samples
5frequency-shift inputs
5known alcohol classes
10 / 10testing samples classified correctly

Electronic noses can support rapid screening when conventional analytical methods are too slow or costly for every measurement. In this controlled benchmark, the model compares the response pattern across five gas-mixture levels and selects one of five known alcohols. The result is useful as a compact pattern-recognition demonstration, but it is not evidence of field performance on unknown vapours or changing environmental conditions.

1. Industrial challenge

This is a multiclass classification problem. Five QCM frequency shifts describe one sample, and the network returns a mutually exclusive probability distribution over five alcohol identities.

Screen known vapoursConvert a multivariate sensor response into a repeatable identity suggestion for controlled samples.
Compare sensor signaturesQuantify how the response changes across five specified air-to-gas mixture ratios.
Prototype an e-nose workflowConnect measurement checks, model inference, confidence review and confirmatory analysis.

Potential users include sensor R&D teams, analytical laboratories, chemical-process engineers, quality-control groups and industrial monitoring specialists.

Sensor R&DAnalytical laboratoriesChemical processingQuality controlIndustrial monitoring
Model role. This is a closed-set alcohol-identity classifier for a controlled QCM experiment. It does not detect an arbitrary unknown substance, quantify concentration or replace a certified gas-monitoring system.

2. Data set

The source Alcohol QCM Sensor Dataset contains five files for five QCM sensor configurations. This example uses the QCM12 subset and retains one frequency-shift column at each of five mixture ratios. The updated semicolon-delimited CSV contains 25 observations, five numerical inputs and the categorical target class, with no missing values.

CSV variableMeasurementAir / gas ratioUnitObserved range
frequency_1Frequency shift at mixture 10.799 / 0.201Hz-86.34 to -9.40
frequency_2Frequency shift at mixture 20.700 / 0.300Hz-129.71 to -21.44
frequency_3Frequency shift at mixture 30.600 / 0.400Hz-183.94 to -34.39
frequency_4Frequency shift at mixture 40.501 / 0.499Hz-231.08 to -48.61
frequency_5Frequency shift at mixture 50.400 / 0.600Hz-296.68 to -63.62

Class balance

Alcohol classSamplesShare
1-Isobutanol520%
1-Octanol520%
1-Propanol520%
2-Butanol520%
2-Propanol520%
Balanced distribution of five alcohol classes in the QCM12 example

Configured split

SubsetRowsShareClasses represented
Training1248%5 of 5
Selection312%2 of 5
Testing1040%5 of 5
Validation note. The random split is not stratified: the selection subset contains only 1-isobutanol and 1-octanol, while two testing classes contain only one row each. The reported test result is therefore a useful reproducibility check, not a robust estimate of deployment accuracy.

3. Neural network

The exported model standardizes the five frequency inputs and feeds them directly to five softmax neurons. The probabilities sum to one, and the class with the largest probability becomes the prediction. This compact 5–5 architecture contains 30 trainable parameters.

QCM alcohol classifier with five frequency inputs and a five-class softmax output
Reading the diagram. Neural Designer displays one logical categorical output, class. Internally, the exported model evaluates five logits—one per alcohol—and applies a stable softmax to produce the probability distribution.

4. Training strategy

The network minimizes multiclass cross-entropy with no regularization using the quasi-Newton method. Training reached the configured loss goal after 19 epochs. The final recorded training loss is approximately 0.0007, while the selection loss is approximately 0.0023.

Quasi-Newton training and selection cross-entropy history for the QCM alcohol classifier

The low objective values show that this compact model separates the configured rows. Because only three observations are available for selection and three classes are absent from that subset, the selection curve should not be interpreted as evidence of reliable hyperparameter tuning.

5. Validation design and decision rule

No architecture sweep is reported for this project; the 5–5 softmax network is used as a deliberately small baseline. The decision rule is argmax: select the class with the largest output probability.

For a production-oriented study, keep the five-class objective but replace the single random split with repeated stratified validation. A stronger generalization test would reserve complete sensor configurations or measurement sessions, then evaluate probability calibration and an explicit “unknown or low-confidence” rejection rule.

6. Testing analysis

The exported model was recalculated on the ten rows marked as testing in the Neural Designer project. All ten were assigned to the correct class. The majority-class baseline for this particular testing split is 30%.

100%testing accuracy
100%macro-F1
0.0000475testing cross-entropy
30%majority-class baseline

Confusion matrix

Actual / predicted1-Isobutanol1-Octanol1-Propanol2-Butanol2-PropanolTotal
1-Isobutanol200002
1-Octanol030003
1-Propanol001001
2-Butanol000101
2-Propanol000033
Total2311310

Per-class results

ClassTesting supportPrecisionRecallF1
1-Isobutanol2100%100%100%
1-Octanol3100%100%100%
1-Propanol1100%100%100%
2-Butanol1100%100%100%
2-Propanol3100%100%100%
Interpretation. Perfect separation of ten benchmark rows is encouraging, but the support per class is only one to three. Accuracy, precision and F1 are therefore descriptive results for this split, not a validated field-performance claim.

7. Model deployment

A professional e-nose workflow should validate the experiment before classification: stabilize the sensor, control temperature and humidity, confirm a clean baseline, collect the five frequency shifts, evaluate the softmax probabilities and route uncertain samples to confirmatory analysis.

Controlled QCM measurement
Stability, baseline and range checks
Five-class softmax model
Identity suggestion and laboratory review

Real testing example: 1-isobutanol

Testing row 22 contains the frequency signature below. The model assigns the largest probability to the recorded 1-isobutanol class.

InputFrequency shift
frequency_1-56.14 Hz
frequency_2-90.74 Hz
frequency_3-132.16 Hz
frequency_4-178.79 Hz
frequency_5-239.06 Hz
ClassModel probability
1-Isobutanol99.99998%
1-Octanol<0.00001%
1-Propanol<0.00001%
2-Butanol<0.00001%
2-Propanol0.00002%

Recommended interpretation: report 1-isobutanol as the model suggestion only if experimental controls and sensor-quality checks pass. A high softmax probability is not proof that an unrepresented vapour is absent.

Try the alcohol classifier

Enter five QCM frequency shifts or load a testing example. The browser uses the scaling, weights and stable softmax from the exported Python model.

-86.34 to -9.4
-129.71 to -21.44
-183.94 to -34.39
-231.08 to -48.61
-296.68 to -63.62
Most probable class
1-Isobutanol
1-Octanol
1-Propanol
2-Butanol
2-Propanol

Closed-set demonstration — not a certified gas detector, safety alarm or concentration estimator.

Download and reproduce

8. Scope and limitations

  • This example uses 25 observations from the QCM12 subset; the full UCI collection contains 125 observations across five QCM sensor configurations.
  • The model recognizes only the five alcohols represented during training. It has no “unknown”, mixture or contaminated-sample class.
  • The five inputs are measurements at specified mixture ratios; this model is not a concentration estimator.
  • The random, non-stratified split does not demonstrate transfer to another sensor, coating, measurement session or laboratory.
  • Temperature, humidity, baseline drift, sensor ageing, response and recovery dynamics are not modelled as inputs.
  • Individual input ranges do not guarantee that an arbitrary combination of five values is physically represented.
  • Production use requires repeated measurements, calibration monitoring, an uncertainty or rejection policy and confirmation against an appropriate analytical method.
  • The classifier supports controlled screening; it must not replace certified gas detection, occupational exposure monitoring or safety alarms.

References