Code Monkey home page Code Monkey logo

qclass_dl's Issues

A question about lstm.py

Hi thtrieu:
Your repository is pretty cool and easy to read. But I have a few questions.

# Collect the appropriate last words into variable output (dimension = batch x embedding_size)
        output = outputs[0]
        one = tf.ones([1, hidden_unit], tf.float32)
        with tf.variable_scope("Output"):
            tf.get_variable_scope().reuse_variables()
            for i in range(1,len(outputs)):
                ind = self.real_len < (i+1)
                ind = tf.to_float(ind)
                ind = tf.expand_dims(ind, -1)
                mat = tf.matmul(ind, one)
                output = tf.add(tf.mul(output, mat),tf.mul(outputs[i], 1.0 - mat))

I am not sure why you do these step. Can you explain some detail about it please?

By the way, when I try to remove these lines, just use output = outputs[-1], I get terrible result. I guess output = outputs[-1] my be the output of <PAD/> word. So my result is terrible. Am I right?

Test with a new question

Can you please give a script for testing the trained model for a new question(without a question type) from a console?

Valid Acc

After fix some place caused by different version of tf, I ran lstm model success but only get 84% Valid Acc, What do I missed?

l2_loss

Why are you added the output of l2_loss(b) to l2_loss(self.w) ? It didnt make sense to me. Could you please explain what am I missing ?

l2_loss += tf.nn.l2_loss(self.W)
l2_loss += tf.nn.l2_loss(b)

Thanks.

TypeError: list indices must be integers or slices, not str- in python 3

Hello Sir, when i'm trying to run your program n Phyton 3, it gives me errors in this function.

def add_unknown_words(word_vecs, vocab, min_df=0, k=300):
"""
0.25 is chosen so the unknown vectors have (approximately) same variance as pre-trained ones
"""
count = 0
for word in vocab:
if word not in word_vecs and vocab[word] >= min_df:
word_vecs[word] = np.random.uniform(-0.25, 0.25, k)
else:
count += 1
return count

But when I'm trying to run on Python 3.6 it doesn't work and it makes the following errors. What should I change to run it on Python 3. Thanks

Traceback (most recent call last):
File "/Users/apple-PC/PycharmProjects/qclass_dl/train_cnn.py", line 56, in
count = data_helpers.add_unknown_words(trained_vecs, vocabulary)
File "/Users/apple-PC/PycharmProjects/qclass_dl/data_helpers.py", line 178, in add_unknown_words
word_vecs[word] = np.random.uniform(-0.25, 0.25, k)
TypeError: list indices must be integers or slices, not str

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.