Giter VIP home page Giter VIP logo

diconet's People

Contributors

alexnowakvila avatar davidfolque avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

diconet's Issues

Questions about logp calculation and GNN input in kmeans.py

Hi!

Thank you for your kindness to share your code! Divide and conquer strategy is really awesome.

I have read your paper and Kmeans code carefully with several unclear questions remained. Looking forward to your replay:

  1. logp calculation

As shown below, when last ==false, variable Lgp will be reassigned to a zero tensor at every iteration of k, thus only the last Lgp is calculated in the backward process. Why not take all split steps into account?

for k in range(K):
scores,_ = gnn(input)
probs = F.sigmoid(scores)
if mode == 'train':
variance = compute_variance(e, probs)
variance = variance.sum() / bs
Lgp = Variable(torch.zeros(n_samples, bs).type(dtype))
Reward2 = Variable(torch.zeros(n_samples, bs).type(dtype))
Reward3 = Variable(torch.zeros(n_samples, bs).type(dtype))
for i in range(n_samples):
Samplei, Lgp[i] = sample_one(probs, 'train')
Ei = e*2 + Samplei.long()
Reward2[i], _,_ = compute_reward(Ei, k+1, points)
baseline = Reward2.mean(0,True).expand_as(Reward3)
loss = 0.0
if (last and k == K-1) or not last:
loss = ((Reward2-baseline) * Lgp).sum(1).sum(0) / n_samples / bs
loss_total = loss_total + loss - reg_factor*variance

  1. OP x Y

I find it really hard to understand each variable's functionality, maybe it's because I am not familiar with GNN. Could you simply explain or refer me to some related links? For example, what does W D U in OP means?

def create_input(points, sigma2):
bs, N, _ = points.size() #points has size bs,N,2
OP = torch.zeros(bs,N,N,4).type(dtype)
E = torch.eye(N).type(dtype).unsqueeze(0).expand(bs,N,N)
OP[:,:,:,0] = E
W = points.unsqueeze(1).expand(bs,N,N,dim) - points.unsqueeze(2).expand(bs,N,N,dim)
dists2 = (W * W).sum(3)
dists = torch.sqrt(dists2)
W = torch.exp(-dists2 / sigma2)
OP[:,:,:,1] = W
D = E * W.sum(2,True).expand(bs,N,N)
OP[:,:,:,2] = D
U = (torch.ones(N,N).type(dtype)/N).unsqueeze(0).expand(bs,N,N)
OP[:,:,:,3] = U
OP = Variable(OP)
x = Variable(points)
Y = Variable(W.clone())

Thanks a lot:)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.