Imported from https://github.com/gd-zhang/noisy-quadratic-model