From 6d77d81d5a415d76d77bc98e9c8cc4c8bb114d52 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?H=C3=A9l=C3=A8ne=20BOURGOIN?= <helene.bourgoin@ensiie.fr>
Date: Fri, 27 Sep 2019 16:33:01 +0200
Subject: [PATCH] Upload New File

---
 persolhs.py | 32 ++++++++++++++++++++++++++++++++
 1 file changed, 32 insertions(+)
 create mode 100644 persolhs.py

diff --git a/persolhs.py b/persolhs.py
new file mode 100644
index 0000000..4fabac9
--- /dev/null
+++ b/persolhs.py
@@ -0,0 +1,32 @@
+import numpy as np
+import matplotlib.pyplot as plt
+
+#makes a Latin Hyper Cube sample
+#returns a matrix X of size n by p
+#of a LHS of n values on each of p variables
+#for each column of X, the n values are randomly
+#distributed with one from each interval
+#(0,1/n), (1/n,2/n), ..., (1-1/n,1)
+#and they are randomly permuted
+
+#def lhssample(n=10,p=2):
+
+#ça donne des résultats moyen beau il y a possiblement une histoire de couches de points à rajouter
+def lhssample(n,p):
+    x = np.random.uniform(size=[n,p])
+    for i in range(0,p):
+        x[:,i] = (np.argsort(x[:,i])+0.5)/n
+    return x
+
+x = lhssample(10,10)
+
+
+print(x.shape)
+
+
+plt.plot(x[:, 0], x[:, 1], "o")
+plt.xlabel("x")
+plt.ylabel("y")
+plt.grid()
+plt.show()
+
-- 
GitLab