Hello, I would like to create a periodical task that calculates mae, mape and mse directly on Influx, is it possible?
Welcome @mflores Sure, I do not see why this would not be possible using one or more map()
functions in Flux. There is probably a way to do it as well with SQL and/or Python. Which version of InfluxDB are you using (or plan to use)?
For those not familiar with these acronyms…
Mean Absolute Error (MAE)
- What it is: The average of the absolute differences between your predicted values and the actual values. It measures the average magnitude of errors, but doesn’t care about the direction (over or under prediction).
- Formula:
MAE = (1/n) * Σ |y_i - ŷ_i|
Where: * n = number of data points * y_i = actual value * ŷ_i = predicted value
Mean Absolute Percentage Error (MAPE)
- What it is: The average of the absolute percentage differences between your predicted values and the actual values. It expresses error as a percentage, making it easy to understand the relative size of errors.
- Formula:
MAPE = (1/n) * Σ |(y_i - ŷ_i) / y_i| * 100%
Where: * n = number of data points * y_i = actual value * ŷ_i = predicted value
Mean Squared Error (MSE)
- What it is: The average of the squared differences between your predicted values and the actual values. Squaring the errors gives more weight to larger errors.
- Formula:
MSE = (1/n) * Σ (y_i - ŷ_i)^2
Where: * n = number of data points * y_i = actual value * ŷ_i = predicted value
Hi @grant1 and thanks for your answer! We are working with InfluxDB OSS v2.7.6 and want to implement those calculations in Flux if possible, although we now we can easily do it in Python with a library like sklearn.
Hi @Anaisdg , we have already implemented it:
MAE: math.abs(x: r.ground_truth - r.prediction)
MAPE: math.abs(x: (r.ground_truth - r.prediction) / r.ground_truth) * 100.0
MSE: (r.ground_truth - r.prediction) * (r.ground_truth - r.prediction)