Imported from https://github.com/rmcantin/bayesopt