2

How can I rewrite the following code to ceres-solver?

I tried to follow this tutorial but it looks a bit confusing.

from scipy.optimize import minimize
def target_func(point):
    total_mse = 0

    for equation in equations:
        x, y, z = equation

        denominator = linalg.norm(np.matmul(x, y))
        numerator = linalg.norm(
            np.cross(np.matmul(x, y),
                     point - z))

        equation_error = numerator / denominator
        total_mse += equation_error

    return total_mse * total_mse

res = minimize(target_func, x0, method='nelder-mead',
               options={'xtol': 1e-8})
Alex
  • 579
  • 1
  • 6
  • 14

0 Answers0