GithubHelp home page GithubHelp logo

Comments (4)

akshatvishu avatar akshatvishu commented on August 25, 2024

Will be working on this as a part of #350

from temporian.

ianspektor avatar ianspektor commented on August 25, 2024

Hey @akshatvishu!

This involves modifying quite a bit of cpp code:

  • Creating a new Accumulator implementation (see MovingSumAccumulator in temporian/implementation/numpy_cc/operators/window.cc)
  • Creating new accumulate overloads for moving_product in the same file
  • Registering and creating bindings for the new accumulate cpp functions (see bottom of that same file)

Plus, there's some specifics to moving product that make it not as straightforward to implement as moving sum, for example. We'd rather have the core dev team implement this (ETA: this/next week tops) and then have you do cumprod alone - unless you are perfectly comfortable with all of the above, in which case I can give more detail as to what these specifics are and let you take a shot at it :)

Let me know!

from temporian.

akshatvishu avatar akshatvishu commented on August 25, 2024

Hi @ianspektor ,

Thanks for the guidance. I'm keen to take a stab at implementing moving_product myself before you guys steps in. I've got a couple of quick questions to ensure I'm on the right track:

  • Zero or extreme values: How should I handle them in MovingProductAccumulator? Any tips for ensuring stability?
  • Accumulate overloads: Could you provide a bit more insight on handling cases with/without external sampling, and for constant vs. variable window lengths?

I plan to start working on this today and will update you by tomorrow on my progress to avoid any unnecessary delays on your end in-case I am unable to make any progress.

from temporian.

ianspektor avatar ianspektor commented on August 25, 2024

Sounds perfect 👍🏼 and great questions.

  • Zero or extreme values: zeros will result in the accumulator's result being 0. NaNs should be ignored (i.e., if we have a [2, NaN, 3] window, the result should still be 6, not NaN).
  • Accumulate overloads: you don't need to modify these, you'll just need to add the REGISTER_CC_FUNC and ADD_PY_DEF calls. See simple_moving_average's for reference.

Some extra notes:

  • You'll see that most accumulators work by adding/removing the new/old values from the window directly onto the accumulation result. This won't be possible here, since 0 would erase the accumulation, and precision loss would be high. Instead, we want the accumulator to store the left/right indexes, and compute the product on the whole window in Result().
  • No need to raise an error message on overflow (numpy doesn't in cumprod)
  • We'll only make this available for float types for now. This restriction should be in the C defs, the operator's accepted types, and the function's docstring.
  • Please do moving_product only for this task, leave cumprod for a follow up.

Issue and discord always open 💪🏼

from temporian.

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.