import numpy as np
import matplotlib.pyplot as plt
try:
import probml_utils as pml
except ModuleNotFoundError:
%pip install -qq git+https://github.com/probml/probml-utils.git
import probml_utils as pml
ds = [1.0, 3.0, 5.0, 7.0, 10.0]
s = np.linspace(0, 1, 100)
for d in ds:
y = s ** (1 / d)
plt.plot(s, y, "b-")
plt.text(0.3, 0.3 ** (1 / d), "d=%d" % d)
plt.xlabel("Fraction of data in neighborhood")
plt.ylabel("Edge length of cube")
pml.savefig("curseDimensionality.pdf")
plt.show()