Thanks a lot for sharing the code. I have been trying to implement your paper from scratch to understand ADMM. Your code is very helpful in understanding the paper and getting insights from your solution.
To understand your solution better, I try to evaluate the objective function as follows:
1) Minimize the objective function using scipy minimize.
2) Compare the objective function from H for your implementation for each iteration.
### A: attribute matrix
### W: weight matrix
S = A.transpose() * sparse.diags(np.ravel(np.power(A.power(2).sum(1), -0.5)))
S = S.toarray()
def objective(H, S):
n = S.shape[0]
len_H = H.shape[0]
wid_H = H.shape[1]
term1 = 0
for i in range(n):
for j in range(n):
tmp = (S[i][j] - np.matmul(H[i], H[j].T))
term1 += tmp * tmp
term2 = 0
for i in range(len_H):
for j in range(wid_H):
term2 += np.linalg.norm(H[i] - H[j]) * W[i,j]
term2 = term2 * lambd
sol = term1 + term2
return sol
blog_catalog = sio.loadmat('BlogCatalog.mat', struct_as_record=True)
### For fast iteration, only consider 20x20 size of W and A
W = blog_catalog['Network']
W = W[:20,:20]
A = blog_catalog['Attributes']
A = A[:20,:20]
d = 3 #dimension of H (embedding representation)
e = 0.001
lambd = 0.05
rho = 5
max_iter = np.arange(50)
objectives_author = []
for i in max_iter:
H_author = AANE(W, A, d, lambd, rho, i,'Att').function()
objectives_author.append(objective(H_author, S))
However, I see that the objective function increases with the number of iterations as shown in the figure below:
Can you please give me some insights on this problem?
Thanks a lot for sharing the code. I have been trying to implement your paper from scratch to understand ADMM. Your code is very helpful in understanding the paper and getting insights from your solution.
To understand your solution better, I try to evaluate the objective function as follows: 1) Minimize the objective function using scipy minimize. 2) Compare the objective function from H for your implementation for each iteration.
However, I see that the objective function increases with the number of iterations as shown in the figure below:![image](https://user-images.githubusercontent.com/6776137/94167638-e9e7b180-feb6-11ea-9fcb-28291be944ac.png)
Can you please give me some insights on this problem?