Train a model to order a set of points
2 views (last 30 days)
Show older comments
I am in need of guidance or any example online that can help.
I would like to learn how to train a model in MATLAB to order a set of points based on what it has learned given the solution to some problems.
I have the following data:
SCRAMBLED is a cell array the contains X number of problems to solve, each problem consists of an array of size Nx2, where the first column is the x coordinate and the second is the y coordinate. The rows of this array are not in order and are to be ordered correctly.
SORTED is a cell array that contains X number of solutions, and it corresponds exactly to the SCRAMBLED cell array, similarily each solution contains an array of size Nx2 however the rows are now ordered to the correct order.
I would like to train a model to take in each cell of the cell array and learn how to correctly order the rows based on the solution so that if given a new scrambled array it will be able to re order it based on what it has learned. Any online tutuorials of something similar or pages that can help are much appreciated
(attached is a sample of those two cell arrays that contain the data structure i currently have)
2 Comments
Matt J
on 16 Oct 2023
It doesn't appear that your data is sorted, e.g.,
load Sample SORTED
issorted(SORTED{1},'ascend')
issorted(SORTED{1},'descend')
Answers (1)
Shivansh
on 10 Nov 2023
Hi Ahmed,
I understand that you want to train the current arrays on a model such that it predicts the output for the “SORTED” array, given a “SCRAMBLED” array.
You can use a deep learning approach like sequence-to-sequence (Seq2Seq) modelling to train the model in MATLAB. Seq2Seq models are commonly used in natural language processing tasks, but they can also be applied to other sequence-based problems like ordering points.
Refer to the following links for more information:
- For sequence data workflows: https://www.mathworks.com/help/deeplearning/sequence-and-numeric-feature-data-workflows.html?s_tid=CRUX_lftnav.
- Example for sequence to sequence translation: https://www.mathworks.com/help/deeplearning/ug/sequence-to-sequence-translation-using-attention.html.
Hope it helps!
0 Comments
See Also
Categories
Find more on Sequence and Numeric Feature Data Workflows in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!