Coder Social home page Coder Social logo

sentence length and padding about cnn_sentence HOT 4 OPEN

yoonkim avatar yoonkim commented on June 29, 2024
sentence length and padding

from cnn_sentence.

Comments (4)

yoonkim avatar yoonkim commented on June 29, 2024

it's because we do SGD with mini-batches, and each mini-batch has sentences of varying lengths. one could sort/group the batches based on sentence length and then there would be no need to pad (as is often done in NMT).

from cnn_sentence.

stephenhky avatar stephenhky commented on June 29, 2024

A carry-on question: if the sentence length allowed n is greater than the real length of a sentence, what would the vector be for the remaining vectors? Are they set to zero? Or given random values to the vector elements?

from cnn_sentence.

HYY0508 avatar HYY0508 commented on June 29, 2024

Traceback (most recent call last):
File "conv_net_sentence.py", line 311, in
datasets = make_idx_data_cv(revs, word_idx_map, i, max_l=56,k=300, filter_h=5)
File "conv_net_sentence.py", line 283, in make_idx_data_cv
train = np.array(train,dtype="int")
ValueError: setting an array element with a sequence.
follow your code,I meet a quesion,Is that the same reason you're talking about?

from cnn_sentence.

moses9591 avatar moses9591 commented on June 29, 2024

You should change this line train = np.array(train,dtype="int") as following:
train = np.array(train,dtype="object")

from cnn_sentence.

Related Issues (20)

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.