Thomj-Dev / SEMBAS

GNU General Public License v3.0
0 stars 0 forks source link

Stack Overflow with large dimensionality search spaces #31

Open ThomJ130 opened 2 weeks ago

ThomJ130 commented 2 weeks ago

When dealing with high dimensions, vectors grow linearly and matrices grow quadratically. When exploring a 28x28 pixel image classifier, I ran into a stack overflow error while measuring the diameter of a class's envelope. This was caused by creating an identity matrix on the stack instead of the heap, which came out to be 8 * (28*28)^2 bytes, or ~5MB of stack allocated memory. A simple fix is to use a dynamically allocated matrix (DMatrix) instead of a statically allocated OMatrix.

Refactor:

ThomJ130 commented 2 weeks ago

I am not going to fix this right away, I have other tests I am more interested in than image classifiers. So, keep in mind that the max dimensionality for Windows is somewhere around ~300-350, which is between 750kB-1MB of memory for these matrices.