SHARE
TWEET

Untitled

a guest Aug 19th, 2019 74 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. from elmo_layer import ElmoEmbeddingLayer
  2. from tensorflow.keras.models import Model
  3. from tensorflow.keras.layers import (
  4.     Dense,
  5.     Dropout
  6. )
  7.  
  8.  
  9. num_classes = 1
  10. batch_size = 512
  11. epochs = 200
  12. learnRate = 0.001
  13.  
  14. input_text = Input(shape=(1,), dtype="string", name='input_0')
  15. x = ElmoEmbeddingLayer(trainable=False)(input_text)
  16. x = Dropout(0.3)(x)
  17. x = Dense(256, activation='relu')(x)
  18. x = Dense(num_classes, activation="sigmoid")(x)
  19.  
  20. model = Model(inputs=[input_text], outputs=x)
  21.  
  22. model.summary()
  23.  
  24. # 'binary_crossentropy'
  25. model.compile(loss='binary_crossentropy',
  26.               optimizer='adam',
  27.               metrics=['accuracy'])
  28.  
  29. sess.run(tf.global_variables_initializer())
  30. sess.run(tf.tables_initializer())
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
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top