Skip to content
GitLab
Explorer
Connexion
Navigation principale
Rechercher ou aller à…
Projet
S
SIGI
Gestion
Activité
Membres
Labels
Programmation
Tickets
Tableaux des tickets
Jalons
Wiki
Wiki externe
Code
Requêtes de fusion
Dépôt
Branches
Validations
Étiquettes
Graphe du dépôt
Comparer les révisions
Extraits de code
Compilation
Pipelines
Jobs
Planifications de pipeline
Artéfacts
Déploiement
Releases
Registre de paquets
Registre de conteneur
Registre de modèles
Opération
Environnements
Modules Terraform
Surveillance
Incidents
Analyse
Données d'analyse des chaînes de valeur
Analyse des contributeurs
Données d'analyse CI/CD
Données d'analyse du dépôt
Expériences du modèle
Aide
Aide
Support
Documentation de GitLab
Comparer les forfaits GitLab
Forum de la communauté
Contribuer à GitLab
Donner votre avis
Raccourcis clavier
?
Extraits de code
Groupes
Projets
Afficher davantage de fils d'Ariane
Anzo
SIGI
Validations
f3a01787
Valider
f3a01787
rédigé
1 year ago
par
Anzo
Parcourir les fichiers
Options
Téléchargements
Correctifs
Plain Diff
updated with multiprocessing
parent
17ad0128
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
Modifications
3
Masquer les modifications d'espaces
En ligne
Côte à côte
Affichage de
3 fichiers modifiés
Random/__pycache__/graph.cpython-311.pyc
+0
-0
0 ajout, 0 suppression
Random/__pycache__/graph.cpython-311.pyc
Random/graph.py
+56
-1
56 ajouts, 1 suppression
Random/graph.py
Random/main.py
+60
-6
60 ajouts, 6 suppressions
Random/main.py
avec
116 ajouts
et
7 suppressions
Random/__pycache__/graph.cpython-311.pyc
+
0
−
0
Voir le fichier @
f3a01787
Aucun aperçu pour ce type de fichier
Ce diff est replié.
Cliquez pour l'agrandir.
Random/graph.py
+
56
−
1
Voir le fichier @
f3a01787
...
...
@@ -11,6 +11,7 @@ def hist_distributivity_graph(N,RESOLUTION,seed,data):
graphs histograms
see values function in main module
"""
plt
.
clf
()
for
name
in
data
:
print
(
"
building
"
+
str
(
name
)
+
"
histogram...
"
)
xlabel
=
"
Value
"
...
...
@@ -41,6 +42,33 @@ def ecdf_graph(N,RESOLUTION,seed,data):
graph
.
savefig
(
name
+
'
_ecdf.png
'
,
bbox_inches
=
'
tight
'
)
return
def
compare_ecdf
(
N
,
RESOLUTION
,
seed
,
data
):
"""
Create graphs superposing ecdf
"""
plt
.
clf
()
BW
=
0.337
name
=
"
compare_ecdf_
"
for
e
in
data
:
name
+=
e
+
"
_
"
#subdata = {k : data[k] for k in names}
print
(
"
graphing
"
+
str
(
name
)
+
"
...
"
)
xlabel
=
"
Value
"
ylabel
=
"
Density
"
title_name
=
"
N =
"
+
str
(
N
)
+
"
\n
seed =
"
+
str
(
seed
)
if
N
==
0
:
title_name
=
"
seed =
"
+
str
(
seed
)
graph
=
sns
.
displot
(
data
,
legend
=
True
,
kind
=
"
ecdf
"
)
graph
.
set
(
title
=
title_name
)
plt
.
xlabel
(
xlabel
)
plt
.
ylabel
(
ylabel
)
#plt.legend()
plt
.
savefig
(
name
+
'
.png
'
,
bbox_inches
=
'
tight
'
)
return
def
compare
(
N
,
RESOLUTION
,
seed
,
data
):
"""
Create graphs superposing two, already generated,
...
...
@@ -66,6 +94,33 @@ def compare(N, RESOLUTION, seed, data):
graph
.
set
(
title
=
title_name
)
plt
.
xlabel
(
xlabel
)
plt
.
ylabel
(
ylabel
)
graph
.
axes
.
set
plt
.
legend
()
plt
.
savefig
(
name
+
'
.png
'
,
bbox_inches
=
'
tight
'
)
plt
.
savefig
(
name
+
'
.png
'
,
bbox_inches
=
'
tight
'
)
return
def
lineplot_wrap
(
data
,
xlabel
,
ylabel
,
title
,
iterN
):
plt
.
clf
()
print
(
"
graphing
"
+
str
(
title
)
+
"
...
"
)
for
e
in
data
:
plt
.
plot
(
iterN
,
data
[
e
],
marker
=
"
o
"
,
label
=
"
seed=
"
+
str
(
e
))
#graph = sns.lineplot(data, legend=True, x=iterN)
plt
.
title
(
title
)
plt
.
legend
()
plt
.
xscale
(
'
log
'
)
plt
.
xlabel
(
xlabel
)
plt
.
ylabel
(
ylabel
)
plt
.
savefig
(
title
.
replace
(
"
"
,
"
_
"
)
+
"
.png
"
,
bbox_inches
=
"
tight
"
)
def
lineplot_mean_alot
(
data
,
xlabel
,
ylabel
,
title
,
iterN
):
plt
.
clf
()
print
(
"
graphing
"
+
str
(
title
)
+
"
...
"
)
for
e
in
data
:
plt
.
plot
(
iterN
,
data
[
e
],
marker
=
"
o
"
,
alpha
=
0.05
,
color
=
"
red
"
)
plt
.
plot
(
iterN
,
[
0.5
]
*
len
(
iterN
),
color
=
"
blue
"
,
linestyle
=
'
dotted
'
)
plt
.
title
(
title
)
plt
.
xscale
(
'
log
'
)
plt
.
xlabel
(
xlabel
)
plt
.
ylabel
(
ylabel
)
plt
.
savefig
(
title
+
"
.png
"
,
bbox_inches
=
"
tight
"
)
Ce diff est replié.
Cliquez pour l'agrandir.
Random/main.py
+
60
−
6
Voir le fichier @
f3a01787
...
...
@@ -7,6 +7,7 @@ import stats
import
scipy
import
seaborn
as
sns
import
csv
import
multiprocessing
#shut up stupid warnings from not "the-most-up-to-date" libraries
import
warnings
...
...
@@ -72,7 +73,7 @@ def write_stats(data, name):
return
def
write_stats_chi
(
data
,
name
,
RES
):
fields
=
[
"
chi
"
,
"
p
"
]
fields
=
[
"
name
"
,
"
chi
"
,
"
p
"
]
val
=
stats
.
chisquared_uniform
(
data
,
RES
)
chi
=
val
[
0
]
p
=
val
[
1
]
...
...
@@ -86,16 +87,60 @@ def write_stats_chi(data, name, RES):
"
p
"
:
str
(
p
)})
return
if
__name__
==
"
__main__
"
:
##INIT PARAMS##
def
mean_evolves
(
generator
,
number
,
iterN
):
datas
=
{}
for
i
in
range
(
number
):
seed
=
int
(
datetime
.
now
().
timestamp
()
+
i
)
sub_data
=
iteratives
(
iterN
,
seed
,
generator
)
res
=
[]
for
a
in
sub_data
:
res
.
append
(
np
.
mean
(
sub_data
[
a
]))
datas
[
str
(
seed
)]
=
res
return
datas
def
pipeline
(
generator
):
N
=
1000000
RESOLUTION
=
100
iterN
=
[
100
,
1000000
,
100000000
]
iterN
=
[
100
,
10000
,
1000000
,
100000000
]
iterNmean
=
[
100
,
1000
,
10000
,
100000
,
1000000
]
seed
=
int
(
datetime
.
now
().
timestamp
())
name_
=
type
(
generator
).
__name__
sns
.
set_theme
(
style
=
"
darkgrid
"
)
data
=
values
(
N
,
seed
,[
generator
])
#generate a lot of diagrams
graph
.
hist_distributivity_graph
(
N
,
RESOLUTION
,
seed
,
data
)
for
name
in
data
:
write_stats
(
data
[
name
],
name
)
write_stats_chi
(
data
[
name
],
name
,
RESOLUTION
)
data_iter
=
iteratives
(
iterN
,
seed
,
generator
)
graph
.
compare
(
0
,
RESOLUTION
,
seed
,
data_iter
)
graph
.
compare
(
0
,
RESOLUTION
,
seed
,
data_iter
)
data_alot
=
mean_evolves
(
generator
,
500
,
iterNmean
)
graph
.
lineplot_mean_alot
(
data_alot
,
"
Size
"
,
"
Mean
"
,
"
Mean values evolution for
"
+
name_
,
iterNmean
)
if
__name__
==
"
__main__
"
:
#init generators
generators
=
[
ParkMiller
(),
KnuthLewis
(),
Marsaglia
()
,
LavauxJenssens
(),
Haynes
(),
MitchelMoore
()
,
MersenneTwister
(),
BlumBlumShub
()]
for
a
in
generators
:
p
=
multiprocessing
.
Process
(
target
=
pipeline
,
args
=
[
a
])
p
.
start
()
"""
##INIT PARAMS##
N = 1000000
RESOLUTION = 100
iterN = [100, 10000, 1000000, 100000000]
#init seed on timesystem
seed = int(datetime.now().timestamp())
...
...
@@ -104,8 +149,16 @@ if __name__=="__main__":
sns.set_theme(style=
"
darkgrid
"
)
#generate N random values for each RNG
data
=
values
(
N
,
seed
,
generators
)
#data = values(N,seed,generators)
#graph.compare_ecdf(0, RESOLUTION, seed
# , iteratives([100,1000,1000000], seed, ParkMiller()))
a = mean_evolves(ParkMiller(), 500, [100,1000])
graph.lineplot_mean_alot(a,
"
Size
"
,
"
Mean
"
,
"
Mean Value evolution for ParkMiller
"
,[100,1000])
#generate a lot of diagrams
graph.hist_distributivity_graph(N,RESOLUTION,seed,data)
for name in data:
...
...
@@ -116,3 +169,4 @@ if __name__=="__main__":
graph.ecdf_graph(0, RESOLUTION, seed, data_iter)
graph.compare(0, RESOLUTION, seed, data_iter)
"""
Ce diff est replié.
Cliquez pour l'agrandir.
Aperçu
0%
Chargement en cours
Veuillez réessayer
ou
joindre un nouveau fichier
.
Annuler
You are about to add
0
people
to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Enregistrer le commentaire
Annuler
Veuillez vous
inscrire
ou vous
se connecter
pour commenter