python - mean of 3d points as minimization task -
i have set of n 3d points (x,y,z) , compute mean.
in particular purpose compare differences between several metric.
euclidean distance: d_e(d_1,d_2) = ||d_1 - d_2||
riemannian distance: d_r(d_1,d_2) = ||log(d_1^(-1/2) * d_2 * d_1^(-1/2))||
once fix metric, should compute minimization problem.
i founded in python scipy.optimize kind of task, not know how formulate problem. should use loop?
edit:
i found scipy.optimize.leastsq . seems useful, goal. how use in gradient descent framework?
>>> import numpy np >>> = np.array([[1,2,3],[1,2,3],[7,-100,8]]) >>> a.mean(axis=0) array([ 3. , -32. , 4.66666667])
Comments
Post a Comment