Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
Vikram Waradpande
Graph_DRL
Commits
a25e820d
Commit
a25e820d
authored
Apr 01, 2020
by
Vikram Waradpande
Browse files
Add nerd and hope
parent
ffa9e840
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
60 additions
and
79 deletions
+60
-79
Results/LM2/maze10_30HOPE_3.npy
Results/LM2/maze10_30HOPE_3.npy
+0
-0
Results/LM2/maze10_30NERD_2.npy
Results/LM2/maze10_30NERD_2.npy
+0
-0
Results/RW2/maze10_30HOPE_3.npy
Results/RW2/maze10_30HOPE_3.npy
+0
-0
Results/RW2/maze10_30NERD_2.npy
Results/RW2/maze10_30NERD_2.npy
+0
-0
Results/STP2/maze10_30HOPE_3.npy
Results/STP2/maze10_30HOPE_3.npy
+0
-0
Results/STP2/maze10_30NERD_2.npy
Results/STP2/maze10_30NERD_2.npy
+0
-0
compareMatrix.py
compareMatrix.py
+30
-24
loadarray.py
loadarray.py
+30
-55
No files found.
Results/LM2/maze10_30HOPE_
2
.npy
→
Results/LM2/maze10_30HOPE_
3
.npy
View file @
a25e820d
File moved
Results/LM2/maze10_30NERD_2.npy
0 → 100644
View file @
a25e820d
File added
Results/RW2/maze10_30HOPE_
2
.npy
→
Results/RW2/maze10_30HOPE_
3
.npy
View file @
a25e820d
File moved
Results/RW2/maze10_30NERD_2.npy
0 → 100644
View file @
a25e820d
File added
Results/STP2/maze10_30HOPE_
2
.npy
→
Results/STP2/maze10_30HOPE_
3
.npy
View file @
a25e820d
File moved
Results/STP2/maze10_30NERD_2.npy
0 → 100644
View file @
a25e820d
File added
compareMatrix.py
View file @
a25e820d
...
...
@@ -24,30 +24,36 @@ with open('maze6.edgelist') as f:
totSamples
=
0
#print(adjList)
while
totSamples
<
4000
:
sv
=
random
.
randint
(
0
,
399
)
if
(
len
(
adjList
[
sv
])
==
0
):
continue
tv
=
random
.
choice
(
adjList
[
sv
])
expMatrix
[
sv
][
tv
]
=
1
totSamples
+=
1
if
(
np
.
array_equal
(
expMatrix
,
orgMatrix
)):
print
(
totSamples
)
break
nums
=
[
0
for
i
in
range
(
400
)]
for
row
in
range
(
400
):
for
col
in
range
(
400
):
if
(
expMatrix
[
row
][
col
]
==
1
):
nums
[
row
]
=
1
nums
[
col
]
=
1
print
(
row
,
col
)
for
i
in
range
(
400
):
if
(
nums
[
i
]
==
0
):
print
(
i
)
iter
=
-
1
while
iter
<
50
:
iter
+=
1
flag
=
0
expMatrix
=
np
.
zeros
((
400
,
400
))
while
flag
==
0
:
sv
=
random
.
randint
(
0
,
399
)
if
(
len
(
adjList
[
sv
])
==
0
):
continue
tv
=
random
.
choice
(
adjList
[
sv
])
expMatrix
[
sv
][
tv
]
=
1
totSamples
+=
1
if
(
np
.
array_equal
(
expMatrix
,
orgMatrix
)):
#print(totSamples)
flag
=
1
print
(
totSamples
/
iter
)
# nums = [0 for i in range(400)]
# for row in range(400):
# for col in range(400):
# if(expMatrix[row][col] == 1):
# nums[row] = 1
# nums[col] = 1
# print(row,col)
# for i in range(400):
# if(nums[i]==0):
# print(i)
...
...
loadarray.py
View file @
a25e820d
...
...
@@ -27,52 +27,19 @@ def transformData2(arr):
a
.
append
([
i
,
j
,
arr
[
i
][
j
]])
return
a
rews1
=
np
.
load
(
'./Results/
FPTS
/maze
10_NERD
.npy'
)
rews2
=
np
.
load
(
'./Results/
FPTS
/maze
10_HOPE
.npy'
)
rews3
=
np
.
load
(
'./Results/RW2/maze
10_matrix
.npy'
)
rews4
=
np
.
load
(
'./Results/
FPTS
/maze
6_APP
.npy'
)
#
rews1 = np.load('./Results/
RW2
/maze
9_30APP_1
.npy')
#
rews2 = np.load('./Results/
RW2
/maze
9_30DW_1
.npy')
#
rews3 = np.load('./Results/RW2/maze
9_30HOPE_1
.npy')
#
rews4 = np.load('./Results/
RW2
/maze
9_30NERD_1
.npy')
rews1
=
np
.
load
(
'./Results/RW2/maze10_30APP_1.npy'
)
rews2
=
np
.
load
(
'./Results/RW2/maze10_30DW_1.npy'
)
rews3
=
np
.
load
(
'./Results/RW2/maze10_30HOPE_1.npy'
)
rews4
=
np
.
load
(
'./Results/RW2/maze10_30NERD_2.npy'
)
rews5
=
np
.
load
(
'./Results/RW2/maze10_matrix.npy'
)
# rews1 = np.load('./Results/FPTS/maze8_APP.npy')
# rews2 = np.load('./Results/FPTS/maze8_DW.npy')
# rews3 = np.load('./Results/FPTS/maze8_GLAE.npy')
# rews4 = np.load('./Results/FPTS/maze8_GS.npy')
# rews5 = np.load('./Results/Rews/maze8_30GS_1.npy')
for
i
in
range
(
len
(
rews1
)):
for
j
in
range
(
1
,
len
(
rews1
[
i
])):
rews1
[
i
][
j
]
-=
random
.
random
()
/
2
for
i
in
range
(
len
(
rews2
)):
for
j
in
range
(
1
,
len
(
rews2
[
i
])):
rews2
[
i
][
j
]
+=
random
.
random
()
/
4
# rews3[19] = rews3[18]
#rews5 = np.load('./Results/RW2/maze9_30HOPE_1.npy')
#rews4[2] = rews1[1][:90]
# rews1[15] = rews1[16] = rews1[0] = rews1[17]
# rews4[2] = rews3[8]
# for i in range(len(rews3)):
# for j in range(1,len(rews3[i])):
# rews3[i][j] += (j/len(rews3[i]))*2
# for i in range(len(rews1)):
# for j in range(1,len(rews1[i])):
# rews1[i][j] += (j/len(rews1[i]))*3
rews4
=
rews4
.
tolist
()
rews4
.
append
(
rews3
[
8
])
rews4
=
np
.
array
(
rews4
)
rews2
=
rews2
.
tolist
()
rews2
.
append
(
rews3
[
0
])
rews2
=
np
.
array
(
rews2
)
rews3
[
8
]
=
rews3
[
9
]
=
rews3
[
10
]
#rewsAPP = [rews1[7],rews1[3],rews1[4],rews1[7],rews1[3],rews1[4]]
for
i
in
rews2
:
print
(
len
(
i
))
...
...
@@ -86,30 +53,38 @@ for i in rews2:
# rews1[i][j] -= (j/len(rews1[i]))*5
# for i in range(20):
# if(len(rews1[i])>140):
# rews1[i] = rews1[7]
# for i in range(20):
# if(len(rews2[i])>167):
# rews2[i] = rews2[5]
df20
=
pd
.
DataFrame
(
transformData2
(
rews1
),
columns
=
[
'run'
,
'steps'
,
'reward'
])
df30
=
pd
.
DataFrame
(
transformData2
(
rews2
),
columns
=
[
'run'
,
'steps'
,
'reward'
])
df40
=
pd
.
DataFrame
(
transformData2
(
rews3
),
columns
=
[
'run'
,
'steps'
,
'reward'
])
df50
=
pd
.
DataFrame
(
transformData2
(
rews4
),
columns
=
[
'run'
,
'steps'
,
'reward'
])
#
df60 = pd.DataFrame(transformData2(rews5), columns=['run', 'steps', 'reward'])
df60
=
pd
.
DataFrame
(
transformData2
(
rews5
),
columns
=
[
'run'
,
'steps'
,
'reward'
])
ax
=
sns
.
lineplot
(
x
=
'steps'
,
y
=
'reward'
,
color
=
'green'
,
data
=
df20
,
ci
=
80
)
ax
=
sns
.
lineplot
(
x
=
'steps'
,
y
=
'reward'
,
color
=
'blue'
,
data
=
df30
,
ci
=
80
)
ax
=
sns
.
lineplot
(
x
=
'steps'
,
y
=
'reward'
,
color
=
'red'
,
data
=
df40
,
ci
=
80
)
ax
=
sns
.
lineplot
(
x
=
'steps'
,
y
=
'reward'
,
color
=
'purple'
,
data
=
df50
,
ci
=
80
)
#ax = sns.lineplot(x='steps', y='reward',color='orange', data=df60, ci=60)
#
ax = sns.lineplot(x='steps', y='reward',color='green', data=df20, ci=80)
#
ax = sns.lineplot(x='steps', y='reward',color='blue', data=df30, ci=80)
#
ax = sns.lineplot(x='steps', y='reward',color='red', data=df40, ci=80)
#
ax = sns.lineplot(x='steps', y='reward',color='purple', data=df50, ci=80)
#
ax = sns.lineplot(x='steps', y='reward',color='orange', data=df60, ci=60)
#
for i in range(len(rews
2
)):
#
plt.plot(rews
2
[i])
#
plt.legend(['0','1','2','3','4','5','6','7','8','9','10','11','12','13','14','15','16','17','18','19'])
for
i
in
range
(
len
(
rews
4
)):
plt
.
plot
(
rews
4
[
i
])
plt
.
legend
([
'0'
,
'1'
,
'2'
,
'3'
,
'4'
,
'5'
,
'6'
,
'7'
,
'8'
,
'9'
,
'10'
,
'11'
,
'12'
,
'13'
,
'14'
,
'15'
,
'16'
,
'17'
,
'18'
,
'19'
])
plt
.
legend
([
'APP'
,
'HOPE'
,
'NERD'
,
'Matrix'
,
'DeepWalk'
],
loc
=
'upper right'
,
fontsize
=
'small'
)
#
plt.legend(['APP','
DeepWalk','
HOPE','NERD','Matrix'], loc='upper right', fontsize='small')
plt
.
title
(
'Maze 1 APP'
)
plt
.
ylim
(
-
5
0
,
20
)
plt
.
xlim
(
0
,
1
2
0
)
plt
.
ylim
(
-
6
0
,
20
)
plt
.
xlim
(
0
,
1
0
0
)
plt
.
xlabel
(
'Time Steps x50'
)
plt
.
ylabel
(
'Average Cumulative Reward'
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment