Giter Site home page Giter Site logo

dcnn's Issues

Using Weighted Average to Compute the wFM?

Hi, thanks for sharing the code.
I have a question about the computation of wFM, which is stated to use the recursive estimator in the original paper, but it seems to become a direct weighted average of points (on the manifold) in the following code, is there anything I miss here or is this some kind of simplified way to compute the wFM?

def DCNN(x,d,W_root,mode):
   ''' 
   x is input, with shape batch * sequence_length * n_para * in_channel
   d is the number of skipped, a number
   w is the weights, with shape k * in_channel * out_channel
   mode is "SPD" or "ODF"
   '''
   W = tf.pow(W_root,2)

   batch_size = tf.shape(x)[0]#x.shape[0]
   sequence_length = x.shape[1]
   n_para = x.shape[2]
   k = W.shape[0]
   in_channel = W.shape[1]
   out_channel = W.shape[2]

   padding = (k - 1) * d
   x_pad = tf.pad(x,tf.constant([(0,0),(1,0),(0,0),(0,0)]) * padding , "REFLECT") # for the first element, we need padding
   W = tf.reshape(W,[k*in_channel,out_channel])
   W_sum = tf.reduce_sum(W,0)
   W = tf.div(W,W_sum) # constrain sum(w_k_inchannel) = 1
   if mode =="SPD":
       x_reorder = tf.transpose(x_pad,[0,2,1,3])
       x_reshape = tf.reshape(x_reorder,[batch_size*n_para,1,sequence_length+padding,in_channel])

       W = tf.reshape(W,[1,k,in_channel,out_channel])
       conv1 = tf.nn.atrous_conv2d(x_reshape,W,d,"VALID",name=None)
       conv1 = tf.reshape(conv1,[batch_size,n_para,sequence_length,out_channel])
       conv1 = tf.transpose(conv1,[0,2,1,3])
       return conv1

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.