-
Notifications
You must be signed in to change notification settings - Fork 91
Support for a concatenate layer #211
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
Comments
Looks like the implementation would be straightforward. What are some uses of this? |
In my context I have two types of input (DNA samples and environmental factors). I would like to investigate different types of layers (CNN for DNA and Dense for environmental factors). |
As discussed here is a potential example: !Define the Convolutional network branch for the feature 1
net_feat1 = network([ &
input(ninput1), &
reshape([1,28,28]), &
conv1d(filters=8, kernel_size=3, activation=relu()), &
maxpool1d(pool_size=2), &
dense(64, activation=relu()) &
])
!Define the Dense network branch for the feature 2
net_feat2 = network([ &
input(ninput2), &
dense(32, activation=relu()) &
])
!Combine the outputs of the two network branches and define the final dense layers for predi
ction
net_combi = network([&
input = concatenate(net_feat1%predict(), net_feat2%predict()), &
dense(64, activation=relu(), &
dense(1, activation=linear()) &
])
!Train the model including its two branches
epochs: do n = 1, num_epochs
call net_combi % train( &
input = [input%features1, input%features2], & !could be a single array
output_data, &
batch_size=32, &
epochs=1 &
)
Prior art: Keras concatanate |
Thanks, Jeremie, that's clear! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
State-of-the-art:
The text was updated successfully, but these errors were encountered: