darach / eep-js Goto Github PK
View Code? Open in Web Editor NEWeep.js - Embedded Event Processing
License: MIT License
eep.js - Embedded Event Processing
License: MIT License
Hi,
In my application I'm using complex objects as data items to processed in windows and I have a custom function to accumulate and compensate. The sliding window uses a Buffer to store the values inside the window which make using objects impossible, since to compensate you need to have the evicting item.
I manually made a change to your code (lib/eep.window_sliding.js) to change the Buffer into an Array.
In this issue I'm just suggesting using the Array instead to make your implementation more generic. I know that this would somewhat increase the memory usage.
Here's what I changed:
var p = new Array(size);
Cheers,
Panickos
The experiment with embedded event processing has received its first pull request from brapse who should be added to a contributors file and a contributors section in package.json.
Given the following code using a fresh checkout of the repository on node v0.10.26:
var windows = eep.EventWorld.make().windows();
var win = windows.sliding(eep.Stats.min, 3);
win = windows.ordered(win);
win.on('emit', function(value) {
console.log('min:' + value);
});
var values = [1,2,3,4,5,6];
for (var i in values) {
win.enqueue(values[i]);
}
I get:
min:1
min:1
min:2
min:3
While I would have expected:
min:1
min:2
min:3
min:4
Replacing Stats.min by Stats.max I get the expected behavior, so I suspect there's an issue with Stats.min.
The most numerically stable way to take a rolling average is to use the strategy
new_average = old_average + (new_value - old_average) / new_count
MeanFunction's accumulate should be
self.accumulate = function(v) { s+=(v-s)/++n; }
self.emit = function() { return s; }
Likewise, variance can use the form
Var(X) = E[X^2]-E[X]^2
where both are simple means, admitting a similar solution to above (e2 +=(v*v - e2)/n for second moment)
tyranically
should be tyrannically
Compensating function is incorrect for kurtosis. Side effect of introducing compensating aggregate functions. Remove now, add back later.
I think to make this useful, a declarative language and parser is needed. (e.g. compare Esper). Anyway, this is the proper way to start to make such a framework generic. Of course the non-trivial thing is to make stream joins efficient.
Hi,
I've noticed that monotonic and periodic windows are identical right now.
It's not entirely true though, because monotonic, if I understand underlying idea correctly, should not receive clock in it's constructor. Instead, it should set monotonic clock by default, and periodic should use wall clock.
Is this behavior intended?
Hi,
It seems that it's very possible to avoid using Temporal and Temporal function (actually, it's done quite similarly in Erlang implementation).
I believe that what they do technically belongs to the Clock rather then these two.
Would you accept a patch that removes them & moves impl to Clock instead? Or do you think it's a bad idea and they serve their purpose somewhere I haven't really noticed.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.