Mapping entity embeddings back to the original categorical valuesPython keras how to transform a dense layer into a convolutional layerTraining embedding layers in neural networks with missing dataSignificance of auxiliary output in Multi-input and multi-output model using deep networkUsing gensim doc2vec with Keras Conv1d. ValueErrorIssues with embeddings for categorical variables in KerasTranspose tensorboard embedding projectionsloading weights keras LSTM not workingKeras layer.weights and layer.get_weights() give different valuesHow to print the weights of Keras embedding?

Should I cross-validate metrics that were not optimised?

Does a reference have a storage location?

Performance of loop vs expansion

Has there ever been a cold war other than between the U.S. and the U.S.S.R.?

How long had Bertha Mason been in the attic at the point of the events in Jane Eyre

What is the right way to query an I2C device from an interrupt service routine?

Blood-based alcohol for vampires?

Cartoon where characters would fight with capsule gauntlets that shoot out small creatures

Algebraical "thing" having two inverses per element?

"Best practices" for formulating MIPs

How come having a Deathly Hallow is not a big deal?

HTTPmodule or similar for SharePoint online

What verb goes with "coup"?

Did Snape really give Umbridge a fake Veritaserum potion that Harry later pretended to drink?

Which high-degree derivatives play an essential role?

What is meaning of 4 letter acronyms in Roman names like Titus Flavius T. f. T. n. Sabinus?

If a creature is blocking and it has vigilance does it still tap?

What is -(-2,3,4)?

How can I know (without going to the station) if RATP is offering the Anti Pollution tickets?

Language Selector

Why is quantum gravity non-renormalizable?

Bootstrap paradox with a time machine in iron

When you're given a degree sequence, what is the method to draw a graph which has that degree sequence?

What could a Medieval society do with excess animal blood?



Mapping entity embeddings back to the original categorical values


Python keras how to transform a dense layer into a convolutional layerTraining embedding layers in neural networks with missing dataSignificance of auxiliary output in Multi-input and multi-output model using deep networkUsing gensim doc2vec with Keras Conv1d. ValueErrorIssues with embeddings for categorical variables in KerasTranspose tensorboard embedding projectionsloading weights keras LSTM not workingKeras layer.weights and layer.get_weights() give different valuesHow to print the weights of Keras embedding?






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








0















I am using Keras embedding layers to create entity embeddings made popular on the Kaggle Rossmann Store Sales 3rd place entry. However, I am unsure about how to map back the embeddings back to the actual categorical values. Let's take a look at a very basic example:



In the code below, I create a dataset with two numeric and one categorical feature.



import numpy as np
import pandas as pd
from sklearn.datasets import make_classification
from keras.models import Model
from keras.layers import Input, Dense, Concatenate, Reshape, Dropout
from keras.layers.embeddings import Embedding

# create some fake data
data, labels = make_classification(n_classes=2, class_sep=2, n_informative=2,
n_redundant=0, flip_y=0, n_features=2,
n_clusters_per_class=1, n_samples=100,
random_state=10)

cat_col = np.random.choice(a=[0,1,2,3,4], size=100)

data = pd.DataFrame(data)
data[2] = cat_col
embed_cols = [2]

# converting data to list of lists, as the network expects to
# see the data in this format
def preproc(df):
data_list = []

# convert cols to list of lists
for c in embed_cols:
vals = np.unique(df[c])
val_map =
for i in range(len(vals)):
val_map[vals[i]] = vals[i]
data_list.append(df[c].map(val_map).values)

# the rest of the columns
other_cols = [c for c in df.columns if (not c in embed_cols)]
data_list.append(df[other_cols].values)
return data_list

data = preproc(data)


There are 5 unique values for the categorical column:



print("Unique Values: ", np.unique(data[0]))
Out[01]: array([0, 1, 2, 3, 4])


which then get fed into a Keras model with an embedding layer:



inputs = []
embeddings = []

input_cat_col = Input(shape=(1,))
embedding = Embedding(5, 3, input_length=1, name='cat_col')(input_cat_col)
embedding = Reshape(target_shape=(3,))(embedding)
inputs.append(input_cat_col)
embeddings.append(embedding)


# add the remaining two numeric columns from the 'data array' to the network
input_numeric = Input(shape=(2,))
embedding_numeric = Dense(8)(input_numeric)
inputs.append(input_numeric)
embeddings.append(embedding_numeric)

x = Concatenate()(embeddings)
output = Dense(1, activation='sigmoid')(x)

model = Model(inputs, output)
model.compile(loss='binary_crossentropy', optimizer='adam')

history = model.fit(data, labels,
epochs=10,
batch_size=32,
verbose=1,
validation_split=0.2)


I can get the actual embeddings by getting the weight for the embedding layer:



embeddings = model.get_layer('cat_col').get_weights()[0]
print("Unique Values: ", np.unique(data[0]))
print("3 Dimensional Embedding: n", embeddings)

Unique Values: [0 1 2 3 4]
3 Dimensional Embedding:
[[ 0.02749949 0.04238378 0.0080842 ]
[-0.00083209 0.01848664 0.0130044 ]
[-0.02784528 -0.00713446 -0.01167112]
[ 0.00265562 0.03886909 0.0138318 ]
[-0.01526615 0.01284053 -0.0403452 ]]


However, I am unsure how to map these back. Is it safe to assume that the weights are ordered? For example, 0=[ 0.02749949 0.04238378 0.0080842 ]?










share|improve this question




























    0















    I am using Keras embedding layers to create entity embeddings made popular on the Kaggle Rossmann Store Sales 3rd place entry. However, I am unsure about how to map back the embeddings back to the actual categorical values. Let's take a look at a very basic example:



    In the code below, I create a dataset with two numeric and one categorical feature.



    import numpy as np
    import pandas as pd
    from sklearn.datasets import make_classification
    from keras.models import Model
    from keras.layers import Input, Dense, Concatenate, Reshape, Dropout
    from keras.layers.embeddings import Embedding

    # create some fake data
    data, labels = make_classification(n_classes=2, class_sep=2, n_informative=2,
    n_redundant=0, flip_y=0, n_features=2,
    n_clusters_per_class=1, n_samples=100,
    random_state=10)

    cat_col = np.random.choice(a=[0,1,2,3,4], size=100)

    data = pd.DataFrame(data)
    data[2] = cat_col
    embed_cols = [2]

    # converting data to list of lists, as the network expects to
    # see the data in this format
    def preproc(df):
    data_list = []

    # convert cols to list of lists
    for c in embed_cols:
    vals = np.unique(df[c])
    val_map =
    for i in range(len(vals)):
    val_map[vals[i]] = vals[i]
    data_list.append(df[c].map(val_map).values)

    # the rest of the columns
    other_cols = [c for c in df.columns if (not c in embed_cols)]
    data_list.append(df[other_cols].values)
    return data_list

    data = preproc(data)


    There are 5 unique values for the categorical column:



    print("Unique Values: ", np.unique(data[0]))
    Out[01]: array([0, 1, 2, 3, 4])


    which then get fed into a Keras model with an embedding layer:



    inputs = []
    embeddings = []

    input_cat_col = Input(shape=(1,))
    embedding = Embedding(5, 3, input_length=1, name='cat_col')(input_cat_col)
    embedding = Reshape(target_shape=(3,))(embedding)
    inputs.append(input_cat_col)
    embeddings.append(embedding)


    # add the remaining two numeric columns from the 'data array' to the network
    input_numeric = Input(shape=(2,))
    embedding_numeric = Dense(8)(input_numeric)
    inputs.append(input_numeric)
    embeddings.append(embedding_numeric)

    x = Concatenate()(embeddings)
    output = Dense(1, activation='sigmoid')(x)

    model = Model(inputs, output)
    model.compile(loss='binary_crossentropy', optimizer='adam')

    history = model.fit(data, labels,
    epochs=10,
    batch_size=32,
    verbose=1,
    validation_split=0.2)


    I can get the actual embeddings by getting the weight for the embedding layer:



    embeddings = model.get_layer('cat_col').get_weights()[0]
    print("Unique Values: ", np.unique(data[0]))
    print("3 Dimensional Embedding: n", embeddings)

    Unique Values: [0 1 2 3 4]
    3 Dimensional Embedding:
    [[ 0.02749949 0.04238378 0.0080842 ]
    [-0.00083209 0.01848664 0.0130044 ]
    [-0.02784528 -0.00713446 -0.01167112]
    [ 0.00265562 0.03886909 0.0138318 ]
    [-0.01526615 0.01284053 -0.0403452 ]]


    However, I am unsure how to map these back. Is it safe to assume that the weights are ordered? For example, 0=[ 0.02749949 0.04238378 0.0080842 ]?










    share|improve this question
























      0












      0








      0








      I am using Keras embedding layers to create entity embeddings made popular on the Kaggle Rossmann Store Sales 3rd place entry. However, I am unsure about how to map back the embeddings back to the actual categorical values. Let's take a look at a very basic example:



      In the code below, I create a dataset with two numeric and one categorical feature.



      import numpy as np
      import pandas as pd
      from sklearn.datasets import make_classification
      from keras.models import Model
      from keras.layers import Input, Dense, Concatenate, Reshape, Dropout
      from keras.layers.embeddings import Embedding

      # create some fake data
      data, labels = make_classification(n_classes=2, class_sep=2, n_informative=2,
      n_redundant=0, flip_y=0, n_features=2,
      n_clusters_per_class=1, n_samples=100,
      random_state=10)

      cat_col = np.random.choice(a=[0,1,2,3,4], size=100)

      data = pd.DataFrame(data)
      data[2] = cat_col
      embed_cols = [2]

      # converting data to list of lists, as the network expects to
      # see the data in this format
      def preproc(df):
      data_list = []

      # convert cols to list of lists
      for c in embed_cols:
      vals = np.unique(df[c])
      val_map =
      for i in range(len(vals)):
      val_map[vals[i]] = vals[i]
      data_list.append(df[c].map(val_map).values)

      # the rest of the columns
      other_cols = [c for c in df.columns if (not c in embed_cols)]
      data_list.append(df[other_cols].values)
      return data_list

      data = preproc(data)


      There are 5 unique values for the categorical column:



      print("Unique Values: ", np.unique(data[0]))
      Out[01]: array([0, 1, 2, 3, 4])


      which then get fed into a Keras model with an embedding layer:



      inputs = []
      embeddings = []

      input_cat_col = Input(shape=(1,))
      embedding = Embedding(5, 3, input_length=1, name='cat_col')(input_cat_col)
      embedding = Reshape(target_shape=(3,))(embedding)
      inputs.append(input_cat_col)
      embeddings.append(embedding)


      # add the remaining two numeric columns from the 'data array' to the network
      input_numeric = Input(shape=(2,))
      embedding_numeric = Dense(8)(input_numeric)
      inputs.append(input_numeric)
      embeddings.append(embedding_numeric)

      x = Concatenate()(embeddings)
      output = Dense(1, activation='sigmoid')(x)

      model = Model(inputs, output)
      model.compile(loss='binary_crossentropy', optimizer='adam')

      history = model.fit(data, labels,
      epochs=10,
      batch_size=32,
      verbose=1,
      validation_split=0.2)


      I can get the actual embeddings by getting the weight for the embedding layer:



      embeddings = model.get_layer('cat_col').get_weights()[0]
      print("Unique Values: ", np.unique(data[0]))
      print("3 Dimensional Embedding: n", embeddings)

      Unique Values: [0 1 2 3 4]
      3 Dimensional Embedding:
      [[ 0.02749949 0.04238378 0.0080842 ]
      [-0.00083209 0.01848664 0.0130044 ]
      [-0.02784528 -0.00713446 -0.01167112]
      [ 0.00265562 0.03886909 0.0138318 ]
      [-0.01526615 0.01284053 -0.0403452 ]]


      However, I am unsure how to map these back. Is it safe to assume that the weights are ordered? For example, 0=[ 0.02749949 0.04238378 0.0080842 ]?










      share|improve this question














      I am using Keras embedding layers to create entity embeddings made popular on the Kaggle Rossmann Store Sales 3rd place entry. However, I am unsure about how to map back the embeddings back to the actual categorical values. Let's take a look at a very basic example:



      In the code below, I create a dataset with two numeric and one categorical feature.



      import numpy as np
      import pandas as pd
      from sklearn.datasets import make_classification
      from keras.models import Model
      from keras.layers import Input, Dense, Concatenate, Reshape, Dropout
      from keras.layers.embeddings import Embedding

      # create some fake data
      data, labels = make_classification(n_classes=2, class_sep=2, n_informative=2,
      n_redundant=0, flip_y=0, n_features=2,
      n_clusters_per_class=1, n_samples=100,
      random_state=10)

      cat_col = np.random.choice(a=[0,1,2,3,4], size=100)

      data = pd.DataFrame(data)
      data[2] = cat_col
      embed_cols = [2]

      # converting data to list of lists, as the network expects to
      # see the data in this format
      def preproc(df):
      data_list = []

      # convert cols to list of lists
      for c in embed_cols:
      vals = np.unique(df[c])
      val_map =
      for i in range(len(vals)):
      val_map[vals[i]] = vals[i]
      data_list.append(df[c].map(val_map).values)

      # the rest of the columns
      other_cols = [c for c in df.columns if (not c in embed_cols)]
      data_list.append(df[other_cols].values)
      return data_list

      data = preproc(data)


      There are 5 unique values for the categorical column:



      print("Unique Values: ", np.unique(data[0]))
      Out[01]: array([0, 1, 2, 3, 4])


      which then get fed into a Keras model with an embedding layer:



      inputs = []
      embeddings = []

      input_cat_col = Input(shape=(1,))
      embedding = Embedding(5, 3, input_length=1, name='cat_col')(input_cat_col)
      embedding = Reshape(target_shape=(3,))(embedding)
      inputs.append(input_cat_col)
      embeddings.append(embedding)


      # add the remaining two numeric columns from the 'data array' to the network
      input_numeric = Input(shape=(2,))
      embedding_numeric = Dense(8)(input_numeric)
      inputs.append(input_numeric)
      embeddings.append(embedding_numeric)

      x = Concatenate()(embeddings)
      output = Dense(1, activation='sigmoid')(x)

      model = Model(inputs, output)
      model.compile(loss='binary_crossentropy', optimizer='adam')

      history = model.fit(data, labels,
      epochs=10,
      batch_size=32,
      verbose=1,
      validation_split=0.2)


      I can get the actual embeddings by getting the weight for the embedding layer:



      embeddings = model.get_layer('cat_col').get_weights()[0]
      print("Unique Values: ", np.unique(data[0]))
      print("3 Dimensional Embedding: n", embeddings)

      Unique Values: [0 1 2 3 4]
      3 Dimensional Embedding:
      [[ 0.02749949 0.04238378 0.0080842 ]
      [-0.00083209 0.01848664 0.0130044 ]
      [-0.02784528 -0.00713446 -0.01167112]
      [ 0.00265562 0.03886909 0.0138318 ]
      [-0.01526615 0.01284053 -0.0403452 ]]


      However, I am unsure how to map these back. Is it safe to assume that the weights are ordered? For example, 0=[ 0.02749949 0.04238378 0.0080842 ]?







      python machine-learning keras deep-learning nlp






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Mar 25 at 17:25









      JasonJason

      1,1085 gold badges16 silver badges29 bronze badges




      1,1085 gold badges16 silver badges29 bronze badges






















          1 Answer
          1






          active

          oldest

          votes


















          1














          Yes, the weights of the embedding layer correspond to the word indexed by an integer in the order i.e weight array 0 in the embedding layer correspond to the word with index 0 and so on. You can think of embedding layer as a lookup table where nth row of the table correspond to word vector of the nth word (but embedding layers is trainable layer not just a static lookup table)



          inputs = Input(shape=(1,))
          embedding = Embedding(5, 3, input_length=1, name='cat_col')(inputs)
          model = Model(inputs, embedding)

          x = np.array([0,1,2,3,4]).reshape(5,1)
          labels = np.zeros((5,1,3))

          print (model.predict(x))
          print (model.get_layer('cat_col').get_weights()[0])

          assert np.array_equal(model.predict(x).reshape(-1), model.get_layer('cat_col').get_weights()[0].reshape(-1))


          model.predict(x):



          [[[-0.01862894, 0.0021644 , 0.04706952]],
          [[-0.03891206, 0.01743075, -0.03666048]],
          [[-0.01799501, 0.01427511, -0.00056203]],
          [[ 0.03703432, -0.01952349, 0.04562894]],
          [[-0.02806044, -0.04623617, -0.01702447]]]


          model.get_layer('cat_col').get_weights()[0]



          [[-0.01862894, 0.0021644 , 0.04706952],
          [-0.03891206, 0.01743075, -0.03666048],
          [-0.01799501, 0.01427511, -0.00056203],
          [ 0.03703432, -0.01952349, 0.04562894],
          [-0.02806044, -0.04623617, -0.01702447]]





          share|improve this answer

























          • thanks! I like the clear example as well

            – Jason
            Mar 25 at 18:01










          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
          );



          );













          draft saved

          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55343375%2fmapping-entity-embeddings-back-to-the-original-categorical-values%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          1














          Yes, the weights of the embedding layer correspond to the word indexed by an integer in the order i.e weight array 0 in the embedding layer correspond to the word with index 0 and so on. You can think of embedding layer as a lookup table where nth row of the table correspond to word vector of the nth word (but embedding layers is trainable layer not just a static lookup table)



          inputs = Input(shape=(1,))
          embedding = Embedding(5, 3, input_length=1, name='cat_col')(inputs)
          model = Model(inputs, embedding)

          x = np.array([0,1,2,3,4]).reshape(5,1)
          labels = np.zeros((5,1,3))

          print (model.predict(x))
          print (model.get_layer('cat_col').get_weights()[0])

          assert np.array_equal(model.predict(x).reshape(-1), model.get_layer('cat_col').get_weights()[0].reshape(-1))


          model.predict(x):



          [[[-0.01862894, 0.0021644 , 0.04706952]],
          [[-0.03891206, 0.01743075, -0.03666048]],
          [[-0.01799501, 0.01427511, -0.00056203]],
          [[ 0.03703432, -0.01952349, 0.04562894]],
          [[-0.02806044, -0.04623617, -0.01702447]]]


          model.get_layer('cat_col').get_weights()[0]



          [[-0.01862894, 0.0021644 , 0.04706952],
          [-0.03891206, 0.01743075, -0.03666048],
          [-0.01799501, 0.01427511, -0.00056203],
          [ 0.03703432, -0.01952349, 0.04562894],
          [-0.02806044, -0.04623617, -0.01702447]]





          share|improve this answer

























          • thanks! I like the clear example as well

            – Jason
            Mar 25 at 18:01















          1














          Yes, the weights of the embedding layer correspond to the word indexed by an integer in the order i.e weight array 0 in the embedding layer correspond to the word with index 0 and so on. You can think of embedding layer as a lookup table where nth row of the table correspond to word vector of the nth word (but embedding layers is trainable layer not just a static lookup table)



          inputs = Input(shape=(1,))
          embedding = Embedding(5, 3, input_length=1, name='cat_col')(inputs)
          model = Model(inputs, embedding)

          x = np.array([0,1,2,3,4]).reshape(5,1)
          labels = np.zeros((5,1,3))

          print (model.predict(x))
          print (model.get_layer('cat_col').get_weights()[0])

          assert np.array_equal(model.predict(x).reshape(-1), model.get_layer('cat_col').get_weights()[0].reshape(-1))


          model.predict(x):



          [[[-0.01862894, 0.0021644 , 0.04706952]],
          [[-0.03891206, 0.01743075, -0.03666048]],
          [[-0.01799501, 0.01427511, -0.00056203]],
          [[ 0.03703432, -0.01952349, 0.04562894]],
          [[-0.02806044, -0.04623617, -0.01702447]]]


          model.get_layer('cat_col').get_weights()[0]



          [[-0.01862894, 0.0021644 , 0.04706952],
          [-0.03891206, 0.01743075, -0.03666048],
          [-0.01799501, 0.01427511, -0.00056203],
          [ 0.03703432, -0.01952349, 0.04562894],
          [-0.02806044, -0.04623617, -0.01702447]]





          share|improve this answer

























          • thanks! I like the clear example as well

            – Jason
            Mar 25 at 18:01













          1












          1








          1







          Yes, the weights of the embedding layer correspond to the word indexed by an integer in the order i.e weight array 0 in the embedding layer correspond to the word with index 0 and so on. You can think of embedding layer as a lookup table where nth row of the table correspond to word vector of the nth word (but embedding layers is trainable layer not just a static lookup table)



          inputs = Input(shape=(1,))
          embedding = Embedding(5, 3, input_length=1, name='cat_col')(inputs)
          model = Model(inputs, embedding)

          x = np.array([0,1,2,3,4]).reshape(5,1)
          labels = np.zeros((5,1,3))

          print (model.predict(x))
          print (model.get_layer('cat_col').get_weights()[0])

          assert np.array_equal(model.predict(x).reshape(-1), model.get_layer('cat_col').get_weights()[0].reshape(-1))


          model.predict(x):



          [[[-0.01862894, 0.0021644 , 0.04706952]],
          [[-0.03891206, 0.01743075, -0.03666048]],
          [[-0.01799501, 0.01427511, -0.00056203]],
          [[ 0.03703432, -0.01952349, 0.04562894]],
          [[-0.02806044, -0.04623617, -0.01702447]]]


          model.get_layer('cat_col').get_weights()[0]



          [[-0.01862894, 0.0021644 , 0.04706952],
          [-0.03891206, 0.01743075, -0.03666048],
          [-0.01799501, 0.01427511, -0.00056203],
          [ 0.03703432, -0.01952349, 0.04562894],
          [-0.02806044, -0.04623617, -0.01702447]]





          share|improve this answer















          Yes, the weights of the embedding layer correspond to the word indexed by an integer in the order i.e weight array 0 in the embedding layer correspond to the word with index 0 and so on. You can think of embedding layer as a lookup table where nth row of the table correspond to word vector of the nth word (but embedding layers is trainable layer not just a static lookup table)



          inputs = Input(shape=(1,))
          embedding = Embedding(5, 3, input_length=1, name='cat_col')(inputs)
          model = Model(inputs, embedding)

          x = np.array([0,1,2,3,4]).reshape(5,1)
          labels = np.zeros((5,1,3))

          print (model.predict(x))
          print (model.get_layer('cat_col').get_weights()[0])

          assert np.array_equal(model.predict(x).reshape(-1), model.get_layer('cat_col').get_weights()[0].reshape(-1))


          model.predict(x):



          [[[-0.01862894, 0.0021644 , 0.04706952]],
          [[-0.03891206, 0.01743075, -0.03666048]],
          [[-0.01799501, 0.01427511, -0.00056203]],
          [[ 0.03703432, -0.01952349, 0.04562894]],
          [[-0.02806044, -0.04623617, -0.01702447]]]


          model.get_layer('cat_col').get_weights()[0]



          [[-0.01862894, 0.0021644 , 0.04706952],
          [-0.03891206, 0.01743075, -0.03666048],
          [-0.01799501, 0.01427511, -0.00056203],
          [ 0.03703432, -0.01952349, 0.04562894],
          [-0.02806044, -0.04623617, -0.01702447]]






          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Mar 25 at 18:08

























          answered Mar 25 at 17:41









          mujjigamujjiga

          4,3102 gold badges14 silver badges22 bronze badges




          4,3102 gold badges14 silver badges22 bronze badges












          • thanks! I like the clear example as well

            – Jason
            Mar 25 at 18:01

















          • thanks! I like the clear example as well

            – Jason
            Mar 25 at 18:01
















          thanks! I like the clear example as well

          – Jason
          Mar 25 at 18:01





          thanks! I like the clear example as well

          – Jason
          Mar 25 at 18:01








          Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.







          Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.



















          draft saved

          draft discarded
















































          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.




          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55343375%2fmapping-entity-embeddings-back-to-the-original-categorical-values%23new-answer', 'question_page');

          );

          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







          Popular posts from this blog

          SQL error code 1064 with creating Laravel foreign keysForeign key constraints: When to use ON UPDATE and ON DELETEDropping column with foreign key Laravel error: General error: 1025 Error on renameLaravel SQL Can't create tableLaravel Migration foreign key errorLaravel php artisan migrate:refresh giving a syntax errorSQLSTATE[42S01]: Base table or view already exists or Base table or view already exists: 1050 Tableerror in migrating laravel file to xampp serverSyntax error or access violation: 1064:syntax to use near 'unsigned not null, modelName varchar(191) not null, title varchar(191) not nLaravel cannot create new table field in mysqlLaravel 5.7:Last migration creates table but is not registered in the migration table

          용인 삼성생명 블루밍스 목차 통계 역대 감독 선수단 응원단 경기장 같이 보기 외부 링크 둘러보기 메뉴samsungblueminx.comeh선수 명단용인 삼성생명 블루밍스용인 삼성생명 블루밍스ehsamsungblueminx.comeheheheh

          155 수학 과학 기타 둘러보기 메뉴eh추가해eh문서를 완성해