So what I would like to do is to create a NetGraph that takes in an $n\times 3$ (with $n$ varying in length) list of 3D coordinates as an input and creates an $n \times n$ distance matrix or an $\frac{n (n-1)}{2} $ list of distances between these points. I would run this net for two lists of 3D coordinates and feed the results into a MeanSquaredLossLayer. This would allow the neural net to learn to reproduce an arrangement of points with the loss invariant with respect to translations and rotations in 3D. However, I only have vague ideas what modules I should use. Maybe NetMapOperators and NetMapThreadOperators? If these, then how? Thank you for the answer in forward!

Edit: Normally, without the NN framework I would do the following to obtain the pairwise distances in a list and then calculate the loss:

distances[x_] := 
   Table[Norm[x[[i]] - x[[j]]], {i, 1, j-1}], {j, 1, Length@x}]
coordList1 = {{1, 2, 3}, {2, 3, 4}, {3, 4, 5}}; (*Small examples*)
coordList2 = {{1, 5, 3}, {2, 3, 10}, {11, 4, 5}};
loss = Sqrt@
  Mean[#^2 & /@ (distances[coordList1] - distances[coordList2])]
| improve this question | | | | |
  • 1
    $\begingroup$ Do you think you could add some code to your question, explaining how you would do some of your operation normally (ie, without the NN framework)? That way, a potential answerer can be sure of the veracity of their solution. $\endgroup$ – Carl Lange Nov 14 '19 at 10:51
  • $\begingroup$ Thanks, edited! $\endgroup$ – fazekaszs Nov 14 '19 at 12:11
  • $\begingroup$ Sorry to be a pain, could you also add a small version of coordList1 and coordList2? Thanks! $\endgroup$ – Carl Lange Nov 14 '19 at 12:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.