I have a 2D list of values that I want to transform/calibrate to another 2D list. I thought of using a predict function but I couldn’t get it to output 2 values.


I have a list of 2D coordinates {x1, y1}, {x2, y2}, {x3, y3}, etc.. and need to find a method/function/model to turn them into {a1, b1}, {a2, b2}, {a3, b3}...

For instance: {101, 50}, {210, 55}, {305, 47} translates into {0, 1}, {1, 1}, {2, 1}.

Once the function is calibrated to the control set i will apply it to another set of points to use the same transformation

  • 1
    $\begingroup$ Not enough information, by a long shot. Show the list you have, show the kind of transformation you would like to apply, etc etc. $\endgroup$
    – MarcoB
    Nov 20 '19 at 18:23
  • $\begingroup$ Updated the question $\endgroup$ Nov 20 '19 at 18:50
  • $\begingroup$ could you please provide access to the entire dataset via pastebin.com or such, because as presented you would probably want to use 2 Predict calls to generate 2 PredictorFunction, one for xi->ai and one for yi->bi $\endgroup$ Nov 20 '19 at 19:18

You could use a neural network. The architecture needed will depend on the specifics of the data and the domain. In this simple example a single LinearLayer is used.

in = {{101, 50}, {210, 55}, {305, 47}};
out = {{0, 1}, {1, 1}, {2, 1}};
trainingData = Thread[in -> out];

nn = NetInitialize@NetChain[{LinearLayer[]}, "Input" -> 2, "Output" -> 2]
net = NetTrain[nn, trainingData]

net[{300, 50}]
(* {1.91802, 1.01347} *)
  • $\begingroup$ Hi Rohit... thanks for that... could you help me add a BasicRecurrentLayer to that? Cuz I’m trying to get my head around it and failing miserably. $\endgroup$ Nov 22 '19 at 17:52
  • $\begingroup$ @CuriousDudeFromEgypt You are welcome. Why does mapping the coordinate pairs need a BasicRecurrentLayer? Probably best if you created a new post with more details about the data, what you are trying to accomplish and any code you have tried. $\endgroup$ Nov 23 '19 at 1:58
  • $\begingroup$ Hi Rohit, it probably doesn’t... but I thought I do it as well just to learn how to use the BasicRecurrentLayer because I cannot get my head around its input/output matrix requirements.... $\endgroup$ Nov 23 '19 at 8:27
  • $\begingroup$ @CuriousDudeFromEgypt Ah, in that case take a look at the Application section in the docs for BasicRecurrentLayer. There is also this great video on RNN's. $\endgroup$ Nov 23 '19 at 22:37

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.