Skip to content
DeepForgeby svx
All problems

Coarse Coding Overlap Count

Problem

Compute the fraction of coarse-coding receptive fields that are strictly positive in a feature vector. An empty vector returns 0.0.

Hint

Overlapping receptive fields give generalization between nearby states.

Test cases

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

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