Comments (4)
Will be working on this as a part of #350
from temporian.
Hey @akshatvishu!
This involves modifying quite a bit of cpp code:
- Creating a new
Accumulator
implementation (seeMovingSumAccumulator
intemporian/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.
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.
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
andADD_PY_DEF
calls. Seesimple_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 inResult()
. - 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, leavecumprod
for a follow up.
Issue and discord always open 💪🏼
from temporian.
Related Issues (20)
- New operators: trigonometric functions HOT 2
- New operators: round, floor, ceil HOT 14
- New operator: cumprod HOT 3
- New operators: min, max HOT 7
- Feature: tp.to_numpy() HOT 9
- Scalene supports Python 3.11 and Python 3.12 HOT 15
- Show first and last events instead of only first ones when displaying an EventSet HOT 11
- Build error at pip install - Mac Intel HOT 10
- Discord link does not work HOT 1
- Extend EventSet's >, <, >=, <= to work with string literals
- Suggestion : Documentation Suggestion HOT 1
- Sorting of `to_numpy` and `to_pandas`
- Feature: `tp.from_polars` and `tp.to_polars` HOT 2
- Not able to test temporian on Mac OS M2 chip HOT 2
- Bump `actions/checkout` to `@v4` and `actions/github-script` to `@v7` to get rid of the node16 warnings.
- Feature: timestamp_in operator HOT 2
- `normalize_timestamp()` raises OSError on Windows with pre-epoch time timestamps
- Extra elipsis when displaying a single-event EventSet HOT 4
- New Operator: `relative_distance`
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from temporian.