Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TCNN #5

Open
Kiris-tingna opened this issue Nov 4, 2018 · 1 comment
Open

TCNN #5

Kiris-tingna opened this issue Nov 4, 2018 · 1 comment

Comments

@Kiris-tingna
Copy link

实际上 Text-cnn在训练的时候 卷积层可以使用 多个 不同尺寸的卷积核 最后拼接到一个中间层上 然后输入多个 dense 可以尝试如下操作

    # 第一卷积层
    conv_4_layer = Convolution1D(200, 4, activation='tanh')(embedding)
    # 第一池化层
    max_pool_4_layer = MaxPooling1D(4)(conv_4_layer)
    # 第一扁平层
    flat_4_layer = Flatten()(max_pool_4_layer)

    # 第二卷积层
    conv_5_layer = Convolution1D(200, 5, activation='tanh')(embedding)
    # 第二池化层
    max_pool_5_layer = MaxPooling1D(5)(conv_5_layer)
    # 第二扁平层
    flat_5_layer = Flatten()(max_pool_5_layer)

    # 第三卷积层
    conv_6_layer = Convolution1D(200, 6, activation='tanh')(embedding)
    # 第三池化层
    max_pool_6_layer = MaxPooling1D(6)(conv_6_layer)
    # 第三扁平层
    flat_6_layer = Flatten()(max_pool_6_layer)

    # 组合
    CNNs = concatenate([flat_4_layer, flat_5_layer, flat_6_layer])
@cjymz886
Copy link
Owner

cjymz886 commented Mar 8, 2019

嗯,是的,用不同的卷积核,效果更好些。我有点偷懒,没有更新,后续有空更新,谢谢你的建议。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants