Answers.Body: <p>You can split each polygon into a collection of triangles and sum up the areas. Not really sure why you would bother with ML.</p>
  
  <p>Anyway if you approximates these polygons as images you could maybe train a CNN. Look at the image classification networks which provide bounding boxes.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-04-10T02:16:41.487Z
Answers.Text: I don't want to hardcode it. I want an algorithm to figure out a solution itself. I would bother with ML in this toy problem in order to use it for more complicated system. My question is what kind of ML to use for inputs that are of different size, can be cyclically shifted, and for which the property searched is calculated from its parts.
Answers.UserDisplayName: Vladislav Gladkikh
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-04-10T03:03:24.480Z
Answers.Text: Look at bounding box object detectors, yolo etc. You're going to need to remove a couple layers and then train. On the positive side, you can generate unlimited training data.
Answers.UserDisplayName: FourierFlux
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-04-09T15:11:54.810Z
Answers.LastActivityDate: 2020-04-09T15:11:54.810Z
Answers.UserDisplayName: FourierFlux
Body: <p>Imagine a set of simple (non-self-intersecting) polygons given by the coordinate pairs of their vertices <span class="math-container">$[(x_1, y_1), (x_2, y_2), \dots,(x_n, y_n)]$</span>. The polygons in the set have a different number of vertices.</p>
  
  <p><a href="https://i.sstatic.net/EMgLd.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/EMgLd.png" alt="enter image description here"></a></p>
  
  <p>How can I use machine learning to solve various supervised regression and classification problems for these polygons such as prediction of their areas, perimeters, coordinates of their centroids, whether a polygon is convex, whether its centroid is inside or outside, etc?</p>
  
  <p>Most machine learning algorithms require inputs of the same size but my inputs have a different number of coordinates. This may probably be handled by recurrent neural networks. However, the coordinates of my input vectors can be circularly shifted without changing the meaning of the input. For example, <span class="math-container">$$[(x_1, y_1), (x_2, y_2),...,(x_n, y_n)]$$</span> and <span class="math-container">$$[(x_n, y_n), (x_1, y_1),...,(x_{n-1}, y_{n-1})]$$</span> represent the same polygon where a starting vertex is chosen differently. </p>
  
  <p>Which machine learning algorithm is both invariant to a circular shifting of its input coordinates and can work with inputs of different sizes?</p>
  
  <p>Intuitively, an algorithm could learn to split each polygon into non-overlapping triangles, calculate areas or perimeters of each triangle, and then aggregate these computations somewhere in the output layer. However, the labels (areas or perimeters) are given only for the whole polygons, not for the triangles. Also, the perimeter of the polygon is not the sum of the perimeters of the triangles. Is thinking about this problem in terms of triangles misleading?</p>
  
  <p>Could you please provide references on machine learning algorithms that solve such tasks? Or any advice, how to approach this task? It does not have to be neural network and does not have to learn exact analytic formulas. Approximate results would be enough.</p>
  
Tags: <machine-learning><reference-request><sequence-modeling>
Title: How can I use machine learning to predict properties (such as the area) of simple polygons?
UserDisplayName: Vladislav Gladkikh
ThreadText: # How can I use machine learning to predict properties (such as the area) of simple polygons?
  
  (Asked by: username_0 on 2020-04-09)
  
  Imagine a set of simple (non-self-intersecting) polygons given by the coordinate pairs of their vertices $[(x\_1, y\_1), (x\_2, y\_2), \dots,(x\_n, y\_n)]$. The polygons in the set have a different number of vertices.
  
  [![enter image description here](https://i.sstatic.net/EMgLd.png)](https://i.sstatic.net/EMgLd.png)
  
  How can I use machine learning to solve various supervised regression and classification problems for these polygons such as prediction of their areas, perimeters, coordinates of their centroids, whether a polygon is convex, whether its centroid is inside or outside, etc?
  
  Most machine learning algorithms require inputs of the same size but my inputs have a different number of coordinates. This may probably be handled by recurrent neural networks. However, the coordinates of my input vectors can be circularly shifted without changing the meaning of the input. For example, $$[(x\_1, y\_1), (x\_2, y\_2),...,(x\_n, y\_n)]$$ and $$[(x\_n, y\_n), (x\_1, y\_1),...,(x\_{n-1}, y\_{n-1})]$$ represent the same polygon where a starting vertex is chosen differently.
  
  Which machine learning algorithm is both invariant to a circular shifting of its input coordinates and can work with inputs of different sizes?
  
  Intuitively, an algorithm could learn to split each polygon into non-overlapping triangles, calculate areas or perimeters of each triangle, and then aggregate these computations somewhere in the output layer. However, the labels (areas or perimeters) are given only for the whole polygons, not for the triangles. Also, the perimeter of the polygon is not the sum of the perimeters of the triangles. Is thinking about this problem in terms of triangles misleading?
  
  Could you please provide references on machine learning algorithms that solve such tasks? Or any advice, how to approach this task? It does not have to be neural network and does not have to learn exact analytic formulas. Approximate results would be enough.
  
  **Tags:** machine-learning, reference-request, sequence-modeling
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2020-04-09. Score: 3
  
  You can split each polygon into a collection of triangles and sum up the areas. Not really sure why you would bother with ML.
  
  Anyway if you approximates these polygons as images you could maybe train a CNN. Look at the image classification networks which provide bounding boxes.
  
  > **Comments:**
  > **username_0**: I don't want to hardcode it. I want an algorithm to figure out a solution itself. I would bother with ML in this toy problem in order to use it for more complicated system. My question is what kind of ML to use for inputs that are of different size, can be cyclically shifted, and for which the property searched is calculated from its parts.  
  > **username_1**: Look at bounding box object detectors, yolo etc. You're going to need to remove a couple layers and then train. On the positive side, you can generate unlimited training data.  
  
  ---
  
  