Coarse Coding Features

Vectors & Geometry DS practice problem on Onlearn.

Difficulty: medium.

Topics: Understanding Coarse Coding Representation, Binary Feature Vectors, Overlapping Interval Coverage, Input Domain Discretization, Inductive Bias in Representation, High-dimensional Projection, Linear Algebra, Feature Engineering, Neural Coding, Signal Processing, Function Approximation, Receptive Field Dynamics, Vector Quantization, Sparse Distributed Representation, Basis Function Expansion, Spatial Encoding.

Implement a coarse coding feature extractor. Given a continuous input value x in the range [0, 10], define 5 overlapping intervals (receptive fields) of width 4.0. The i th interval starts at i and ends at i + 4. Return a binary vector where the j th element is 1 if x is within the j th interval, and 0 otherwise.