import math
import sys

def sigmoid(x):
    try:
        val = 1/(1 + math.exp(-x))
    except OverflowError:
        val = sys.float_info.max
    return val

def sigmoidprime(x):
    return (1 - sigmoid(x))*sigmoid(x)

import math
import sys

def sigmoid(x):
    try:
        val = 1/(1 + math.exp(-x))
    except OverflowError:
        val = 0.
    return val

def sigmoidprime(x):
    return (1 - sigmoid(x))*sigmoid(x)

Fix mistake in sigmoid function
Fix mistake in sigmoid function

  import math
  import sys
  
  def sigmoid(x):
      try:
          val = 1/(1 + math.exp(-x))
      except OverflowError:
-         val = sys.float_info.max
+         val = 0.
      return val
  
  def sigmoidprime(x):
      return (1 - sigmoid(x))*sigmoid(x)
  
Fix mistake in sigmoid function
## Code Before:
import math
import sys

def sigmoid(x):
    try:
        val = 1/(1 + math.exp(-x))
    except OverflowError:
        val = sys.float_info.max
    return val

def sigmoidprime(x):
    return (1 - sigmoid(x))*sigmoid(x)

## Instruction:
Fix mistake in sigmoid function
## Code After:
import math
import sys

def sigmoid(x):
    try:
        val = 1/(1 + math.exp(-x))
    except OverflowError:
        val = 0.
    return val

def sigmoidprime(x):
    return (1 - sigmoid(x))*sigmoid(x)
