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

How to create a model with multipe output layers? #450

Open
guangweizhao opened this issue Apr 12, 2024 · 0 comments
Open

How to create a model with multipe output layers? #450

guangweizhao opened this issue Apr 12, 2024 · 0 comments

Comments

@guangweizhao
Copy link

Hello,

I have 3 different groups of Y labels that share the same X and A for the same dataset, and I wish to do node-level training for all of them together. I tried to create a GNN model with multiple output layers as follows, but this will report errors when I start to train. Is there any better solution to build a model with multiple output layers? Thanks for any suggestions!

X_1 = GCSConv(32, activation='relu')([X_in, A_in])
X_2 = GCSConv(32, activation='relu')([X_1, A_in])
X_3 = GCSConv(32, activation='relu')([X_2, A_in])

output0 = Dense(data.dim0, activation='softmax')(X_3)
output1 = Dense(data.dim1, activation='softmax')(X_3)
output2 = Dense(data.dim2, activation='sigmoid')(X_3)

model.compile(optimizer=opt, loss={'output0': 'categorical_crossentropy', 'output1': 'categorical_crossentropy', 'output2': 'categorical_crossentropy'}, metrics={'output0': 'accuracy', 'output1': 'accuracy', 'output2': 'accuracy'})
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

1 participant