Advertisement
Guest User

Untitled

a guest
Jun 16th, 2019
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.46 KB | None | 0 0
  1. X = np.array([[0, 0], [0, 1], [1, 0], [1, 1]])
  2. y = np.array([[0], [1], [1], [0]])
  3.  
  4. model = Sequential([
  5. Dense(2, activation="sigmoid", input_dim=2),
  6. Dense(1, activation="sigmoid")
  7. ])
  8.  
  9. model_1.compile(loss="binary_crossentropy", optimizer="adamax")
  10. model_1.fit(X, y, batch_size=4, epochs=16000)
  11.  
  12. model_2.compile(loss="binary_crossentropy", optimizer="sgd") # Never converge independently of how many epochs
  13. model_2.fit(X, y, batch_size=4, epochs=16000)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement