Python and NumPy
Check the largest recovery error
A small error cannot excuse a large one
Botie recovered a saved temperature array. One unacceptable entry must fail the comparison even if all other entries are very close.
BOTIE
The inputs we are comparing
Recovered readings
Every entry close
- 020.0001
- 118.0002
One entry too far
- 020.0001
- 118.01
Reference readings
Same in both cases
- 020
- 118
Allowed absolute difference
Same in both cases
0.001
Result for every entry close
1
A negative reference at the tolerance boundary
This check uses the pieces from “Let the worst recovery error decide”.
BOTIE
- Recovered readings
- 0-2.5
- 10
- 25.25
- Reference readings
- 0-2
- 10
- 25
- Allowed absolute difference
0.5
Use a number, text, or an array matching the requested result. For a matrix, put each row in brackets. Saving your prediction runs your current construction on these inputs and checks the earlier examples too.
Build a construction in the workspace above first. This case will test those pieces.
Why is maximum the appropriate reducer for 'every entry', and what extra checks would still be needed for incompatible shapes?
Choose a numerical check from its stated contract, including tolerance and boundary behaviour.
Workshop inputs are finite, equally sized vectors. Python adds shape, dtype, missing-value, and relative-tolerance checks.
Work through the Python challenges →