std::math::var lp = 0.5 * cross(u,v)
lp.grad() ;
std::cout << " d.f / d.u = " << u.adj() << " d.f / d.v = " << v.adj() << std::endl;--
You received this message because you are subscribed to the Google Groups "Stan users mailing list" group.
To unsubscribe from this group and stop receiving emails from it, send an email to stan-users+...@googlegroups.com.
To post to this group, send email to stan-...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
To plug in an external black box function for use with the rest of
our autodiff, you need to be able to compute its value
and its Jacobian.
--
You received this message because you are subscribed to the Google Groups "Stan users mailing list" group.
To unsubscribe from this group and stop receiving emails from it, send an email to stan-users+unsubscribe@googlegroups.com.
On Mar 19, 2017, at 10:34 AM, Adam Hartshorne <adam.ha...@gmail.com> wrote:
My ultimate goal is a least squares optiminization, via Levenberg-Marquart method, thus I need to form the Jacobian of a cost function. The cost function I am using includes a term which is the difference of Gaussian Curvature.
Gaussian Curvature can be defined as a combination of First and Second Fundamental Forms of a Surface.K = (e*g - f^2) / (E*G - F^2)whereN = cross(du,dv) / norm(du,dv)e = dot(N, duu)f = dot(N,duv)g = dot(N, dvv)E = dot(du,du)
F = dot(du,dv)
G = dot(dv,dv)
where du is partial differential of f with respect to u etc as stated before.
So I want to incorporate the Jacobian of this function in my LM optimization.I am using Pixar's OpenSubDiv library to model a surface. I have modified this set of functions, such that it returns upto 3rd Derivs. However, I don't have access to the base function f(u,v), only the ability to call a function which returns things like du, duv, ...
What it does is a little bit more complicated, but for ease of explanation lets say that it effectively takes a set of triples (faceId,u,v) and form which you can return the values of the partial first, second and third order derivations. The faceId isn't important, just think of it as a function f(u,v). The exact function is a blackbox hidden in OpenSubDiv (it is actually different functions depending on various conditions, which is why I don't want to open the blackbox up directly to AutoDiff).
So what I want to do is override some operators in Stan that effectively says when it is trying to calculate the Jacobian and will differentiate K, for all the partial diffs that will be required I know what the value is and insert that into the graph directly.
As stated in my last post, Adept appears to have exactly this function built-in called append_derivative_dependence, which is explained in Section 2.7 of their documentation.
On Sunday, 19 March 2017 01:04:02 UTC, Daniel Lee wrote:
HI Adam,It's still very unclear. If you can compute the function value and the gradients with respect to the parameters, there are ways to create Stan autodiff variables with the right structure. That said, you'll have to be pretty familiar with how the math library works. It's outlined in the arXiv paper (with working examples). The next place to look is the code and in particular, the unit tests that show exactly how to instantiate these things.Mind trying to describe:- what you're trying to do (the overall goal)- what pieces you have available to you; be specific here down to function signatures if you canHopefully that's enough for us to help out.Daniel
On Sat, Mar 18, 2017 at 3:39 PM, Adam Hartshorne <adam.ha...@gmail.com> wrote:
Thought it was worth mentioning that the Adept AutoDiff library has a very useful function for problems such as mine. They offer something called append_derivative_dependence, which allows you to specific that you know the differential as calculated by a third party library.Section 2.7
--
You received this message because you are subscribed to the Google Groups "Stan users mailing list" group.
To unsubscribe from this group and stop receiving emails from it, send an email to stan-users+...@googlegroups.com.
To post to this group, send email to stan-...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "Stan users mailing list" group.
To unsubscribe from this group and stop receiving emails from it, send an email to stan-users+...@googlegroups.com.