Merge Keras Embeddings with normal models into one sequential ModelMerge 2 sequential models in Kerasloss, val_loss, acc and val_acc do not update at all over epochsUserWarning: Update your `Dense` call to the Keras 2 API:Implement perceptual loss with pretrained VGG using kerasHow does Keras read input data?Building an LSTM net with an embedding layer in KerasGet increasing loss and poor performance on Variational AutoencoderHow to save and reuse all settings for a keras model?scipy.ndimage.zoom is taking long time even on small arraysEpoch's steps taking too long on GPU'Sequential' object has no attribute 'loss' - When I used GridSearchCV to tuning my Keras model
Am I allowed to use personal conversation as a source?
Why force the nose of 737 Max down in the first place?
How can I say in Russian "they cannot make the tournament attractive by itself"?
How can I rectify up to 85 kV
How many oliphaunts died in all of the Lord of the Rings battles?
What is the most efficient way to write 'for' loops in Matlab?
Isolated audio without a transformer
What is the difference between 1/3, 1/2, and full casters?
Pointwise convergence of uniformly continuous functions to zero, but not uniformly
Why is the number of local variables used in a Java bytecode method not the most economical?
Please explain joy and/or the Kimatthiyasutta
Melee or Ranged attacks by Monsters, no distinction in modifiers?
If Trump gets impeached, how long would Pence be president?
What is this spacecraft tethered to another spacecraft in LEO (vintage)
Is there an antonym for "spicy" or "hot" regarding food (NOT "seasoned" but "spicy")?
Did the IBM PC use the 8088's NMI line?
What is the use of で in this sentence?
Why can't my huge trees be chopped down?
Unethical behavior : should I report it?
Converting 8V AC to 8V DC - bridge rectifier gets very hot while idling
Character is called by their first initial. How do I write it?
If my pay period is split between 2 calendar years, which tax year do I file them in?
How do I stop my characters falling in love?
How to tar a list of directories only if they exist
Merge Keras Embeddings with normal models into one sequential Model
Merge 2 sequential models in Kerasloss, val_loss, acc and val_acc do not update at all over epochsUserWarning: Update your `Dense` call to the Keras 2 API:Implement perceptual loss with pretrained VGG using kerasHow does Keras read input data?Building an LSTM net with an embedding layer in KerasGet increasing loss and poor performance on Variational AutoencoderHow to save and reuse all settings for a keras model?scipy.ndimage.zoom is taking long time even on small arraysEpoch's steps taking too long on GPU'Sequential' object has no attribute 'loss' - When I used GridSearchCV to tuning my Keras model
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
I want to merge keras embeddings with normal models into one sequential model as in the notebook in this repository
from keras.layers import *
from keras.models import *
models = []
for categoical_var in categorical_vars :
model = Sequential()
model.reset_states( )
no_of_unique_cat = df[categoical_var].nunique()
embedding_size = min(np.ceil((no_of_unique_cat)/2), 50 )
embedding_size = int(embedding_size)
model.add( Embedding( no_of_unique_cat+1, embedding_size, input_length = 1 ) )
model.add(Reshape(target_shape=(embedding_size,)))
models.append( model )
model_rest = Sequential()
model_rest.add(Dense( 64 , input_dim = 6 ))
model_rest.reset_states( )
models.append(model_rest)
full_model = Sequential()
full_model.add(Merge(models, mode='concat'))
full_model.add(Dense(512))
full_model.add(Activation('sigmoid'))
full_model.add(Dropout(0.2))
full_model.add(Dense(32))
full_model.add(Activation('sigmoid'))
full_model.add(Dropout(0.2))
full_model.add(Dense(1))
full_model.compile(loss='mean_squared_error', optimizer='Adam',metrics=['mse','mape'])
The problem is new versions of keras doesn't use 'Merge' any more, I tried to use Concatenate, but it does not work with sequential models
Any help? I looked in to this, but it is a different problem
tensorflow keras neural-network deep-learning keras-layer
add a comment |
I want to merge keras embeddings with normal models into one sequential model as in the notebook in this repository
from keras.layers import *
from keras.models import *
models = []
for categoical_var in categorical_vars :
model = Sequential()
model.reset_states( )
no_of_unique_cat = df[categoical_var].nunique()
embedding_size = min(np.ceil((no_of_unique_cat)/2), 50 )
embedding_size = int(embedding_size)
model.add( Embedding( no_of_unique_cat+1, embedding_size, input_length = 1 ) )
model.add(Reshape(target_shape=(embedding_size,)))
models.append( model )
model_rest = Sequential()
model_rest.add(Dense( 64 , input_dim = 6 ))
model_rest.reset_states( )
models.append(model_rest)
full_model = Sequential()
full_model.add(Merge(models, mode='concat'))
full_model.add(Dense(512))
full_model.add(Activation('sigmoid'))
full_model.add(Dropout(0.2))
full_model.add(Dense(32))
full_model.add(Activation('sigmoid'))
full_model.add(Dropout(0.2))
full_model.add(Dense(1))
full_model.compile(loss='mean_squared_error', optimizer='Adam',metrics=['mse','mape'])
The problem is new versions of keras doesn't use 'Merge' any more, I tried to use Concatenate, but it does not work with sequential models
Any help? I looked in to this, but it is a different problem
tensorflow keras neural-network deep-learning keras-layer
You should implement this using the Functional API, forget about the Sequential API.
– Matias Valdenegro
Mar 26 at 21:18
Keras still hasMerge
layers. Even if it does not, you can easily implement it through theLambda
layer
– pitfall
Mar 27 at 5:49
Can you please elaborate on this?
– owise
Mar 27 at 14:38
add a comment |
I want to merge keras embeddings with normal models into one sequential model as in the notebook in this repository
from keras.layers import *
from keras.models import *
models = []
for categoical_var in categorical_vars :
model = Sequential()
model.reset_states( )
no_of_unique_cat = df[categoical_var].nunique()
embedding_size = min(np.ceil((no_of_unique_cat)/2), 50 )
embedding_size = int(embedding_size)
model.add( Embedding( no_of_unique_cat+1, embedding_size, input_length = 1 ) )
model.add(Reshape(target_shape=(embedding_size,)))
models.append( model )
model_rest = Sequential()
model_rest.add(Dense( 64 , input_dim = 6 ))
model_rest.reset_states( )
models.append(model_rest)
full_model = Sequential()
full_model.add(Merge(models, mode='concat'))
full_model.add(Dense(512))
full_model.add(Activation('sigmoid'))
full_model.add(Dropout(0.2))
full_model.add(Dense(32))
full_model.add(Activation('sigmoid'))
full_model.add(Dropout(0.2))
full_model.add(Dense(1))
full_model.compile(loss='mean_squared_error', optimizer='Adam',metrics=['mse','mape'])
The problem is new versions of keras doesn't use 'Merge' any more, I tried to use Concatenate, but it does not work with sequential models
Any help? I looked in to this, but it is a different problem
tensorflow keras neural-network deep-learning keras-layer
I want to merge keras embeddings with normal models into one sequential model as in the notebook in this repository
from keras.layers import *
from keras.models import *
models = []
for categoical_var in categorical_vars :
model = Sequential()
model.reset_states( )
no_of_unique_cat = df[categoical_var].nunique()
embedding_size = min(np.ceil((no_of_unique_cat)/2), 50 )
embedding_size = int(embedding_size)
model.add( Embedding( no_of_unique_cat+1, embedding_size, input_length = 1 ) )
model.add(Reshape(target_shape=(embedding_size,)))
models.append( model )
model_rest = Sequential()
model_rest.add(Dense( 64 , input_dim = 6 ))
model_rest.reset_states( )
models.append(model_rest)
full_model = Sequential()
full_model.add(Merge(models, mode='concat'))
full_model.add(Dense(512))
full_model.add(Activation('sigmoid'))
full_model.add(Dropout(0.2))
full_model.add(Dense(32))
full_model.add(Activation('sigmoid'))
full_model.add(Dropout(0.2))
full_model.add(Dense(1))
full_model.compile(loss='mean_squared_error', optimizer='Adam',metrics=['mse','mape'])
The problem is new versions of keras doesn't use 'Merge' any more, I tried to use Concatenate, but it does not work with sequential models
Any help? I looked in to this, but it is a different problem
tensorflow keras neural-network deep-learning keras-layer
tensorflow keras neural-network deep-learning keras-layer
asked Mar 26 at 18:48
owise owise
4665 silver badges19 bronze badges
4665 silver badges19 bronze badges
You should implement this using the Functional API, forget about the Sequential API.
– Matias Valdenegro
Mar 26 at 21:18
Keras still hasMerge
layers. Even if it does not, you can easily implement it through theLambda
layer
– pitfall
Mar 27 at 5:49
Can you please elaborate on this?
– owise
Mar 27 at 14:38
add a comment |
You should implement this using the Functional API, forget about the Sequential API.
– Matias Valdenegro
Mar 26 at 21:18
Keras still hasMerge
layers. Even if it does not, you can easily implement it through theLambda
layer
– pitfall
Mar 27 at 5:49
Can you please elaborate on this?
– owise
Mar 27 at 14:38
You should implement this using the Functional API, forget about the Sequential API.
– Matias Valdenegro
Mar 26 at 21:18
You should implement this using the Functional API, forget about the Sequential API.
– Matias Valdenegro
Mar 26 at 21:18
Keras still has
Merge
layers. Even if it does not, you can easily implement it through the Lambda
layer– pitfall
Mar 27 at 5:49
Keras still has
Merge
layers. Even if it does not, you can easily implement it through the Lambda
layer– pitfall
Mar 27 at 5:49
Can you please elaborate on this?
– owise
Mar 27 at 14:38
Can you please elaborate on this?
– owise
Mar 27 at 14:38
add a comment |
0
active
oldest
votes
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55364306%2fmerge-keras-embeddings-with-normal-models-into-one-sequential-model%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
Is this question similar to what you get asked at work? Learn more about asking and sharing private information with your coworkers using Stack Overflow for Teams.
Is this question similar to what you get asked at work? Learn more about asking and sharing private information with your coworkers using Stack Overflow for Teams.
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55364306%2fmerge-keras-embeddings-with-normal-models-into-one-sequential-model%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
You should implement this using the Functional API, forget about the Sequential API.
– Matias Valdenegro
Mar 26 at 21:18
Keras still has
Merge
layers. Even if it does not, you can easily implement it through theLambda
layer– pitfall
Mar 27 at 5:49
Can you please elaborate on this?
– owise
Mar 27 at 14:38