A Bayesian approach for an efficient data reduction in IoT