コード例 #1
0
vocab_size = len(vocab)

graph_in = Input((vocab_size, 100))
convs = [ ] 
for fsz in range (3, 6): 
    x = Conv1D(64, fsz, padding='same', activation="relu")(graph_in)
    x = MaxPooling1D()(x) 
    x = Flatten()(x) 
    convs.append(x)
out = Concatenate(axis=-1)(convs) 
graph = Model(graph_in, out)


# In[27]:

embedding_layer.input_length = seq_len


# In[28]:

model = Sequential([
    embedding_layer,
    SpatialDropout1D(0.2),
    Dropout (0.2),
    graph,
    Dropout (0.5),
    Dense (100, activation="relu"),
    Dropout (0.7),
    Dense (1, activation='sigmoid')
    ])