Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import numpy as np
- from tensorflow.keras.models import Sequential
- from tensorflow.keras.layers import Dense
- X= np.array([[0,0], [0,1], [1,0], [1,1]], dtype = np.float32)
- y= np.array([[0], [1], [1], [0]], dtype = np.float32)
- model = Sequential()
- model.add(Dense(8,input_dim=2,activation='relu'))
- model.add(Dense(8, activation = 'relu'))
- model.add(Dense(1, activation = 'sigmoid'))
- model.compile (loss = 'mean_squared_error', optimizer = 'adam', metrics= ['binary_accuracy'])
- model.fit(X,y,batch_size=1, epochs=5000,verbose=2)
- print(model.summary)
- print(model.predict(X))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement