Answers.Body: <p>You should look at <a href="https://arxiv.org/pdf/1506.03134.pdf" rel="nofollow noreferrer">pointer networks</a>. It is still not perfect for the case, but it should be more applicable than LSTMs and MLPs because they learn in an output space of size equal to the input, rather than a fixed input dim that you would get using LSTMs in sequence to sequence or direct MLP. By design though they are meant for problems with replacement. Sorting when done sequentially is without, so to remedy this in the case of a pointer network, you could mask outputs that have already been chosen before the final normalization step (such as softmax)</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-05-08T16:16:24.017Z
Answers.LastActivityDate: 2019-05-13T15:44:52.717Z
Answers.LastEditDate: 2019-05-13T15:44:52.717Z
Answers.UserDisplayName: mshlis
Answers.Body: <p>Even a simple multilayer perceptron can sort input data to some extent, as you can see <a href="https://github.com/primaryobjects/nnsorting" rel="nofollow">here</a> and <a href="http://yyue.blogspot.com.br/2015/01/a-brief-overview-of-deep-learning.html" rel="nofollow">here</a>.</p>
  
  <p>However, neural networks for sequential data seem more appropriate, as they can handle sequences of variable lengths. It has been done with an <a href="https://github.com/dmlc/mxnet/tree/master/example/bi-lstm-sort" rel="nofollow">LSTM</a> (Long Short-Term Memory), <a href="https://arxiv.org/pdf/1602.03218.pdf" rel="nofollow">LSTM+HAM</a> (Hierarchical Attentive Memory) and an <a href="https://arxiv.org/pdf/1410.5401v2.pdf" rel="nofollow">NTM</a> (Neural Turing Machine).</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-08-10T01:53:44.150Z
Answers.LastActivityDate: 2016-08-10T01:59:52.747Z
Answers.LastEditDate: 2016-08-10T01:59:52.747Z
Answers.UserDisplayName: rcpinto
Body: <p>I believe normally you can use <a href="https://en.wikipedia.org/wiki/Genetic_programming" rel="noreferrer">genetic programming</a> for sorting, however I'd like to check whether it's possible using ANN.</p>
  
  <p>Given the unsorted text data from input, which neural network is suitable for doing sorting tasks?</p>
  
Tags: <neural-networks>
Title: Which neural network has capabilities of sorting input?
UserDisplayName: kenorb
ThreadText: # Which neural network has capabilities of sorting input?
  
  (Asked by: username_0 on 2016-08-10)
  
  I believe normally you can use [genetic programming](https://en.wikipedia.org/wiki/Genetic_programming) for sorting, however I'd like to check whether it's possible using ANN.
  
  Given the unsorted text data from input, which neural network is suitable for doing sorting tasks?
  
  **Tags:** neural-networks
  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_2 on 2016-08-10. Score: 3 | Accepted answer
  
  Even a simple multilayer perceptron can sort input data to some extent, as you can see [here](https://github.com/primaryobjects/nnsorting) and [here](http://yyue.blogspot.com.br/2015/01/a-brief-overview-of-deep-learning.html).
  
  However, neural networks for sequential data seem more appropriate, as they can handle sequences of variable lengths. It has been done with an [LSTM](https://github.com/dmlc/mxnet/tree/master/example/bi-lstm-sort) (Long Short-Term Memory), [LSTM+HAM](https://arxiv.org/pdf/1602.03218.pdf) (Hierarchical Attentive Memory) and an [NTM](https://arxiv.org/pdf/1410.5401v2.pdf) (Neural Turing Machine).
  
  
  ---
  
  ### Answer by username_1 on 2019-05-08. Score: 3
  
  You should look at [pointer networks](https://arxiv.org/pdf/1506.03134.pdf). It is still not perfect for the case, but it should be more applicable than LSTMs and MLPs because they learn in an output space of size equal to the input, rather than a fixed input dim that you would get using LSTMs in sequence to sequence or direct MLP. By design though they are meant for problems with replacement. Sorting when done sequentially is without, so to remedy this in the case of a pointer network, you could mask outputs that have already been chosen before the final normalization step (such as softmax)
  
  
  ---
  
  