Skip to content

Instantly share code, notes, and snippets.

@Yash-567
Last active October 4, 2020 16:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Yash-567/344ad748be4c4d3df1344eb506e38d58 to your computer and use it in GitHub Desktop.
Save Yash-567/344ad748be4c4d3df1344eb506e38d58 to your computer and use it in GitHub Desktop.
# keras model
u = Input(shape=(1,))
m = Input(shape=(1,))
u_embedding = Embedding(N, K)(u) # (N, 1, K)
m_embedding = Embedding(M, K)(m) # (N, 1, K)
u_embedding = Flatten()(u_embedding) # (N, K)
m_embedding = Flatten()(m_embedding) # (N, K)
x = Concatenate()([u_embedding, m_embedding]) # (N, 2K)
x = Dense(400)(x)
x = Activation('relu')(x)
x = Dense(1)(x)
model = Model(inputs=[u, m], outputs=x) # Function 1 fulfilled
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment