Skip to content

Commit

Permalink
Minor name fix
Browse files Browse the repository at this point in the history
  • Loading branch information
GardevoirX committed Aug 7, 2024
1 parent 1aa0155 commit 65c9636
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions examples/neighbors/sparse-kde.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ def rij(period: np.ndarray, xi: np.ndarray, xj: np.ndarray) -> np.ndarray:
print(f"RMSE = {RMSE:.2e}")

# %%
# We can compare the result with the KDE class from scikit-learn. (Usually takes
# We can compare the result with the KDE class from scipy. (Usually takes
# several minutes to run)

# %%
Expand All @@ -195,7 +195,7 @@ def rij(period: np.ndarray, xi: np.ndarray, xj: np.ndarray) -> np.ndarray:
kde = gaussian_kde(samples.T)
sklearn_probs = kde(data).T
end = time.time()
print(f"Time sklearn: {end - start} s")
print(f"Time scipy: {end - start} s")
RMSE_kde = np.sum(
(probs - sklearn_probs) ** 2 * (x[0][1] - x[0][0]) * (y[1][0] - y[0][0])
)
Expand All @@ -205,4 +205,4 @@ def rij(period: np.ndarray, xi: np.ndarray, xj: np.ndarray) -> np.ndarray:
# We can see that the fitted model can perfectly capture the original one. Eventhough we
# have not specified the number of the Gaussians, it can still perform well. This
# allows us to fit distributions of the data automatically at a comparable quality
# within a much shorter time than scikit-matter
# within a much shorter time than scipy.

0 comments on commit 65c9636

Please sign in to comment.