What are you working on currently? (2017)

Machine Learning / Neural Networks in Roblox

Classifying handwritten digits

Watch as I draw on the screen and it predicts what digit I have drawn!

How it works
I’m using a 2 layer feed forward fully connected network with sigmoid activation, cross entropy & softmax cost, stochastic gradient descent. I’m achieving about 92% accuracy (which is bad in MNIST world). It’s not hard to get it up to 99.7% accuracy using convolutional neural nets, but I’m doing all the math by hand in order to learn more linear algebra & how ML works on low level. Doing all the forward/back propagation myself.

I trained it on 60,000 MNIST digits over several epochs (in Python), and then exported the weights & biases to Roblox. I wrote some matrix utility code (dot/mul, add, sigmoid) to do the forward propagation in Roblox. Then I wrote a little canvas painting thing and put it together. Every ~0.2 seconds I update the classification probabilities. It’s really fast.

EDIT: I tweeted it :slight_smile:

32 Likes

How many hidden units you got in there? (i.e. as proportion of input layer)

:slight_smile: :octopus: goals

100 neurons in hidden layer. I tried 30 too. Hyperparameters ¯\_(ツ)_/¯
EDIT: So, layer sizes go 784 (28*28) → 100 → 10 (labels/# of digits)

Right now the main issue is that the MNIST dataset was created by fitting squares around digits, so when I draw digits that aren’t perfectly centered or bounded, it doesn’t recognize them as well. If I did some pre-processing on the dataset and add random rotation/scaling to digits, it’d handle this scenario better. The edge detection that CNN’s bring is far superior, though.

3 Likes

Oh okay, guess you’ll need more hidden units if you want to detect reasonable position/rotation/scaling invariance? That seems pretty good though still.

How do you prune connections by the way? Every epoch, or after training, or?

I probably won’t need more hidden units. Maybe another layer, but really this is best solved with a convolutional network. What do you mean by pruning? Dropout? I don’t have any dropout layers implemented.

1 Like

I did something similar in a machine learning course and I remember requiring quite a few more hidden units in proportion to input, but maybe it’s because you have some differences w.r.t. cost function and propagation method… either way I’m not a machine learning expert or anything, I was just curious how you set up your network :smiley:

With pruning I just meant whether you cut away connections that fall below a certain weight threshold to reduce the processing that you need to do in training/testing steps, but I guess with this size network you probably don’t even need to do that yet, so forget about that question

1 Like

That looks awesome! :smiley:
I like the human-like body. Is it possible to get that model? I tried to set the sizes and proportions right, but I just couldn’t get it.

1 Like

Palm trees!

17 Likes

whelp, you’ve got mine beat

3 Likes

Resizing the number to make its largest axis length equal to the size of the bounding box (and proportionally resizing the smaller axis) and then centering the number should reduce the complexity of the samples.

I modeled a Tesla Model 3 in Blender, then imported into Roblox for a game I’m working on…

12 Likes

Sweet! \o/

Mine too.

1 Like

wow, like 4 hours of solid work for one boat…

https://i.gyazo.com/375a5f799e830ce920a3641331106cab.mp4

but it was so worth it
(well, 4 hours for the boat and about 8 bugs removed)

7 Likes

Will there be torpedoes?

Torpedoes feel like overkill, since it’s probably just gonna be small riverboats and patrol ships

EDIT: Posted this in the wrong thread/tab. Soz

Been working pretty much nonstop on the Rudimentality Egg Hunt! At the moment we have 10 maps, over 100 skins, and soon over 50 taunts. Wooh!

8 Likes

I’m making a new shop for my game. I’m also getting used to the new UI constraints and they are really helpful! :octopus:


c217dc47a80c67ac3fc9a1430f6d3cba87086b01.PNG

11 Likes