Giter VIP home page Giter VIP logo

Comments (6)

fpicetti avatar fpicetti commented on June 15, 2024

Hi @xichaoqiang! Thanks for using this library.

For non linear problems, you need to define the forward modeling and the (linear) Jacobian operator.
In particular, you can derive its forward and adjoint functions directly from the nonlinear forward problem.

Check out the VarPro tutorial, and let us know!

from occamypy.

xichaoqiang avatar xichaoqiang commented on June 15, 2024

Thanks for your reply.

from occamypy.

xichaoqiang avatar xichaoqiang commented on June 15, 2024

I may only have the forward Jacobian matrix obtained by numerical difference. Does the adjoint Jacobian matrix need to be defined?

from occamypy.

fpicetti avatar fpicetti commented on June 15, 2024

I fear yes, as in adjoint-state methods you need the adjoint jacobian for computing the gradient g = F'r = F'(f(m) - d).

If you know the formula of your nonlinear modeling f(m), you can derive the analytic Jacobian and implement both forward and adjoint.

from occamypy.

xichaoqiang avatar xichaoqiang commented on June 15, 2024

Thanks. I want to slove a simple 1-D surface wave dispersion inversion with LeastSquares algorithms.

Usually I use L-M algorithm by defing the forward and jacobian functions.

I want use occamypy to the inversion problem, because I want to constrain the inversion problem with lower/upper bounds and the reference model.

How can I do by just defing the forward and jacobian functions?

from occamypy.

biondiettore avatar biondiettore commented on June 15, 2024

Hi @xichaoqiang,

Thanks for using the library. Try to have a look at the tutorial on the Rosenbrock benchmark (Rosebrock). Specifically, look at the second code block in which the Rosenbrock problem is defined. If you have to implement your own problem, you can simply inherit from occamypy.Problem and implement the constructor (init), objf, resf, and gradf. The last three corresponds to your objective function, and residual and gradient vector computations, respectively.

On the other hand, if you want to solve an L2-norm non-linear problem, define an occamypy.NonlinearOperator by using your forward and Jacobian operators. You have to wrap your functions within an occamypy.Operator. As @fpicetti mentioned, look at the second block of the VarPro tutorial. In the following code blocks, you can see how they are used to solve a non-linear L2 problem. FYI, you are not required to define the forward part of the Jacobian operator but only the adjoint. For the bounds, you can simply pass two model vectors to occamypy.NonlinearLeastSquares as minBound and maxBound, which define the lower and upper bounds, respectively.

I hope this helps you understand how to use the library a little bit more. Let us know if you have other difficulties with it.
Cheers!

from occamypy.

Related Issues (14)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.