Coder Social home page Coder Social logo

shagunsodhani / cnn-sentence-classifier Goto Github PK

View Code? Open in Web Editor NEW
144.0 144.0 29.0 488 KB

Implementation of "Convolutional Neural Networks for Sentence Classification" paper

Home Page: http://shagunsodhani.in/CNN-Sentence-Classifier/

License: MIT License

Python 100.00%

cnn-sentence-classifier's People

Contributors

shagunsodhani avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

cnn-sentence-classifier's Issues

Multi-channel CNN for Sentence Classification

Hi Shagun,

Many thanks for this useful framework of CNN in Keras. I have a very small question about the feeding mutiple word embeddings into CNN. As in the paper, I would like to test how Glove and Word2Vec work together in sentence classification. Can you please let me know how to create embedding layer with multiple word vectors?

Regards,
Nader

which file need be created?

rzai@rzai00:/prj/CNN-Sentence-Classifier$ python3 app/train.py --data_dir=sample_dataset/ --embedding_file_path=/media/rzai/ai_data/glove.6B.200d.txt --model_name=cnn_static
Using Theano backend.
Using gpu device 0: GeForce GTX 1080 (CNMeM is disabled, cuDNN 5005)
Reading word vectors.
Found 400000 word vectors.
Processing input data
Found 10662 texts.
Found 19498 unique tokens.
Shape of data tensor: (10662, 56)
Shape of label tensor: (10662, 2)
Preparing embedding matrix.
Traceback (most recent call last):
File "app/train.py", line 90, in
main()
File "app/train.py", line 20, in main
train(args)
File "app/train.py", line 71, in train
embedding_matrix[i] = embedding_vector
ValueError: could not broadcast input array from shape (200) into shape (100)
rzai@rzai00:
/prj/CNN-Sentence-Classifier$ python3 app/train.py --data_dir=sample_dataset/ --embedding_file_path=/media/rzai/ai_data/glove.6B.100d.txt --model_name=cnn_static
Using Theano backend.
Using gpu device 0: GeForce GTX 1080 (CNMeM is disabled, cuDNN 5005)
Reading word vectors.
Found 400000 word vectors.
Processing input data
Found 10662 texts.
Found 19498 unique tokens.
Shape of data tensor: (10662, 56)
Shape of label tensor: (10662, 2)
Preparing embedding matrix.
Defining model.
Train on 9596 samples, validate on 1066 samples
Epoch 1/10
9568/9596 [============================>.] - ETA: 0s - loss: 0.6636 - acc: 0.6422Epoch 00000: val_loss improved from inf to 0.55422, saving model to model/weights.best.hdf5
Traceback (most recent call last):
File "app/train.py", line 90, in
main()
File "app/train.py", line 20, in main
train(args)
File "app/train.py", line 83, in train
nb_epoch=args.num_epochs, batch_size=args.batch_size, callbacks=callbacks_list)
File "/usr/local/lib/python3.4/dist-packages/keras/models.py", line 620, in fit
sample_weight=sample_weight)
File "/usr/local/lib/python3.4/dist-packages/keras/engine/training.py", line 1106, in fit
callback_metrics=callback_metrics)
File "/usr/local/lib/python3.4/dist-packages/keras/engine/training.py", line 844, in _fit_loop
callbacks.on_epoch_end(epoch, epoch_logs)
File "/usr/local/lib/python3.4/dist-packages/keras/callbacks.py", line 40, in on_epoch_end
callback.on_epoch_end(epoch, logs)
File "/usr/local/lib/python3.4/dist-packages/keras/callbacks.py", line 296, in on_epoch_end
self.model.save(filepath, overwrite=True)
File "/usr/local/lib/python3.4/dist-packages/keras/engine/topology.py", line 2423, in save
save_model(self, filepath, overwrite)
File "/usr/local/lib/python3.4/dist-packages/keras/models.py", line 48, in save_model
f = h5py.File(filepath, 'w')
File "/usr/lib/python3/dist-packages/h5py/_hl/files.py", line 207, in init
fid = make_fid(name, mode, userblock_size, fapl)
File "/usr/lib/python3/dist-packages/h5py/_hl/files.py", line 85, in make_fid
fid = h5f.create(name, h5f.ACC_TRUNC, fapl=fapl, fcpl=fcpl)
File "h5f.pyx", line 90, in h5py.h5f.create (h5py/h5f.c:1984)
OSError: unable to create file (File accessibilty: Unable to open file)
rzai@rzai00:/prj/CNN-Sentence-Classifier$
rzai@rzai00:
/prj/CNN-Sentence-Classifier$
rzai@rzai00:~/prj/CNN-Sentence-Classifier$

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.