Giter Site home page Giter Site logo

Profiling results about pykriging HOT 5 OPEN

capaulson avatar capaulson commented on July 19, 2024
Profiling results

from pykriging.

Comments (5)

capaulson avatar capaulson commented on July 19, 2024

@takluyver Thanks for the results. I've looked at those sections of code as well to look for methods of acceleration. I haven't spent too much time looking at performance simply because I typically train a model once, then query often. Do you have a need where model training would limit the usefulness of PyKriging?

from pykriging.

takluyver avatar takluyver commented on July 19, 2024

No, not particularly. I just spotted an easy way to improve performance in the samplingplan module, and so I profiled the rest of an example to see if there was more low-hanging fruit. I couldn't see any, but I thought I'd leave the results here as a starting point for anyone who wants to take it further.

from pykriging.

TsingQAQ avatar TsingQAQ commented on July 19, 2024

====== Update Line =======
Hi @capaulson and @takluyver
It has been verified that the following line in the updatePsi function is a major(more than 70% runtime!) contributer to the runtime of the code.
newPsi = np.exp(-np.sum(self.theta * np.power(self.distance, self.pl), axis=2))
Since the updateModel will be called frequently this command will be excuted thousands or even millions times and will take up most of the rumtime.
So if there are some way to make this code run faster, the whole program will be boosted dramatically.

========================
Hi there, I've faced with the performance problem in #20 , and just ran some simple test to see what's going on in the code that takes time. I believe that what really takes time is the PSO optimization in train function.
This optimization takes about 1 minute on average in my case.

I've got some experience on PSO, though I haven't take look at its detail in Inspyred, if it is a classic PSO,
the swarm size could be smaller(40 in my experience), and a 1000 max_evaluations could give a relative good results (30000 will take much more time if no terminate conditions meet).

Take Rosenbrock benchmark function with 10 dimensions as an example:(according to my experience)
This functions global optimum is:
f(1, 1, 1, 1, 1, 1, 1, 1, 1, 1) = 0
PSO with 40 swarms and 1000 max iter perform results:

classic PSO reaches around 0.5-5(may be trapped in local minima)
PSO with adaptive intertia weight reaches around 0.5
OPSO reaches around 0.0005 - 0.05
All this PSO will not take more than 15 seconds on this optimization.

So a relatively smaller swarm size and max evaluation may save time significantly without too much lose accuacy. If a absolute global minimum is indeed needed, I'll suggest OPSO method.

from pykriging.

capaulson avatar capaulson commented on July 19, 2024

@TsingQAQ thanks for the recommendation. I'll take a look. The line you've identified is indeed the bulk of the computation happening here. This line is where new hyperparameters are tested during optimization. I've looked for ways to expedite that calculation, but haven't been too successful yet (at least not in a way that remains general enough for distribution). There may be ways to speed this up with GPU computing etc.

One thing that would be useful to have would be a bench marking test suite. It would be great if you could compile some of these test functions you're using and create a pull request. I can work from there to start building a way to actually record performance values based on optimizers, swarm sizes, etc.

from pykriging.

TsingQAQ avatar TsingQAQ commented on July 19, 2024

Hi @capaulson , I've update the testfunction in #23 , which includes the bench mark function tested in #20

Also, I've tried to make it faster through some ways(numba, numexpr) though failed to make any progress, though I'm not familar with these tools so just some biased experience for your reference.

from pykriging.

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.