Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,8 @@ def getShift(edge, length):
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...

prediction = np.column_stack(prediction)
n_tasks = np.shape(prediction)[1]

# initialize write once
Expand Down