Example #1
0
 /**
  * Updates the minimum duty cycles in a global fashion. Sets the minimum duty cycles for the
  * overlap and activation of all columns to be a percent of the maximum in the region, specified
  * by {@link Connections#getMinOverlapDutyCycles()} and minPctActiveDutyCycle respectively.
  * Functionality it is equivalent to {@link #updateMinDutyCyclesLocal(Connections)}, but this
  * function exploits the globalness of the computation to perform it in a straightforward, and
  * more efficient manner.
  *
  * @param c
  */
 public void updateMinDutyCyclesGlobal(Connections c) {
   Arrays.fill(
       c.getMinOverlapDutyCycles(),
       c.getMinPctOverlapDutyCycles() * ArrayUtils.max(c.getOverlapDutyCycles()));
   Arrays.fill(
       c.getMinActiveDutyCycles(),
       c.getMinPctActiveDutyCycles() * ArrayUtils.max(c.getActiveDutyCycles()));
 }
Example #2
0
 /**
  * Updates the minimum duty cycles. The minimum duty cycles are determined locally. Each column's
  * minimum duty cycles are set to be a percent of the maximum duty cycles in the column's
  * neighborhood. Unlike {@link #updateMinDutyCyclesGlobal(Connections)}, here the values can be
  * quite different for different columns.
  *
  * @param c
  */
 public void updateMinDutyCyclesLocal(Connections c) {
   int len = c.getNumColumns();
   for (int i = 0; i < len; i++) {
     int[] maskNeighbors =
         getNeighborsND(c, i, c.getMemory(), c.getInhibitionRadius(), true).toArray();
     c.getMinOverlapDutyCycles()[i] =
         ArrayUtils.max(ArrayUtils.sub(c.getOverlapDutyCycles(), maskNeighbors))
             * c.getMinPctOverlapDutyCycles();
     c.getMinActiveDutyCycles()[i] =
         ArrayUtils.max(ArrayUtils.sub(c.getActiveDutyCycles(), maskNeighbors))
             * c.getMinPctActiveDutyCycles();
   }
 }