Skip to content

added check for multitask models - #10

Open
sroener wants to merge 1 commit into
kircherlab:masterfrom
sroener:master
Open

added check for multitask models#10
sroener wants to merge 1 commit into
kircherlab:masterfrom
sroener:master

Conversation

@sroener

@sroener sroener commented Mar 24, 2021

Copy link
Copy Markdown

Added a small check for DL models with multiple separate outputs. Checks if output is a list (of arrays) instead of an array.

@visze visze left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please check this again.

Also if working we should include this in the variantsFromSequence wrapper!

satMutSequence.getSequence()))
# predict
prediction = model.predict(np.array(X))
if isinstance(prediction, list):

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you give an example whats the differenc ebetween the output? maybe a test? normally the output of the predict function is a numpy array not a list (see api https://www.tensorflow.org/api_docs/python/tf/keras/Model#predict). So this will be always false?

maybe the shape has 3 dimensions now?

E.g. you predict 2 inputs with 4 tasks the youtput will be

prediction = np.array([[0,1,0.5,1],[0,1,0,0.5]])

Also I was wondering if the

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had a look at my code, and I think I know why I the output is a list.

For training multiple separate tasks, I train shared convolutional layers and then train dense layers for each task separately. The way I pass the output layers to Model() is in a list that is dynamically generated based on the tasks.

model = Model(inputs=inputs, outputs=output_list)

I assume that predict stores the resulting arrays in a list of the same length as the list passed to Model()

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is it also possible to pass an np.array? Can you check this? Maybe then the output might be different and the is instance list will not work...

@visze

visze commented Mar 30, 2022

Copy link
Copy Markdown
Collaborator

anything here?

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

Successfully merging this pull request may close these issues.

2 participants