In a previous article, I introduced an efficient way to calculate spatial entropy, which is otherwise difficult to calculate (as far as I can tell). The main reason I use spatial entropy is to partition images, and so you can use this method to do exactly that, or more generally partition a space, by simply calculating the spatial entropy of your dataset first (just use method from my previous article, code below), which will be some value . Then, simply take the inverse log of
, and take the floor or ceiling of that value. Note that the code I’ve attached automatically returns an integer value. You can then use this number as the number of regions you partition your space into. So for example, if
, then you would partition the space in question into
equally sized regions, which would require
regions per dimension, where
is the dimension of the space in question.