Stochastic gradient algorithm with random truncations