> 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,
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).
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
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:
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
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
> 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 |
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
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
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
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
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
,
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
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
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
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"
|
16 matches
Mail list logo