Preview learning notebook Download learning notebook
Machine Learning with Measurement Data English translation
Create alarms from temperature measurement records and compare prediction errors of a sensor calibration equation.
Before practice 01 How does deciding that a temperature is high differ from predicting the temperature?Description Triggering an alarm using a threshold is a rule-based decision. Estimating the reference temperature with a calibration equation is numerical prediction. In Machine Learning, the coefficients of this prediction equation are found from data.
02 If the code runs, are the measurements also valid?Description Code can accept missing values, values outside the measurement range, and values in different units. Check the inputs before interpreting predictions and decisions.
1. Comparing measurements and alarm labels Starting conditions The times are [0,5,10,15,20,25] min and temperatures are [24,25,29,23,30,26] °C. Trigger an alarm when the temperature exceeds the threshold.
Procedure Run the learning example and compare the alarm times with the temperatures. Change the threshold from 28°C to 26°C and find the additional alarm times. Mark the threshold line and alarm points on the same plot, and explain the effect of changing the threshold. Results to retain Alarm times and counts for each threshold, plus a plot with axes and units. Items to record and points to check
Reference temperature
Alarm times
Alarm count Points to check Are there two alarms at the 28°C threshold, at 10 and 20 minutes? Did you exclude values exactly at 26°C when the condition is above 26°C? 2. Checking whether calibration reduces error Starting conditions The sensor inputs are x = [ 20 22 24 26 ] x=\begin{bmatrix}20&22&24&26\end{bmatrix} °C, and the reference temperatures are y = [ 22.5 24.7 26.8 29.1 ] y=\begin{bmatrix}22.5&24.7&26.8&29.1\end{bmatrix} °C. The calibration equation is y_hat=1.1*x+0.5.
Procedure Calculate predictions using the input unchanged and using the calibration equation. Calculate the difference between each prediction and its reference value, and the mean absolute error. Also compare errors from the two methods for a new input of 28°C and a reference temperature of 31.4°C. Results to retain A table with inputs, reference values, two predictions, and errors side by side, plus a comparison using a new measurement. Items to record and points to check
Input [°C]
Reference [°C]
Uncalibrated error
Calibrated error Points to check Is the calibration equation's mean absolute error approximately .025°C? Did you describe this experiment as evaluating a provided equation, without presenting it as a result of learning the coefficients? 3. Identifying and recording invalid measurements Starting conditions Use the records [24,None,29,100,26,28] °C at the same times. The sensor's valid temperature range is 15–40°C, and None indicates a failed measurement.
Procedure Distinguish failed measurements from out-of-range values and record them with their original times. Use valid values to calculate the mean and alarms above 28°C. Compare with the results when the condition is changed to ≥. Retain missing times on the plot and indicate that no measurement is available. Results to retain A table of input status, the mean and alarm count for valid measurements, and a plot that distinguishes missing measurements. Items to record and points to check
Time
Original measurement
Input status
Alarm status Points to check Are there 4 valid values with a mean of 26.75°C? Is there 1 alarm under the > condition and 2 under the ≥ condition? Did you avoid replacing None and 100°C with actual 0°C values?