def trimSegments(self, minPermanence=None, minNumSyns=None):
<EOL>if minPermanence is None:<EOL><INDENT>minPermanence = self.connectedPerm<EOL><DEDENT>if minNumSyns is None:<EOL><INDENT>minNumSyns = self.activationThreshold<EOL><DEDENT>totalSegsRemoved, totalSynsRemoved = <NUM_LIT:0>, <NUM_LIT:0><EOL>for c, i in itertools.product(range(self.numberOfCols),<EOL>range(self.cellsPerColumn)):<EOL><INDENT>(segsRemoved, synsRemoved) = self._trimSegmentsInCell(<EOL>colIdx=c, cellIdx=i, segList=self.cells[c][i],<EOL>minPermanence=minPermanence, minNumSyns=minNumSyns)<EOL>totalSegsRemoved += segsRemoved<EOL>totalSynsRemoved += synsRemoved<EOL><DEDENT>if self.verbosity >= <NUM_LIT:5>:<EOL><INDENT>print("<STR_LIT>")<EOL>self.printCells(predictedOnly=False)<EOL><DEDENT>return totalSegsRemoved, totalSynsRemoved<EOL>
This method deletes all synapses whose permanence is less than
minPermanence and deletes any segments that have less than
minNumSyns synapses remaining.

:param minPermanence: (float) Any syn whose permanence is 0 or < 
       ``minPermanence``  will be deleted. If None is passed in, then 
       ``self.connectedPerm`` is used.
:param minNumSyns: (int) Any segment with less than ``minNumSyns`` synapses 
       remaining in it will be deleted. If None is passed in, then 
       ``self.activationThreshold`` is used.
:returns: (tuple) ``numSegsRemoved``, ``numSynsRemoved``