Comments (4)
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.
@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.
This current code does not provide specific api for that directly. But you can easily implement it by yourself:
-
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).
-
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. -
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.
@ruidan
Thanks for your detailed explanation, I have implemented it.
from unsupervised-aspect-extraction.
Related Issues (20)
- TensorFlow version HOT 2
- AttributeError: 'Dimension' object has no attribute 'eval' HOT 8
- training on CPU HOT 1
- Question about "ortho_reg: loss - max_margin_loss" HOT 2
- TypeError: Expected float32, got <function create_model.<locals>.ortho_reg at 0x7fa3ee0d88c8> of type 'function' instead.
- UnicodeDecodeError: 'ascii' codec can't decode byte 0xc1 in position 0: ordinal not in range(128) HOT 1
- CUDA version HOT 3
- Details for the code.
- 可以告诉我您使用的tensorflow的版本吗? HOT 1
- What happened to unknown words? HOT 2
- Predict_label on test data HOT 2
- coherence score HOT 2
- Source of data HOT 2
- Execution order of word2vec and preprocess HOT 2
- Attribute Error
- How did you create the Representative Words listed in the paper? HOT 2
- TypeError: add_weight() got multiple values for argument 'name'
- Pls help me solve this problem
- Running it on a new dataset HOT 2
- Why I can't open your dataset url
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from unsupervised-aspect-extraction.