You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Replace np.vstack in ContinuousSpace by array growth approach inspired from NumpyAgentDataset #3548
However, NumpyAgentDataSet uses geometric doubling, controlled by class-level constants,
It then uses growth = max(int(current_size * (self._GROWTH_FACTOR - 1)), self._MIN_GROWTH) to calculate the new size.
There is nothing stopping us from using this approach in continuous space as well. There is just a clear memory cost, and which is better (20% growth or doubling) depends on the use case.
There is nothing stopping us from using this approach in continuous space as well. There is just a clear memory cost, and which is better (20% growth or doubling) depends on the use case.
Agreed! Just to clarify, I actually wasn't suggesting we increase the default growth factor.
The proposal is strictly to drop the np.vstack in favor of the method used in NumpyAgentDataSet
Activity
quaquel commentedon Mar 15, 2026
There is nothing stopping us from using this approach in continuous space as well. There is just a clear memory cost, and which is better (20% growth or doubling) depends on the use case.
Replace np.vstack with geometric array growth in ContinuousSpace
codebreaker32 commentedon Mar 15, 2026
Agreed! Just to clarify, I actually wasn't suggesting we increase the default growth factor.
The proposal is strictly to drop the
np.vstackin favor of the method used in NumpyAgentDataSetquaquel commentedon Mar 15, 2026
I'd be curious to see some microbenchmarks comparing both.
codebreaker32 commentedon Mar 16, 2026
Min of 10,000 runs
For GROWTH_FACTOR = 0.2
np.vstackOS Spec - Ubuntu 24.04.2
codebreaker32 commentedon Mar 16, 2026
What do you prefer now @quaquel ?
quaquel commentedon Mar 16, 2026
preallocate is clearly faster, so the answer seems obvious :).