windowed(partialWindows=true) non-symmetric head/tail?

Maybe my assumption is the opposite of industry-standard, but I expected
inputs.windowed(5, 1, true) to have the same number of inputs as outputs, because the step size is 1 and the partialWindows=true.

Instead, it only “partial windows” on the tail end. Is there a way around this?

Reason I care: I’m averaging a list of Doubles with a window size of 5, but while the tail correctly averages with “less data”, the head doesn’t.

val smoothedData = myData.windowed(5, 1, true).map { it.average() }

What I expected:

x 
x x 
x x x 
x x x x 
x x x x x
x x x x
x x x 
x x 
x

But what I got

x x x x x
x x x x
x x x 
x x 
x
1 Like

I agree, I had the same expectation. I think the function should take multiple parameters, as in partialHeads and partialTails.