Tensorflow Text Classification - Python Deep Learning - Source Dexter

20 Comments

  1. akshay pai
    October 13, 2017 @ 12:28 pm

    A guide to building a contextual Chatbot with tensorflow: https://chatbotsmagazine.com/contextual-chat-bots-with-tensorflow-4391749d0077

    Reply

  2. Kai Wendt
    February 19, 2018 @ 2:09 pm

    Hey, great tutorial but is there any possibility that you append the code with the accuracy of the model.

    Reply

    • akshay pai
      May 16, 2018 @ 11:40 am

      Hey, that is a possibility, I will try to add that sometime. If you have done that already, then please do raise a PR on github.

      Reply

  3. Anders Fåk
    April 5, 2018 @ 4:57 pm

    Thanks for an excellent example.
    This got me started with text classification on my text data.

    In your sample the training and predict section is in the same python script…. How would you define and load that model for predictions in a separate standalone script?

    Reply

    • akshay pai
      May 16, 2018 @ 11:41 am

      You can save the model, using tflearn and then load it in another file. Once loaded, you can use the same methods as in this script to predict

      Reply

  4. Sean O'Keefe
    April 9, 2018 @ 6:12 am

    Love this post! I’ve been trying to figure out how to do with with TF for some time.

    Reply

  5. Senso
    April 10, 2018 @ 5:56 pm

    Most examples for NLP in TensorFlow involve labels which are already given by the developer who creates and trains the TensorFlow model. I am beginner in this field and this seems to fall under the category of supervised learning. Is this correct?

    Now I would like to have a training model with TensorFlow where I don’t give it any labels. It should classify sentences itself. There is a huge amount of data where labels are not clear. The hope is that TensorFlow finds clusters in the data which can be used for the labeling and classifying the sentences.

    Reply

    • akshay pai
      May 16, 2018 @ 11:43 am

      Yes, this most certainly falls into the supervised learning category. I haven’t worked on unsupervised learning with tensorflow yet. But i will surely update my blog when I do so.

      Reply

  6. Ramprassad
    April 18, 2018 @ 1:07 pm

    thatns for useful article. Can you try to port the same to golang?

    Reply

    • akshay pai
      May 16, 2018 @ 11:37 am

      Sorry, I am not that good at golang, If you have done it, then please do raise a pull request.

      Reply

  7. Ramprassad
    April 19, 2018 @ 7:49 pm

    i can test this as it is.

    But i can’t load saved model using tensorflow not tflearn.

    i understand that model is trained using tflearn and hence can be loaded in tflearn only.

    Please try to port this completely to tensorflow.

    Reply

  8. Prateek
    June 7, 2018 @ 8:51 pm

    Nice article. I am using this in a personal fun project. I noticed the following.

    1. There are issues while restoring model in new code , avoiding to prepare data is cumbersome task.
    2. tflearn github is almost unsupported for issues.
    3. Even though model is restored with lot of modifications, its taking 3-4 seconds to run the program which is too slow.
    4. predictions are different every time for same input (I loaded same saved model in each run without changing trained data) Is this because I added parameter restore=False on net = tflearn.fully_connected(net, 8, restore=False) to avoid shape mismatch exceptions on reloading the model?

    Reply

    • Akshay Pai
      June 7, 2018 @ 8:54 pm

      These issues that you are facing is due to the version mismatch of tensorflow or some errors with the tensors that is being formed. I am using this extensively in many places and I can assure you that the results are stable and the performance is super fast. it in milli-seconds that I get results in.

      Reply

      • Prateek
        June 7, 2018 @ 9:29 pm

        I just cloned github code of this and retested. I dont see any issue with version issue in log?

        Regarding this is slow : I have large model , with 224 labels and 1600 total sentences. tflearn restoring model with code in different program is not so easy. Even with few lines of code , we still need to have reference to `words`

        I guess one can use different stemmer , I see stemmed words look weird. How about `nltk.stem.wordnetWordNetLemmatizer`

        I just want to fix this issue of different predictions each time. I couldnt get same issue being mentioned anywhere in any blog either .

        And tflearn does not have method to update the model with new data, we have call model.fit with updated data and them model.save again which will retrain the whole model and takes a lot of time.

        Reply

        • Akshay Pai
          June 7, 2018 @ 9:33 pm

          You can certainly try the nltk.stem.wordnetWordNetLemmatizer . Even with that large dataset, I don’t think it should be an issue for the program to either run slowly or not to be stable. I will try to look at this when I shave some time.

          Reply

    • Prateek
      June 7, 2018 @ 9:19 pm

      “Output predictions vary every time with the mentioned code as well without any changes. I think this is weird.

      Reply

Leave a Reply

Your email address will not be published. Required fields are marked *