Color fitting neural network

suremarknet.rbxl (14.5 KB)

I’m keeping a momentum table and adding delta values to indices of that table while damping it.

You flipped a sign, I think. Here’s my formula for the change:

c = -alpha*delta[n1]*values[n0]+mu*d_last[x[i]][n0][n1];

Here I use mu for the momentum coefficient. (the article uses mu for the learning rate, but I’m using alpha for that. tsk tsk)
In the pastebin I shared, I used myWeights[n1]=w-change, but after implementing momentum I found it easier just to flip the signs.
edit: NVM, I see what you’re talking about now.

edit 2: I found a red flag:
momentum[n1]=change

momentum should be indexed by two nodes, as it takes two to specify a weight.

You can see it hit the fan when you set the momentum to 1.

I fixed your code so that momentum is indexed by both nodes. It works normally now:

I think it’s reached a local minimum, but I’ll post pictures if it gets any farther :slight_smile:

what do you mean both nodes? what are you doing with two nodes? all I’m doing is adding the same things that were added the previous time to the next adjustments after multiplying by some damping factor.

Yes, but each weight is specified by two nodes: w == weights[n0][n1]. So in order to track the changes, you need two indices for each entry.

oh, I was overwriting them. I see.

I have to say, your display is pretty sexy. I’m tempted to copy the design :smile:

I haven’t played ROBLOX in so long, I didn’t even realize that Parts have Color3 values now.

My display doesn’t show bias directly, but it’s sort of implied by the initial height of the graph on a node when it’s clear that the other ones don’t add up. you also can’t really tell which weight graph is connected to which node since they’re all shown at the same time. The weight graph is the original output graph multiplied by the absolute value of a weight, so I’m using dark green when the weight is negative and lime green when it’s positive. I gave the lines different widths (1.1 studs, .9 studs etc) to get rid of ugly Z fighting (but I didn’t with the positive/negative weights, so those might overlap)

At first I realized that the weights aren’t 0-1, so I figured I had to put them through the sigmoid function. It seems like something visual is lost by doing that, though. For the output graph (red), the bottom means zero and the top means one, but for the weights, the bottom means huge negative and the top means huge positive, and the middle is 0.5. Actually, since I’m making the weights positive, I only need to map [0, ∞) to [0,1) and not (-∞, ∞) to (0, 1), so I guess I can use something that looks like 1-1/(x+1) instead for displaying weight graphs.

edit: yes 1-1/(x+1) looks much better.

momentum still makes it seem less stable though. like, when I turn it off, it settles to a better position than when it’s on, and when I turn it up, sometimes it just kills itself and others it just gets a little warped off.

1 Like

Forgot I still had this running. probably intended to do that.

much accurate very fit wow. if only it would do that much, much faster.

1 Like

Nice work! You should apply it to a game like checkers or something.

Also if you can somehow fit this into a pet that learns to follow you, do simple tricks (give it food when it does something you like) you’d earn millions. Not sure how easy that’d be but it seems doable with this. Especially after I saw the Mario version by Sethbling.

checkers I guess would be represented by a 64 dimensional input of 0, 1, -1, 2, -2 for different states of each cell. beyond that it sounds like a deep learning problem; I’m not sure how well a function-fitting shallow feedforward network would work in trying to learn a complex game.

I’ve been trying to make a symbol classifier, so that’s a first step in the direction of a network dealing with discontinuous functions. The network here just deals with a straight line going from 0 to 1 and adds some bends to it, but it has a limited number of bends and has to figure out the right ones by gradually correcting error values. With recognizing digits, it’s not a function of anything. The pixels range from white to black, representing empty space or something drawn/an aliased border of something drawn, and it has to find significant patterns and determine which combinations of those patterns signify the classification of a particular digit. Games are even more complicated, because the smallest change creates an entirely new problem.

I thought about doing something for connect-4 because there’s only 7 possible output values, rather than chess/checkers where there’s 64 or Go where there’s 361.

Is there something different I should be doing?


I keep ending up with these repeated graphs. The network learns the same thing more than once and becomes incapable of getting rid of one copy in order to learn something else useful. what do

Here’s a better example of what I’m talking about @suremark

It learns the same features multiple times and falls into a local min.

Maybe you can just reset the weights? Or try a different graph? I’d assume that the learnability depends on the initial configuration, so maybe you can play with that and see if the problem persists.

You are trying to solve a regression problem, which is different than the classification problem. The functions used in the net define the model that you are trying to fit to the curves. Sigmoid functions seem like a poor choice to use in a model for regression.

Quantum computer servers for roblox pls

I made a digit classification network. It takes a 16x16 grid (256 inputs) and I drew a ton of digits and grouped them and it’s supposed to learn what certain digits look like.

symbolrec.rbxl (60.4 KB)

Run in play mode (F5)
Draw a number in the box and it will tell you what number you drew. The smaller box to the right is what it turns your input into automatically just so all inputs take up similar spaces.
Inside the Main script in ReplicatedStorage are details about its toggles.

It doesn’t look like it’s very good at learning when there’s a hidden layer. It seems to learn best when there are no hidden layers, meaning just direct weights and biases from the input to the output, so it just knows what a number is based on which pixels are black or white rather than from patterns. It doesn’t seem to be able to recognize the number 8 correctly, and 9s and 4s get mixed up easily.