modify lr to ndarray