1. A computer-implemented method, comprising: in a learning stage: receiving a first input data at a first computing module in a hierarchy of computing modules, the first input data including a plurality of first spatial patterns corresponding to different time points; storing temporal relationships between the plurality of first spatial patterns based on the corresponding time points of the first spatial patterns; and assigning the first spatial patterns into a plurality of groups based on the temporal relationships of the first spatial patterns, a spatial pattern assigned to a group more likely to be temporally proximate within the first input data to another spatial pattern assigned to the same group compared to a spatial pattern assigned to another group; in an inference stage subsequent to the learning stage: detecting second spatial patterns in second input data at the first computing module responsive to receiving the second input data at the first computing module; generating a first output at the first computing module based on a group to which each of the second spatial patterns was assigned in the learning stage; and sending the first output to a second computing module higher in the hierarchy compared to the first computing module.