Hacker News new | ask | show | jobs
by danblick 3724 days ago
Has anyone been able to learn a function for the spiral (Swiss roll) data that's as good as a human-designed function would be?
6 comments

Update: after playing with this for way too long, I've found that it can converge to a spiral with 3 or 2 or even just 1 node in the 2nd hidden layer.

The 1 node case is especially interesting, because when it converges the single node must learn the whole spiral pattern. Although with noise it can be less reliable with more jagged edges, as well as take longer to converge (also bumped the learning rate down), seeing the spiral encoded directly in the 2nd hidden layer is more interesting to me.

http://playground.tensorflow.org/#activation=tanh&batchSize=...

For this simple example just choosing the largest possible fully-connected network with ReLU and L2 regularization to prevent overfit quickly converges to a nice spiral (test loss of 0.001 for me):

http://playground.tensorflow.org/#activation=relu&regulariza...

I wouldn't call it quick... spiral in 150 iterations, with sigmoid magic: http://playground.tensorflow.org/#activation=sigmoid&regular...

I find the pulsating unsightly.

Neat. How would the number of neurons N scale with the size of the spiral? (Size=number of turns)

Will N level off, meaning that it will really understand the structure of the spiral?

For me key was to use x,y and either sin x, sin y or x squared y squared as inputs and 5 or 6 neurons in hidden layer.
Add both sin(X1) and sin(X2) as inputs.
Do you consider test loss around 0.04 good?