Skip to content
DeepForgeby svx
All problems
EasyGraph Algorithmsgraph-184

Readout Mean

Problem

Read out a graph-level vector as the arithmetic mean of all node feature vectors.

features is a list of equal-length vectors. Return the elementwise mean, or an empty list when there are no nodes.

Hint

Mean readout keeps the scale of features comparable across graph sizes.

Test cases

case 1
in: [[[2,4],[0,2]]]
expected: [1,3]
case 2
in: [[]]
expected: []
case 3
in: [[[1,2]]]
expected: [1,2]
case 4
in: [[[0,0],[2,4],[4,8]]]
expected: [2,4]
Starter codePython
def readout_mean(features):
    # Your code here
    pass

4 test cases · run your code against them in the editor