r/computerscience • • Jan 11 '21

A visualization of how a feed forward's weights change to fit training data (Implementation in Java)

172 Upvotes

17 comments sorted by

13

u/[deleted] Jan 11 '21

I always wonder how you do these things. Not the actual math or whatever behind it, but like what do you use to create this? Some kind of gui? How do you make it move? The fuck ๐Ÿคจ

Kind regards dumb Computer science student

8

u/longuyen2306 Jan 11 '21

You take a snapshot of the current world each second and render it with any GUI software you like. That was how movies made, too. I like Swing for it simplicity.

3

u/[deleted] Jan 11 '21

Makes sense. I don't use java, but I suppose it could be done in C# with something like.. windows forms?

4

u/longuyen2306 Jan 11 '21

Yes absolutely, anything that allows you to draw triangle, circle, line, paint some color. That is all you need :)

2

u/longuyen2306 Jan 11 '21 edited Jan 11 '21

1

u/200GritCondom Jan 11 '21

I just wrapped up my masters capstone where I visualize the network in 3d space. So I know how clever you have to be to come up with innovative ways to show data changes with these networks. Nice job!

1

u/luisvcsilva Jan 11 '21

What's the activation function that you used? Really cool plot btw

1

u/longuyen2306 Jan 11 '21

I use the sigmoid function for the last layer. Zero is blue, one is pink.

1

u/Camp_Camp_Camp_Camp Jan 11 '21

Yes, but how does it perform on the validation set?

1

u/longuyen2306 Jan 11 '21

What you are seeing is the neural network's performance on the validation set. The training set consist of the circles.

1

u/Camp_Camp_Camp_Camp Jan 11 '21

So the model was trained on different data and is just overlaid to the validation set here?

1

u/longuyen2306 Jan 11 '21

When the GIF began the model was not trained. You can see over the time how the training is going on (the connection between perceptrons are getting thicker).

1

u/Effective_Youth777 Jan 11 '21

Hello, would you mind sharing the libraries used to produce this? I really like doing visual things with Java (no matter what these visual things are) but for some reason I can never find the appropriate libraries.

1

u/longuyen2306 Jan 11 '21

Hi, when you go the project's github. Especially at https://github.com/longmakesstuff/Neural-Network-Visualization/blob/master/src/main/kotlin/de/longuyen/gui/Frame.kt.

You can see I just used the standard Java Swing and ImageBuffer API. Nothing wild :) So no library was used

3

u/anti-gif-bot Jan 11 '21

mp4 link


This mp4 version is 95.97% smaller than the gif (567.07 KB vs 13.74 MB).


Beep, I'm a bot. FAQ | author | source | v1.1.2

1

u/[deleted] Jan 11 '21

[removed] โ€” view removed comment

2

u/longuyen2306 Jan 11 '21

On the project's github you can see another much more simple network trains on a linear seperable dataset, where way less parameters are needed to fit the data :)