f = lambda x, y: optimizer.compute_expectation([x, y])
but it's not working with a load balanced view, saying that optimizer is not
IPython only automatically transmits the function definition used in a `map` call or similar. Your optimizer is inside your lambda function and thus unknown on the remote kernels. In order to overcome this, take a look here:
If you are looking to convert nested for-loops to hierarchical parallel maps,
this is the kind of thing that `pathos` is built to do. If you are
in an optimizer that can utilize hierarchical parallelism to compute
values, this is the kind of thing that `mystic` is designed to do.