move indexing and sampling and calculating mini batches to inverted index