All problems
Neuron Activation Frequency
Problem
Compute how often a neuron fires: the fraction of activations strictly greater than 0.
The signature is neuron_activation_frequency(activations).
Hint
Activation frequency is a cheap proxy for how much a neuron contributes.
Test cases
case 1
in: [[1,0,-1,2]]
expected: 0.5
case 2
in: [[0,0]]
expected: 0
case 3
in: [[1,1,1]]
expected: 1
case 4
in: [[-1,-2,3,0,4]]
expected: 0.4
Starter codePython
def neuron_activation_frequency(activations):
# Your code here
pass4 test cases · run your code against them in the editor