Optimising Cost vs Accuracy of Decentralised Analytics in Fog Computing Environments