Neuron allows us to use comparison functions and sum()
aggregation function to count the number of data points for which a condition is true.
To count data points that match a condition:
Create a transform that uses a comparison function to define a filter condition on another property.
Create a metric that sums the data points where that condition is met.
Example: counting the number of data points where water is boiling
Consider a scenario where you have a measurement, temp
, that provides the temperature (in Celsius) of water in a machine.
You can define the following transform and metric properties to count the number of data points where the water is boiling:
Transform:
is_boiling = gte(temp_c, 100)
– Returns1
if the temperature is greater than or equal to 100 degrees Celsius, otherwise returns0
.Metric:
boiling_count = sum(is_boiling)
– Returns the number of data points where water is boiling.