Train a model to order a set of points

2 visualizaciones (últimos 30 días)
Ahmed
Ahmed el 16 de Oct. de 2023
Respondida: Shivansh el 10 de Nov. de 2023
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 comentarios
Matt J
Matt J el 16 de Oct. de 2023
It doesn't appear that your data is sorted, e.g.,
load Sample SORTED
issorted(SORTED{1},'ascend')
ans = logical
0
issorted(SORTED{1},'descend')
ans = logical
0
Ahmed
Ahmed el 16 de Oct. de 2023
Editada: Ahmed el 16 de Oct. de 2023
the data is sorted in a way to draw out a shape and i dont think in specific function will be able to confirm that since I manually check and confirm the accurate drawing of the shapes. These shapes never intersect themselves at any point and are spose to be enclosed if the last row is connected to the first.
What I am looking to do is to potentially train the model to understand how the points are ordered to generate those enclosed shapes automatically given the rows were scrambled

Iniciar sesión para comentar.

Respuestas (1)

Shivansh
Shivansh el 10 de Nov. de 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:
  1. For sequence data workflows: https://www.mathworks.com/help/deeplearning/sequence-and-numeric-feature-data-workflows.html?s_tid=CRUX_lftnav.
  2. Example for sequence to sequence translation: https://www.mathworks.com/help/deeplearning/ug/sequence-to-sequence-translation-using-attention.html.
Hope it helps!

Categorías

Más información sobre Sequence and Numeric Feature Data Workflows en Help Center y File Exchange.

Productos


Versión

R2023b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by