Git Product home page Git Product logo

Comments (4)

ruidan avatar ruidan commented on August 21, 2024

Seems you are using tensorflow as backend. You should use Keras 1.2.1 with Theano 0.9.0 as backend

from unsupervised-aspect-extraction.

Aron9080 avatar Aron9080 commented on August 21, 2024

@ruidan
Thank you so much! It works very well, but I confuse that if I want to get the target(s) of a sentence by the user's input with this model, e.g "The sushi was lousy - too sweet or too salty and the portions tiny", which method is to extract the terms of "sushi" and "portions", and to classify them to the categories of "Food"? I spent some time on studying code but I haven't found the answer. The deadline of my projecy is coming, so I will be in debt to you if you can help you

from unsupervised-aspect-extraction.

ruidan avatar ruidan commented on August 21, 2024

This current code does not provide specific api for that directly. But you can easily implement it by yourself:

  1. For a given new text, you need to first preprocess it the same way as the code does on the training and test sentences. (This step is very important).

  2. The model will assign an inferred aspect label to the input sentence. Since the model training is completely unsupervised, the inferred aspects are represented as ranked word lists. You need to
    to manually map each inferred cluster to a gold category label to get the prediction of the gold label. Please refer to evaluation.py, where you can find how the model assigns an gold label to each test sentence. Of course, you can develop some other methods to automatically map inferred aspects to gold aspects without human interruption.

  3. The model is not designed to extract aspect terms/targets. You can still use it for that purpose if you want a simple unsupervised method. One possible way is to use the learned attention weights as scores, where higher score indicates higher probability to be an aspect term. For each sentence, you can set a threshold value according to the sentence length to select the possible aspect terms. The model can learn very reasonable attention weights even in an unsupervised setting. To see the quality of the learned attention weights, you can simply run the evaluation scripts on the pre-trained restaurant model to generate the attention weights on all test sentences (refer to Evaluation in README). Since the method is unsupervised, you should not expect the performance in aspect term extraction as good as other supervised methods.

from unsupervised-aspect-extraction.

Aron9080 avatar Aron9080 commented on August 21, 2024

@ruidan
Thanks for your detailed explanation, I have implemented it.

from unsupervised-aspect-extraction.

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.