ogmacorp / AOgmaNeo

Arduino and Desktop compatible fast online/incremental machine learning system.
https://ogma.ai/
Other
53 stars 8 forks source link

code questions #2

Closed iacore closed 10 months ago

iacore commented 10 months ago

Here, t is never history_size, and t2 starts at t-1. As a result, history_samples[history_size-1] is never touched here. Is this intentional?

https://github.com/ogmacorp/AOgmaNeo/blob/9e2e3c80c19eb46ef63cba75455ffd05ee2b2c1d/source/aogmaneo/actor.cpp#L411-L421

222464 commented 10 months ago

Hi, yes, this is intentional, since the reward for sample t actually occurs at t - 1 (an action happens, then a reward is received for that action on the next step).

Hopefully this makes sense!

iacore commented 10 months ago

Thanks for answering!

Another question: the code here looks like it should be sum /= max(1, count) * 255;

https://github.com/ogmacorp/AOgmaNeo/blob/9e2e3c80c19eb46ef63cba75455ffd05ee2b2c1d/source/aogmaneo/image_encoder.cpp#L213

222464 commented 10 months ago

That's just to avoid a divide by zero in rare cases, the two statements are equivalent since count is an integer.

iacore commented 10 months ago

when the count is zero they are not the same.

222464 commented 10 months ago

True, but in the 0 case no value is valid anyway - also, in those rare cases (only when the hierarchy is strangely configured), sum will also be zero, so it will be 0 / something.