Split function. As gradient and cost both calculated in backProp function we want to cache values as optim will call the functions seperately (for fn and gr). This closure splits the function, and will check if x (the par argument of optim) changes between calls. Will retrieve cached values if not (i.e will calculate cost and gradient for for fn, and retrieve cached values for gr)
1 | splitfn(f)
|
f |
the function to be split |
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.