How to calc the derivative for gradient descent?

Discussion of chess software programming and technical issues.

Moderators: hgm, Rebel, chrisw

Pio
Posts: 334
Joined: Sat Feb 25, 2012 10:42 pm
Location: Stockholm

Re: How to calc the derivative for gradient descent?

Post by Pio »

D Sceviour wrote: Wed Jan 06, 2021 12:52 am
Pio wrote: Tue Jan 05, 2021 11:47 pm The discussion about linearity in evaluation function is very bad. You might have a function that is linear with respect to your features, I.e. a linear combination of those features, but the features themselves might not be linear. You can also create a linear function of your highly non linear evaluation function. Just define your entire evaluation function as a feature and you have a linear evaluation function.
I believe chess evaluation is non-linear, buy any argument is welcome that would demonstrate linearity. However, creating a linear function of a highly non-linear evaluation function should lead to very bad results.
What I meant is that it is impossible to say if an evaluation function is linear or non linear. It is what the viewer wants it to be 😀.
Pio
Posts: 334
Joined: Sat Feb 25, 2012 10:42 pm
Location: Stockholm

Re: How to calc the derivative for gradient descent?

Post by Pio »

D Sceviour wrote: Wed Jan 06, 2021 12:52 am
Pio wrote: Tue Jan 05, 2021 11:47 pm The discussion about linearity in evaluation function is very bad. You might have a function that is linear with respect to your features, I.e. a linear combination of those features, but the features themselves might not be linear. You can also create a linear function of your highly non linear evaluation function. Just define your entire evaluation function as a feature and you have a linear evaluation function.
I believe chess evaluation is non-linear, buy any argument is welcome that would demonstrate linearity. However, creating a linear function of a highly non-linear evaluation function should lead to very bad results.
If you want to try out something crazy you can look at http://www.talkchess.com/forum3/viewtopic.php?t=48644 where I suggested a different way of summing up features.
tomitank
Posts: 276
Joined: Sat Mar 04, 2017 12:24 pm
Location: Hungary

Re: How to calc the derivative for gradient descent?

Post by tomitank »

D Sceviour wrote: Tue Jan 05, 2021 11:02 pm How does one prove the eval is linear?
I am not saying that chess is linear.
If all evaluation term are linear, then the whole is linear. It depends on your evaluation.
D Sceviour wrote: Tue Jan 05, 2021 11:02 pm Can anybody translate the links to NN chess for dummies? King placement is very important and this seems to be a starting point for NNUE tuning. What about pawn promotion which may or may not be king placement sensitive?
NN is another thing. There are many things available to overcome the local minimum.
Momentum, Adam, play with mini-batches, better weight initialization(eg: Kaiming He) etc...
But, there is currently no perfect recipe. You need to try. Over and over again until you reach your desired goal.

Welcome to the world of the Neural Network.
BrianNeal
Posts: 8
Joined: Sat Dec 26, 2020 5:58 pm
Full name: Brian Neal

Re: How to calc the derivative for gradient descent?

Post by BrianNeal »

AndrewGrant wrote: Tue Jan 05, 2021 1:15 am
BrianNeal wrote: Mon Jan 04, 2021 10:03 pm Hello, this is my first post.
I'd like to know which way you suggest for calculating the derivative of the evaluation for each parameter for gradient descent with Texel tuning. I've read about (Eval(xi+1)-Eval(xi-1))/2, Eval(xi+1)-Eval(xi), auto differentiation libraries, Jacobian matrix and so forth.
I'm currently using local search. My engine is written in C.
Might not directly answer your question, but I can plug something I wrote on the topic.

There is a section dedicated to the derivative of each term.
Thank you and thanks also to AlvaroBegue.
Your paper seems very interesting and I'll read it asap. Hopefully you won't mind if I ask if something is not clear to me :)
AndrewGrant
Posts: 1766
Joined: Tue Apr 19, 2016 6:08 am
Location: U.S.A
Full name: Andrew Grant

Re: How to calc the derivative for gradient descent?

Post by AndrewGrant »

BrianNeal wrote: Thu Jan 07, 2021 3:01 pm Thank you and thanks also to AlvaroBegue.
Your paper seems very interesting and I'll read it asap. Hopefully you won't mind if I ask if something is not clear to me :)
Of course. The code snippets are not a great source of utility, but the words behind them layout a framework for anyone to follow. So far, I think at least 3 or 4 engines are using this little system. Some verbatim.
#WeAreAllDraude #JusticeForDraude #RememberDraude #LeptirBigUltra
"Those who can't do, clone instead" - Eduard ( A real life friend, not this forum's Eduard )