Optimization on MSE Not Working Correctly

The name of the function is: objective_function. This means nothing to someone who is reviewing your code. Give it a name that has meaning - relevant to what it is actually doing.

You’re converting a string to a float? Why?

Try to give meaning to what something is doing. An underscore is vague.

Change it to:

for sample in range(num_samples):`

In the following line(s), what is the purpose of the askerisk *? Is this required syntax by the numpy object?

`k_off_sampled = np.random.uniform(*param_bounds[0])`

Your question is still too vague. What is it not doing that you expect it to?

Example: The output is 100. But based on my calculations, I should be getting 345. etc.

  • By the way, the following comparison, doesn’t make sense:

The reason is that expected_P_out has units of watts and current_z[2] has units of amps.

Thus, they can’t be subtracted from each other. The set up of the code is wrong.