SHARE
TWEET

Untitled

a guest May 26th, 2019 65 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. @staticmethod
  2.     def calculate_cost(y, y_hat):
  3.         num_train_examples = y_hat.shape[1]
  4.         cost = np.sum(- np.dot(y_hat, np.log(y).T) - np.dot(1 - y_hat, np.log(1 - y).T)) / num_train_examples
  5.         cost = np.squeeze(cost)
  6.  
  7.         return cost
  8.  
  9.     @staticmethod
  10.     def __sigmoid(x):
  11.         return 1.0 / (1.0 + np.exp(-x))
  12.  
  13.     @staticmethod
  14.     def __sigmoid_derivative(x):
  15.         return x * (1.0 - x)
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top