Giter Club home page Giter Club logo

Comments (8)

fchollet avatar fchollet commented on May 6, 2024

Yes, and they would be implemented as such. They would be wrappers around the 2D operations, exposing them for 1D use cases in a user-friendly way.

The API for Convolution1D would be slightly simpler than that of Convolution2D. nb_row, nb_col would be replaced a unique parameter, like filter_length. I imagine image_shape would be superfluous.

from keras.

dbonadiman avatar dbonadiman commented on May 6, 2024

If i didn't got them wrong there are two types of 1D convolution possible for sequences.

One is the one used in the paper:
Natural Language Processing (almost) from Scratch by Collobert and Weston.
that is implemented as temporal convolution in Torch7

Another one that seams slightly different is the one used in :
A Convolutional Neural Network for Modelling Sentences by Nal Kalchbrenner

The two are different since in the first case we have k filters (where k is the eight of the output matrix) of dimension NxM where n is dimension of the convolution window and m is the number of features of the input sequence. the second one has M filters of Nx1 (vectors) instead that convolve independently over the features of the input sequence.
Should both be added? or do you mind to add one of them in particular?

from keras.

fchollet avatar fchollet commented on May 6, 2024

Both can certainly be useful and would probably need to be added, in a way that makes their use cases perfectly clear. It would also be neat to have reimplementations of these works as examples...

I am wondering whether having separate classes for spatial convolution and temporal convolution, like in Torch7, would be a simpler, more user-friendly API. Any thoughts on that?

from keras.

jef5ez avatar jef5ez commented on May 6, 2024

I've implemented the parts of the Kalchbrenner Modelling Sentences paper and had them working outside of keras. I started to add it to keras here https://github.com/fchollet/keras/blob/73b587e3c3ad218deedfdc94c19ceed3b7632925/keras/layers/convolutional.py
Haven't had a chance to test yet, but was planning to also write up some examples.

from keras.

fchollet avatar fchollet commented on May 6, 2024

@jef5ez: sounds very cool. It would definitely be interesting to see some live examples!

from keras.

phreeza avatar phreeza commented on May 6, 2024

@dbonadiman to me it sounds like the second case is simply a special form of the first case, with M=1?

I don't think having an API for both is necessary. The constructor for a Convolution1D layer could take 3 arguments, n_filters, filter_length and n_channels. With n_filters and filter_length being mandatory, and n_channels as a keyword argument defaulting to 1. That would give us the second case from @dbonadiman's example by default, and the first case when explicitly required.

@fchollet what is the difference between spatial and temporal convolution in torch?

from keras.

sjhddh avatar sjhddh commented on May 6, 2024

@jef5ez Thank you for your contribution to extend CNN to language models.
Could I have any examples about it ?
i.e. apply it on IMDB data, to label positive and negative reviews.

Thx.

from keras.

jef5ez avatar jef5ez commented on May 6, 2024

@sjhddh unfortunately I got busy with other things and never finished working on it. My code assumed the rows/columns of the embeddings were flipped from how keras stores them. That branch is now also several hundred commits behind master and I don't know how much else has changed about keras...

from keras.

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.