Re: [Pharo-users] Moving/rolling average implementations ?

2020-04-13 Thread Guillermo Polito
> El 13 abr 2020, a las 11:00, Richard O'Keefe escribió: > > Concerning method categories: > VIsualAge Smalltalk manages without them. Of all the Smalltalk > systems available to me, it's the only one where I don't enjoy using > the browser. It carves up the world of methods another way,

Re: [Pharo-users] Moving/rolling average implementations ?

2020-04-13 Thread Cédrick Béler
And maybe another one to show deviation problem ? testRunningMeansDeviation | result1 result2 col1 col2 | col1 := #(0.3s1 1s1 0.1s1 0.3s1 1s1 0.1s1 0.3s1 1s1 0.1s1). result1 := col1 runningMeans: 2. col2 := #(0.3 1 0.1 0.3 1 0.1 0.3 1 0.1).

Re: [Pharo-users] Moving/rolling average implementations ?

2020-04-13 Thread Richard O'Keefe
Concerning method categories: VIsualAge Smalltalk manages without them. Of all the Smalltalk systems available to me, it's the only one where I don't enjoy using the browser. It carves up the world of methods another way, which I find of little or no help. That in no way detracts from it being

Re: [Pharo-users] Moving/rolling average implementations ?

2020-04-13 Thread Cédrick Béler
What about this test (in OrderedCollectionTest - it suggests a Trait too) ? testRunningMeans | result col | col := #(1 1 2 2 3 3) asOrderedCollection. result := col runningMeans: 2. self assert: (result = {1. (3/2). 2. (5/2). 3}). self assert:

Re: [Pharo-users] Moving/rolling average implementations ?

2020-04-12 Thread Richard O'Keefe
I did mention that it was one of eight implementations that I tried. In fact you broke it with your change. It is important ***NOT*** to keep a running sum but a running MEAN. The line m := ((self at: i) - (self at: d)) / width + m was written that way for a reason. I did think of renaming

Re: [Pharo-users] Moving/rolling average implementations ?

2020-04-12 Thread Cédrick Béler
Fully agree on proper names. === I don’t know if this is because of free confinement time but I can keep on asking questions so I share some I hope will make sense (for the sake of discussion). For instance, I'm wondering if tests on conditions so as to raise proper exceptions is a good

Re: [Pharo-users] Moving/rolling average implementations ?

2020-04-12 Thread Sven Van Caekenberghe
> On 12 Apr 2020, at 13:53, Cédrick Béler wrote: > > Beautiful ^^ I also like it. But why the single letter variable names ? Why not: SequenceableCollection>>#runningMeans: width | means sum index | means := Array new: self size - width + 1. sum := 0. 1 to: width do: [ :each |

Re: [Pharo-users] Moving/rolling average implementations ?

2020-04-12 Thread Cédrick Béler
Beautiful ^^ I would vote for inclusion in the base image ? With your explanation as comments. I’ll play with it. Thanks Cedrick > Le 12 avr. 2020 à 12:19, Richard O'Keefe a écrit : > >  > I have coded and benchmarked 8 different running mean algorithms. > In the presence of inexact

Re: [Pharo-users] Moving/rolling average implementations ?

2020-04-12 Thread Richard O'Keefe
I have coded and benchmarked 8 different running mean algorithms. In the presence of inexact numbers it is not as accurate as redoing the sums, but it's pretty close, and it's fast. If "width" is not an integer or is out of range, an error will be reported by #new: or #at:[put:]. It's based on

Re: [Pharo-users] Moving/rolling average implementations ?

2020-04-10 Thread Cédrick Béler
naccuracies should > balance out. > > > > Cheers, > > Christian > > > > Von: Pharo-users <mailto:pharo-users-boun...@lists.pharo.org>> Im Auftrag von Richard O'Keefe > Gesendet: Donnerstag, 9. April 2020 05:26 > An: Any quest

Re: [Pharo-users] Moving/rolling average implementations ?

2020-04-09 Thread Richard O'Keefe
and subtracted once. > > If + and – is symmetrical in this respect, rounding inaccuracies should > balance out. > > > > Cheers, > > Christian > > > > *Von:* Pharo-users *Im Auftrag von > *Richard > O'Keefe > *Gesendet:* Donne

Re: [Pharo-users] Moving/rolling average implementations ?

2020-04-09 Thread Cédrick Béler
Hi Richard and Christian, thanks for the comments/suggestions. For the "self species ofSize… », I got inspiration from the image like with #overlappingPairsCollect: As for float rounding errors, that interesting to consider indeed. I’ll try a buffer variant. Some related questions for my OO

Re: [Pharo-users] Moving/rolling average implementations ?

2020-04-09 Thread Christian Haider
, Christian Von: Pharo-users Im Auftrag von Richard O'Keefe Gesendet: Donnerstag, 9. April 2020 05:26 An: Any question about pharo is welcome Betreff: Re: [Pharo-users] Moving/rolling average implementations ? I note that "self species ofSize: n" is not generally a

Re: [Pharo-users] Moving/rolling average implementations ?

2020-04-08 Thread Richard O'Keefe
I note that "self species ofSize: n" is not generally a good idea. Consider ByteArray, ShortIntegerArray, WordArray. Computing rolling means of these is perfectly sensible, but the results will not fit into an array of the same species. I'd stick with Array. The suggestion about subtracting an

Re: [Pharo-users] Moving/rolling average implementations ?

2020-04-08 Thread Christian Haider
Auftrag von Cédrick Béler Gesendet: Mittwoch, 8. April 2020 10:07 An: Any question about pharo is welcome Betreff: [Pharo-users] Moving/rolling average implementations ? Hi, I wanted to do a moving/rolling average on raw data [1]. I haven’t find code for that (maybe this is done in polymath

[Pharo-users] Moving/rolling average implementations ?

2020-04-08 Thread Cédrick Béler
Hi, I wanted to do a moving/rolling average on raw data [1]. I haven’t find code for that (maybe this is done in polymath though). So I ended writing that (I thing this is SMA): SequenceableCollection>>movingAverage: anOrder "Answer the moving or rolling average for anOrder window" |