A computationally lightweight safe learning algorithm