Code Monkey home page Code Monkey logo

Comments (7)

AlexanderFabisch avatar AlexanderFabisch commented on August 27, 2024

Hi @RicardoDominguez,

I don't know exactly what was the reason for that any more. Would be interesting to find out if the numerical solution is more stable or slower though. It shouldn't be too difficult to change the implementation to use the analytical solution. If you have any insight, please let us know. I will leave this issue open for now.

from bolero.

RicardoDominguez avatar RicardoDominguez commented on August 27, 2024

I'll change the implementation and see how it affects performance and stability. When I have some insights I'll get back to you.

from bolero.

RicardoDominguez avatar RicardoDominguez commented on August 27, 2024

Hey @AlexanderFabisch,

I have done some tests comparing the performance of using the numerical vs analytical computation of the gradient of the dual function, and it seems that:

  • For REPS computing the analytical solution may lead to slightly increased computational overhead but may also lead to better solutions (found minimizing the Rosenbrock function). Perhaps for more complex optimization problems the overhead of computing the gradient is not as significant so overall computational time is reduced?
  • For C-REPS computing the analytical solution may lead to much faster optimization (check this) but I found no evident of it leading to better (or worse) solutions.

Regarding stability I have had no problems during my testing. For all the exponentials I've subtracted the maximum value so the implementation should be relatively safe.

A clean implementation without any of the testing functions can be found here. Feel free to validate my results and tell me if you want me to pull request.

from bolero.

AlexanderFabisch avatar AlexanderFabisch commented on August 27, 2024

For REPS computing the analytical solution may lead to slightly increased computational overhead but may also lead to better solutions (found minimizing the Rosenbrock function). Perhaps for more complex optimization problems the overhead of computing the gradient is not as significant so overall computational time is reduced?

That seems to be surprising to me. I would expect that it is faster because the optimizer will otherwise call the objective function multiple times to estimate the gradient. Also can't reproduce this:

$ python reps_rosen_time.py 
...
Numerical gradient  completed in average time of 2.03754606247 seconds
...
Analytical gradient  completed in average time of 1.91270718575 seconds

For C-REPS computing the analytical solution may lead to much faster optimization (check this) but I found no evident of it leading to better (or worse) solutions.

Looks great.

Regarding stability I have had no problems during my testing. For all the exponentials I've subtracted the maximum value so the implementation should be relatively safe.

Maybe @jmetzen remembers why we didn't implement the analytical solution?

A clean implementation without any of the testing functions can be found here. Feel free to validate my results and tell me if you want me to pull request.

A pull request would be awesome. Maybe we can also put some test scripts to the benchmark folder.

from bolero.

RicardoDominguez avatar RicardoDominguez commented on August 27, 2024

That seems to be surprising to me. I would expect that it is faster because the optimizer will otherwise call the objective function multiple times to estimate the gradient. Also can't reproduce this:

That is also what I expected so I am a bit puzzled by why that is sometimes not the case.

Maybe we can also put some test scripts to the benchmark folder.

Do you mean benchmarks for numerical vs analytical or for REPS / C-REPS in general?

from bolero.

AlexanderFabisch avatar AlexanderFabisch commented on August 27, 2024

Maybe we can also put some test scripts to the benchmark folder.

Do you mean benchmarks for numerical vs analytical or for REPS / C-REPS in general?

You can add those scripts that you implemented to compare the numerical and analytical gradient so that they are not lost.

from bolero.

AlexanderFabisch avatar AlexanderFabisch commented on August 27, 2024

We use the analytical version of both gradients in the master now.

from bolero.

Related Issues (20)

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.