I work on air quality sensors, several of which are electro-chemical gas sensors. By way of background, these sensors are stimulated by a potentiostat circuit which applies a bias voltage and then measures the current which flows through the sensor (typically on the order of nano-Amps). The amount of current that flows through the sensor is related to the concentration of a target gas to which the sensor exposed. The current is also related to the pressure, relative humidity, temperature, and exposure to cross-sensitive gases, wherein resides the bane of my existence.

We've traditionally used a data modeling approach to interpret the current measured from the sensor as a concentration of the target gas, based on the sensor manufacturer's recommendations. We do so by measuring the response to clean air, and over a range of temperatures, and then using that characterization to interpret deflection from the characterized baseline response as attributable to target gas exposure.

We don't have the means to really evaluate the quality of that model, because we have neither a reference instrument, nor the means to expose the sensor to controlled concentrations of gas, but we are able to expose the sensors to target gas in order to confirm they appreciably respond to the target gas.

The challenge I'm experiencing is that the data model parameterized by the aforementioned characterization, over longer periods of time (i.e. a week), and subject to clean air under naturally occurring variation in temperature, relative humidity, and pressure, yields a span of variation in interpreted concentration that is unreasonably large. It's not noisy, but rather it drifts. That leads me to believe that the data model is sorely lacking.

That has lead me to think that an algorithmic (machine learning) approach might yield better results. Given that I have one-minute resolution data for temperature, relative humidity, pressure, and sensor current (all real-valued) under clean air conditions, what tools would be best suited to modeling sensor current as a function of temperature, relative humidity, and pressure? The thing I'm most concerned about is that we can't practically create conditions that represent a reasonable cross-section of the input space.

I would then use the traditional data model to interpret the deflection from the predicted baseline to estimate the gas concentration.

One side note is that temperature and relative-humidity are physically correlated, though I could mathematically back out absolute humidity from temperature, relative humidity, and pressure, which I think would de-correlate it.

Update / Clarification

In case this wasn't clear from the above, the goal is to be able to estimate the baseline voltage produced by a sensor in a clean air environment under varying pressure, humidity, and temperature conditions - as a means to using the deflection from that predicted baseline as the signal of interest in calculating concentration of target species gas. So basically I'm investigating alternative approaches to what is usually called zero-calibration in the instrumentation domain.

If I had truth data about the target species, it seems to me that I might be able to skip the business about deflection from a predicted baseline and estimate concentration directly from the voltage, temperature, humidity, and pressure time vectors.

  • 1
    $\begingroup$ P.S. I'm new here, upvotes would be welcome :-) $\endgroup$
    – vicatcu
    Commented Dec 16, 2018 at 17:54
  • $\begingroup$ Perhaps I missed it, but what is the modelling goal here? Different goals may suggest different approaches. $\endgroup$ Commented Dec 20, 2018 at 19:17
  • $\begingroup$ @RichardHardy I suppose there are two modeling goals. The first is to model the baseline voltage when the sensor is subject to clean air, given temperature, humidity, and pressure over some period of time. The second is to model the predicted concentration of the target tag species, given temperature, humidity, pressure, and voltage. I don't have a clear idea how I might approach the latter goal because I have no source of truth data, nor do I have the means to control / regulate the concentration of target species gas. Prior goal seems tangible because I can prevent exposure via filters. $\endgroup$
    – vicatcu
    Commented Dec 21, 2018 at 3:22
  • $\begingroup$ I think accurate modeling will also almost certainly require the input to the model to be all the input variables with some amount of lag. $\endgroup$
    – vicatcu
    Commented Dec 21, 2018 at 3:24
  • $\begingroup$ "To model" is not a goal in itself. My question regards what the model will be used for: description, prediction, hypothesis testing, ...? $\endgroup$ Commented Dec 21, 2018 at 6:00

1 Answer 1


Edit and TL;DR version: this could be treated as a mediation/moderator analysis problem, but that would still require an independant measurement to calibrate the device.

This sounds like a mediation/moderation analysis problem, not machine learning.

Let M1 be a model of the voltage under clean air conditions as a function of p, v and humidity. The deviance from M1 per se would not give you a concentration estimate. It would give you a probability that the gas is present and interfering with the sensor. A certain deviance (residual value) will not indicate the same concentration of the target gas for every p, v and humidity values because the way the gas affects the voltage varies with the other parameters. Similarly, going from let's say 2mV to 4mV of deviance does not necessarily imply that the concentration doubled - the scale might be non-linear and that scale itself might be influenced by your other variables. In other words, it's a good idea to look at the difference between the measured value and the value predicted by M1, but converting the residuals in gas concentration is not a 1:1 thing.

Another way to look at it which is more akin to the actual situation is to see the concentration as the independant variable, the sensor voltage as the dependant variable and p, t and hum as moderator variables. You'd need to induce different concentrations of gas and take measurements at various t, p and hum values for that to work though.

Here are some ressources:

This makes for a fun, almost philosophical problem to look at during the xmas vacation btw, so if you have a real or simulated dataset that you'd like to add to your question I'll take a look at it.


I showed this post and the data to a measurement specialist and an engineer who is also a specialist in measurement theory, and both said "get the suitcase with the calibration equipment". There's just no way around it.

  • $\begingroup$ Can you give some pointers to good resources where I can learn more about meditation analysis and how to apply it? $\endgroup$
    – vicatcu
    Commented Dec 26, 2018 at 16:22
  • $\begingroup$ I edited my answer, corrected some points (I mixed up mediation with moderation) and added a few links. $\endgroup$
    – GuillaumeL
    Commented Dec 27, 2018 at 15:56
  • $\begingroup$ I could add a dataset... is there a typical way to do that on this site? $\endgroup$
    – vicatcu
    Commented Dec 27, 2018 at 23:11
  • $\begingroup$ There does not seem to be an official way to post a large-ish dataset, according to this question: meta.stackexchange.com/questions/15821/… $\endgroup$
    – GuillaumeL
    Commented Dec 28, 2018 at 0:15
  • 1
    $\begingroup$ Thank you for the data. I updated my answer (please see epilogue section). $\endgroup$
    – GuillaumeL
    Commented Apr 11, 2019 at 15:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.