Giter VIP home page Giter VIP logo

Comments (3)

patrick-kidger avatar patrick-kidger commented on May 29, 2024

Hi Alex,

The units of window_length is integration time, not data points. However, it turns out that in practice these two things should nearly always be the same thing. (See below.)

So your example code is correct. In what you've written, it is always 4 points, regardless of what times they correspond to. This is usually the desired behaviour. If you really want something different then you can use the t argument to logsig_windows. (Whose use might be clearer after the explanation below.)

Aside: whether passing t like this will improve/decrease performance of a model, I don't know. In the theoretical limit they end up being the same thing -- i.e. the choice doesn't matter -- but I can completely believe that the numerical error in the differential equation solver will affect each case differently. Try it and find out?

For completeness -- this is easily one of the most confusing aspects of working with neural CDEs. There are up to three different notions of time that may be considered:

  • Observation times, i.e. the actual raw t in "the temperature was x=20° at time t=midday". These should be appended to the data (x in your example) and then forgotten about. So what you're doing is correct in this regard.
  • Integration time, which is the region of time integrated over in the solver. This is essentially an arbitrary choice, by reparameterisation invariance. Because it's arbitrary, it's an optional t=None argument for functions like logsig_windows, in which case it just defaults to an arithmetic sequence 0, 1, 2, .... So again what you're doing is correct in this regard. (And it is this that window_size is with respect to.) If I was making this library again I'd probably just remove these t options entirely to avoid the confusion, as they're used so little.
  • Data points. That is, the i for counting your data x_0, x_1, x_2, ... x_i, .... This is always just the values 0, 1, 2, ..., so it will typically coincide with the integration time.

Does that make sense?

It's true that the documentation for logsig_windows (and for the above notions of time) could probably afford to be clearer. If you have any specific suggestions I'd be open to feedback / PRs.

from torchcde.

Krasner avatar Krasner commented on May 29, 2024

Thanks Patrick.

In that case, after applying logsig_windows I can use a fixed step solver with step size 1.0 correct?
X = torchcde.NaturalCubicSpline(train_coeffs)
X0 = X.evaluate(X.interval[0])
z0 = self.initial(X0)
zT = torchcde.cdeint(X=X,z0=z0,func=self.func,t=X.interval,method='rk4',options=dict(step_size=1.0))

Because the logsig will renormalize the observation times from raw data to just arithmetic sequence?

from torchcde.

patrick-kidger avatar patrick-kidger commented on May 29, 2024

Actually, you can use step_size=1.0 even without that. NaturalCubicSpline by default takes the integration time to be an arithmetic sequence.

I think you've got this now, but for the sake of any future readers:

  • Generally the correct thing to do is to append observation times to your data, and thereafter forget about time altogether. (With the one exception of setting step sizes.)
  • There's nothing special about NCDEs in that regard. You do the same when processing sequences with RNNs.

from torchcde.

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.