Hacker News new | ask | show | jobs
by primaryobjects 4167 days ago
I started playing with this. I take each digit and normalize it by dividing by 9. Then use each normalized digit as an input:

Example sorting 987654 and 123456

  Input: 1, .9, .8, .7, .6, .5, .2, .3, .4, .5, .6, .7
  Expected output: .2, .3, .4, .5, .6, .7, 1, .9, .8, .7, .6, .5
You can then encode/decode the inputs and outputs accordingly. if (value <= 1) digit = 9; if (value <= 0.9) digit = 8; ... if (value <= 0.2) digit = 1; if (value <= 0.1) digit = 0; etc.

I'm able to get 100% accuracy on a limited training set with 2 hidden layers of 10 nodes. 33% accuracy on the test set (but likely need a lot more data to train with).

2 comments

Update: I was able to train the network to sort sets of two 3-digit numbers. I used a neural network with 2 hidden layers of 25 nodes. The training/test accuracy after 10 minutes is 78%/74%. Not bad. https://github.com/primaryobjects/nnsorting
Interesting. It sounds like he used binary. I wonder how different bases affect how well the network can learn things like sorting?