From 75ccc9e29a0d78d6c3d4373e22844a1825b05ddd Mon Sep 17 00:00:00 2001 From: Ilan Steemers Date: Sun, 6 Sep 2020 11:26:00 +0200 Subject: [PATCH] Removes testing code --- .env | 0 .gitignore | 2 ++ dq/tasks.py | 29 ----------------------------- 3 files changed, 2 insertions(+), 29 deletions(-) delete mode 100644 .env delete mode 100644 dq/tasks.py diff --git a/.env b/.env deleted file mode 100644 index e69de29..0000000 diff --git a/.gitignore b/.gitignore index 312a660..d540666 100644 --- a/.gitignore +++ b/.gitignore @@ -64,7 +64,9 @@ db.sqlite3 *.ipynb *.rdb .venv +.env .idea djq node_modules /c.cache/ +/dq diff --git a/dq/tasks.py b/dq/tasks.py deleted file mode 100644 index 80ee94c..0000000 --- a/dq/tasks.py +++ /dev/null @@ -1,29 +0,0 @@ -import numpy - -from django_q.tasks import async_iter, result - - -# the estimation function -def parzen_estimation(x_samples, point_x, h): - k_n = 0 - for row in x_samples: - x_i = (point_x - row[:, numpy.newaxis]) / h - for row in x_i: - if numpy.abs(row) > (1 / 2): - break - else: - k_n += 1 - return h, (k_n / len(x_samples)) / (h ** point_x.shape[1]) - - -def parzen_async(): - mu_vec = numpy.array([0, 0]) - cov_mat = numpy.array([[1, 0], [0, 1]]) - sample = numpy.random.multivariate_normal(mu_vec, cov_mat, 10000) - widths = numpy.linspace(1.0, 1.2, 100) - x = numpy.array([[0], [0]]) - # async_task them with async_task iterable - args = [(sample, x, w) for w in widths] - result_id = async_iter(parzen_estimation, args, cached=True) - # return the cached result or timeout after 10 seconds - return result(result_id, wait=10000, cached=True)