Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from __future__ import print_function
- import keras
- from keras.models import Sequential
- from keras.layers import Dense
- from keras.utils import to_categorical
- import numpy as np
- np.random.seed(0)
- X = np.array([[0.1, 0.5], [1.1, 2.3], [-1.1, -2.3], [-1.5, -2.5]])
- y = np.array([0, 1, 2, 2])
- y_enc = to_categorical(y)
- W = np.array([[0.1, 0.2, 0.3],
- [0.1, 0.2, 0.3]])
- b = np.array([0.01, 0.1, 0.1])
- model = Sequential()
- model.add(Dense(3, weights=[W,b] , input_dim=2))
- model.summary()
- model.compile(loss='categorical_crossentropy', optimizer='Adam')
- print(model.evaluate(X , y_enc))
Add Comment
Please, Sign In to add comment