Sigmoid Function

Easy
~10 min
code completion

The Sigmoid Function

The sigmoid function squashes any real number to the range (0, 1), making it interpretable as a probability:

Key properties:

  • — neutral input → 50% probability
  • as
  • as
  • Works element-wise on arrays
  • In NumPy: 1 / (1 + np.exp(-z))

    Your task:

    Implement sigmoid(z) that applies the sigmoid function element-wise.

    Example Tests

    z=0 gives exactly 0.5

    Input: {"z":0}

    Expected: 0.5

    Large positive z approaches 1

    Input: {"z":100}

    Expected: 1

    Large negative z approaches 0

    Input: {"z":-100}

    Expected: 0

    Sign in to solve this problem

    You can read the full problem statement above. Create a free account to run code in the browser, submit solutions, and track your progress.