Git Product home page Git Product logo

Comments (7)

MichaelClerx avatar MichaelClerx commented on June 15, 2024

Probably best to allow nan and inf to be returned from score functions...

from pints.

MichaelClerx avatar MichaelClerx commented on June 15, 2024

See #251

from pints.

mirams avatar mirams commented on June 15, 2024

Hmm, I'd be wary about dealing with such things too nicely and allowing them to happen quietly. In my limited experience it points to bad choices within the model itself, the parameter scalings, or the prior. I'd generally advocate failing loudly with nice suggestions of what to investigate!

from pints.

ben18785 avatar ben18785 commented on June 15, 2024

from pints.

MichaelClerx avatar MichaelClerx commented on June 15, 2024

OK.
There's a couple of levels on which we need to deal with these things:

  1. In the models we write (not a pints issue!)
  2. In ErrorMeasure and LogLikelihood classes provided by Pints. Here we could, for example, check that the input to these measures (the model results) can never contain NaN. And perhaps we could check the returned value for NaN too, but too be honest that would only occur if the data had an inf and the simulation had an inf of the opposite sign, so seems a bit of an odd case to sacrifice performance for?
  3. If users define their own error measures or loglikelihoods (or logpdfs) we can only handle things inside the individual methods. I'm inclined to ignore this level, as it'd mean extra code in every method?. We could decide to check for it in the Optimisation and MCMCSampling classes that use Optimisers etc. (so the few "controller" classes that most users will use), as a happy medium?

from pints.

MichaelClerx avatar MichaelClerx commented on June 15, 2024

For point 3: We're currently building an architecture that separates controllers (things that check stopping criteria, do parallelisation, talk nicely to the user etc.) from the individual methods (CMAES, PSO, AdaptiveCovarianceMCMC) that propose points to evaluate and then perform some kind of update step. For example see here: https://github.com/pints-team/pints/blob/master/pints/_optimisers/__init__.py#L154-L476

from pints.

MichaelClerx avatar MichaelClerx commented on June 15, 2024

In the end, this all boils down to the following convention:

  1. If NaNs occur, feel free to let things crash
  2. For error measures and (unnormalised) log likelihoods, +inf and @-inf are perfectly acceptable answers so don't treat them in any special way

The only exception to rule 2 is that we ask that the first point for any optimisation/inference problem has a finite error/log_pdf, so that we don't start from a garbage point

from pints.

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.