Skip to content
Extraits de code Groupes Projets
Valider 6d77d81d rédigé par Hélène BOURGOIN's avatar Hélène BOURGOIN
Parcourir les fichiers

Upload New File

parent 03da37fb
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
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()
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter