def _thresholdNonLinearity(self, input, threshold, thresholdType=None):
    """
    Non linearity function, to transform the activations during training and
    encoding.
    :param input:          (array)  Activations
    :param threshold:      (array)  Thresholds
    :param thresholdType:  (string) 'soft', 'absoluteHard' or 'relativeHard'
    """
    if thresholdType == None:
      thresholdType = self.thresholdType

    activation = np.copy(input)

    if thresholdType == 'soft':
      return np.maximum(np.abs(activation) - threshold, 0.) * np.sign(activation)

    if thresholdType == 'absoluteHard':
      activation[np.abs(activation) < threshold] = 0.
      return activation

    if thresholdType == 'relativeHard':
      activation[activation < threshold] = 0.
      return activation
Non linearity function, to transform the activations during training and
    encoding.
    :param input:          (array)  Activations
    :param threshold:      (array)  Thresholds
    :param thresholdType:  (string) 'soft', 'absoluteHard' or 'relativeHard'