code: def binary_cross_entropy_cost( outputs, targets, derivative=False, epsilon=1e-11 ):
      
      # Prevent overflow
      outputs = np.clip(outputs, epsilon, 1 - epsilon)
      divisor = np.maximum(outputs * (1 - outputs), epsilon)
      
      if derivative:
          return (outputs - targets) / divisor
      else:
          return np.mean(-np.sum(targets * np.log( outputs ) + (1 - targets) * np.log(1 - outputs), axis=1))
docs: The output signals should be in the range [0, 1]