How I can change embedding matrix values in Tensorflow?

Code
I made the code which is predicting the results of soccer games. First I just tested it by using data from betting sites and it got about 57%. After that, I added teams using an embedding matrix because they were categorical. It got about 57%. So that didn’t help although teams should mater a lot. So I started reading fast.ai blog post about embedding matrixes and I found out that I was using it incorrectly. I randomly choose the values but I never changed them. So my question is: How I can change the embedding matrix values to the right direction?
For example,
if we have categorical values a,b,c. The embedding matrix might look like this:
a -> [0.3,0.2,0.5]
b -> [0.1,0.5,0.2]
c -> [0.3,0.2,0.1]
So these numbers are randomly chosen. Now the problem is that how I can make the model to change the numbers so it can, for example, make b and c represent more like each other because there might be some correlation?

I would be happy to hear other mistakes I have made in the code if you can notice any.
Same code again

1 Like