Keras- Embedding layer

后端 未结 3 1055
梦如初夏
梦如初夏 2021-02-06 05:06

What does input_dim, output_dim and input_length mean in:

Embedding(input_dim, output_dim, input_length)

3条回答
  •  温柔的废话
    2021-02-06 05:44

    By taking a look at the keras documentation for the layer you see this:

    Embedding(1000, 64, input_length=10)
    #the model will take as input an integer matrix of size (batch, input_length).
    #the largest integer (i.e. word index) in the input should be no larger than 999 (vocabulary size).
    #now model.output_shape == (None, 10, 64), where None is the batch dimension.
    

    By using the values you gave in your post you can try to grasp the idea of this method and can come up with this settings:

    • input_dim=38
    • input_length=75

    while output_dim is a model parameter, which you still have to determine (and maybe have to try different values to find the optimal one).

    Edit: You can find additional information about embedding layers here.

提交回复
热议问题