  Range aggregate queries (RAQs) are an integral part of many real-world
applications, where, often, fast and approximate answers for the queries are
desired. Recent work has studied answering RAQs using machine learning (ML)
models, where a model of the data is learned to answer the queries. However,
there is no theoretical understanding of why and when the ML based approaches
perform well. Furthermore, since the ML approaches model the data, they fail to
capitalize on any query specific information to improve performance in
practice. In this paper, we focus on modeling ``queries'' rather than data and
train neural networks to learn the query answers. This change of focus allows
us to theoretically study our ML approach to provide a distribution and query
dependent error bound for neural networks when answering RAQs. We confirm our
theoretical results by developing NeuroSketch, a neural network framework to
answer RAQs in practice. Extensive experimental study on real-world,
TPC-benchmark and synthetic datasets show that NeuroSketch answers RAQs
multiple orders of magnitude faster than state-of-the-art and with better
accuracy.
