Refactoring npz_predict2 and linear examples