RBF Center Placement Strategies
Representation Learning, Advanced Theory & Miscellaneous DS practice problem on Onlearn.
Difficulty: medium.
Topics: RBF Center Placement Strategies, K-Means Initialization, Gaussian Kernel Width, Mercer's Theorem, Orthogonal Least Squares, Voronoi Tessellation, Kernel Methods, Unsupervised Learning, Optimization Theory, Function Approximation, Computational Geometry, Radial Basis Function Networks, Clustering Algorithms, Non-linear Dimensionality Reduction, Basis Function Expansion, Regularization Techniques.
Radial Basis Function (RBF) networks require choosing center locations in the input space around which basis functions are placed. The quality of these centers significantly affects approximation performance. Implement a function rbf center placement that takes a dataset X of shape (n samples, n features), a desired number of centers n centers, a placement strategy, and a random seed for reproducibility. Your function should support three center placement strategies: 1. 'random' : Randomly select n centers distinct data points from X as centers (use np.random.choice without replacement). 2. 'maxmin' : Greedy farthest first traversal. Start by selecting a random data point (using np.random.randint). Then iteratively select the data point whose minimum distance to all previously selected centers is the largest. This spreads centers across the input space. 3. 'kmeans' : Run k means clustering to convergence (or up to 100 iterations). Initialize cluster centers by randomly selecting n centers data points. Assign each sample to its nearest center, recompute centers as cluster means, and repeat until convergence (centers do not change within tolerance 1e 8). After placing centers, compute a shared RBF width parameter using the heuristic: If there is only 1 center, set width to 1.0 Otherwise, width = d max / sqrt(2 n centers), where d max is the maximum Euclidean distance between any pair of centers Return a dictionary with keys 'centers' (numpy array rounded to 4 decimal places) and 'width' (float rounded to 4 decimal places).