Commit a25e820d authored by Vikram Waradpande's avatar Vikram Waradpande
Browse files

Add nerd and hope

parent ffa9e840
......@@ -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)
......
......@@ -27,52 +27,19 @@ def transformData2(arr):
a.append([i,j,arr[i][j]])
return a
rews1 = np.load('./Results/FPTS/maze10_NERD.npy')
rews2 = np.load('./Results/FPTS/maze10_HOPE.npy')
rews3 = np.load('./Results/RW2/maze10_matrix.npy')
rews4 = np.load('./Results/FPTS/maze6_APP.npy')
# rews1 = np.load('./Results/RW2/maze9_30APP_1.npy')
# rews2 = np.load('./Results/RW2/maze9_30DW_1.npy')
# rews3 = np.load('./Results/RW2/maze9_30HOPE_1.npy')
# rews4 = np.load('./Results/RW2/maze9_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(rews2)):
# plt.plot(rews2[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(rews4)):
plt.plot(rews4[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(-50,20)
plt.xlim(0,120)
plt.ylim(-60,20)
plt.xlim(0,100)
plt.xlabel('Time Steps x50')
plt.ylabel('Average Cumulative Reward')
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment