Rank Distance Correlation (RDC)¶
import math
from pyxla import rdc
from pyxla.util import load_data
from pyxla.sampling import HilbertCurveSampler
from matplotlib import rc_file
rc_file('../../../../src/.matplotlibrc')
sphere_sample = {
"name": "Sphere",
"X": HilbertCurveSampler(sample_size=100, dim=1, l_bound=-5, u_bound=5, seed=42),
"F": lambda x: x**2,
"V": [lambda x: x**2 - 2, lambda x: 8 * math.sin(20 * x)]
}
load_data(sphere_sample)
corr, plot = rdc(sphere_sample)
plot.savefig('rdc-sphere.pdf', bbox_inches='tight')