Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
C
Collective risk game
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Liyao Zhu
Collective risk game
Commits
d78a8cca
Commit
d78a8cca
authored
May 11, 2019
by
Liyao Zhu
Browse files
Options
Downloads
Patches
Plain Diff
repHist
parent
7df1e797
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
main.py
+13
-10
13 additions, 10 deletions
main.py
with
13 additions
and
10 deletions
main.py
+
13
−
10
View file @
d78a8cca
...
@@ -2,7 +2,6 @@ import matplotlib.pyplot as plt
...
@@ -2,7 +2,6 @@ import matplotlib.pyplot as plt
from
matplotlib
import
cm
from
matplotlib
import
cm
from
mpl_toolkits.mplot3d
import
Axes3D
from
mpl_toolkits.mplot3d
import
Axes3D
import
numpy
as
np
import
numpy
as
np
import
scipy
from
scipy
import
stats
from
scipy
import
stats
import
game
import
game
...
@@ -192,11 +191,6 @@ def t_test(repeat, Actions, r=0, R=1, I=1000, lastIterations=100, N=100, byThres
...
@@ -192,11 +191,6 @@ def t_test(repeat, Actions, r=0, R=1, I=1000, lastIterations=100, N=100, byThres
for
s
in
(
0
,
1
):
for
s
in
(
0
,
1
):
newArgs
=
{
**
{
key
:
atuple
[
s
]},
**
kwargs
}
newArgs
=
{
**
{
key
:
atuple
[
s
]},
**
kwargs
}
# for re in range(repeat):
# # print("T-Test REP", re)
# g = game.Game(R=R, Actions=Actions, I=I, N=N, **newArgs)
# result = g.play()
# samples[s, re] = averageOfLast(result, Actions, N, r, lastIterations)[0]
samples
[
s
]
=
repHist
(
repeat
,
Actions
,
R
,
r
,
I
,
lastIterations
,
N
,
**
newArgs
)
samples
[
s
]
=
repHist
(
repeat
,
Actions
,
R
,
r
,
I
,
lastIterations
,
N
,
**
newArgs
)
if
byThreshold
:
if
byThreshold
:
samples
[
s
]
/=
newArgs
[
"
threshold
"
]
samples
[
s
]
/=
newArgs
[
"
threshold
"
]
...
@@ -208,7 +202,7 @@ def t_test(repeat, Actions, r=0, R=1, I=1000, lastIterations=100, N=100, byThres
...
@@ -208,7 +202,7 @@ def t_test(repeat, Actions, r=0, R=1, I=1000, lastIterations=100, N=100, byThres
def
repHist
(
repeat
,
Actions
,
R
=
1
,
r
=
0
,
I
=
1000
,
lastIterations
=
100
,
N
=
100
,
**
kwargs
):
def
repHist
(
repeat
,
Actions
,
R
=
1
,
r
=
0
,
I
=
1000
,
lastIterations
=
100
,
N
=
100
,
**
kwargs
):
hist
=
np
.
zeros
(
repeat
)
hist
=
np
.
zeros
(
repeat
)
for
re
in
range
(
repeat
):
for
re
in
range
(
repeat
):
print
(
"
HistREP
"
,
re
)
#
print("HistREP", re)
g
=
game
.
Game
(
R
=
R
,
Actions
=
Actions
,
I
=
I
,
N
=
N
,
**
kwargs
)
g
=
game
.
Game
(
R
=
R
,
Actions
=
Actions
,
I
=
I
,
N
=
N
,
**
kwargs
)
result
=
g
.
play
()
result
=
g
.
play
()
hist
[
re
]
=
averageOfLast
(
result
,
Actions
,
N
,
r
,
lastIterations
)[
0
]
hist
[
re
]
=
averageOfLast
(
result
,
Actions
,
N
,
r
,
lastIterations
)[
0
]
...
@@ -264,7 +258,7 @@ def main():
...
@@ -264,7 +258,7 @@ def main():
"""
"""
# stackBar(0, Actions, repeat=1, alpha=[0, 0.2, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1])
# stackBar(0, Actions, repeat=1, alpha=[0, 0.2, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1])
# stackBar(0, Actions, repeat=1, N=[5, 10, 20, 50, 100], threshold=0.6, RF=2)
# stackBar(0, Actions, repeat=1, N=[5, 10, 20, 50, 100], threshold=0.6, RF=2)
#
stackBar(0, Actions, repeat=
1
, RF=2, threshold=[0.
2, 0.4, 0.6, 0.8
, 1])
stackBar
(
0
,
Actions
,
repeat
=
30
,
RF
=
2
,
threshold
=
[
0.
1
,
0.2
,
0.3
,
0.4
,
0.5
,
0.6
,
0.7
,
0.8
,
0.9
,
1
])
"""
"""
Graph4: Actions by different epsilon method + value
Graph4: Actions by different epsilon method + value
...
@@ -299,17 +293,26 @@ def main():
...
@@ -299,17 +293,26 @@ def main():
# t_test(30, Actions, alpha=(1, 0.45), RF=2, threshold=0.2) #pvalue=1.3749e-11
# t_test(30, Actions, alpha=(1, 0.45), RF=2, threshold=0.2) #pvalue=1.3749e-11
# t_test(30, Actions, alpha=(1, 0.4), RF=2, threshold=0.2) #pvalue=3.8352e-19
# t_test(30, Actions, alpha=(1, 0.4), RF=2, threshold=0.2) #pvalue=3.8352e-19
"""
T-TEST
GRAPH
"""
"""
T-TEST
K,P
"""
# t_test(30, Actions, K=(2, 99), P=0) #pvalue=0.4278
# t_test(30, Actions, K=(2, 99), P=0) #pvalue=0.4278
# t_test(30, Actions, K=(2, 99), P=0.9) #pvalue=0.4541
# t_test(30, Actions, K=(2, 99), P=0.9) #pvalue=0.4541
# t_test(100, Actions, K=(2, 99), P=0.8) #pvalue=0.01502 ***
# for _ in range(5):
# t_test(30, Actions, K=(2, 99), P=0.8) #pvalue=0.01502 ***
# t_test(30, Actions, K=(2, 99), P=0.85) #pvalue=0.1931
# t_test(30, Actions, K=(2, 99), P=0.85) #pvalue=0.1931
# t_test(30, Actions, K=(2, 99), P=0.75) #pvalue=0.5630
# t_test(30, Actions, K=(2, 99), P=0.75) #pvalue=0.5630
# t_test(30, Actions, K=2, P=(0, 0.9)) #pvalue=0.9806
# t_test(30, Actions, K=2, P=(0, 0.9)) #pvalue=0.9806
# t_test(30, Actions, K=2, P=(0, 0.8)) #pvalue=0.4523
# t_test(30, Actions, K=2, P=(0, 0.8)) #pvalue=0.4523
# t_test(30, Actions, K=(2, 99), P=0.9) #pvalue=0.4541
# t_test(30, Actions, K=(2, 99), P=0.9) #pvalue=0.4541
# t_test(30, Actions, K=(2, 99), P=0.7) #pvalue=0.3698
# t_test(30, Actions, K=(2, 99), P=0.7) #pvalue=0.3698
# t_test(30, Actions, K=99, P=(0, 0.8)) #pvalue=0.8167
# base = repHist(30, Actions, K=99)
# for p in np.arange(0.76, 0.85, 0.01): #ALL >.05
# compare = repHist(30, Actions, K=2, P=p)
# print("K=2, P=", p, stats.ttest_ind(base, compare))
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment