Near-optimal learning with average H\"older smoothness