Giter Club home page Giter Club logo

sa-dl's Introduction

IMPORTANT

This repo is no longer maintained! Please go to: https://github.com/songyouwei/ABSA-PyTorch

SA-DL

Sentiment Analysis with Deep Learning models. Implemented with Tensorflow and Keras.

使用深度学习模型解决情感分析问题。

Packagist PRsWelcome PythonVersion

Dependencies

An usage example

Training:

python ram.py

See the training process

tensorboard --logdir=./ram_logs

Reviews / Surveys

Zhang, Lei, Shuai Wang, and Bing Liu. "Deep Learning for Sentiment Analysis: A Survey." arXiv preprint arXiv:1801.07883 (2018). [pdf]

Young, Tom, et al. "Recent trends in deep learning based natural language processing." arXiv preprint arXiv:1708.02709 (2017). [pdf]

Papers & Models

RAM (ram.py)

Chen, Peng, et al. "Recurrent Attention Network on Memory for Aspect Sentiment Analysis." Proceedings of the 2017 Conference on Empirical Methods in Natural Language Processing. 2017. [pdf]

ram

MemNet (dmn.py)

Tang, Duyu, Bing Qin, and Ting Liu. "Aspect level sentiment classification with deep memory network." arXiv preprint arXiv:1605.08900 (2016). [pdf]

memnet

IAN

Ma, Dehong, et al. "Interactive Attention Networks for Aspect-Level Sentiment Classification." arXiv preprint arXiv:1709.00893 (2017).

han

TD-LSTM (td_lstm.py)

Tang, Duyu, et al. "Effective LSTMs for Target-Dependent Sentiment Classification." Proceedings of COLING 2016, the 26th International Conference on Computational Linguistics: Technical Papers. 2016. [pdf]

td-lstm

LSTM (lstm.py)

lstm

Licence

MIT License

sa-dl's People

Contributors

songyouwei 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

Watchers

 avatar  avatar  avatar

sa-dl's Issues

using predict function in td_lstm.py

i've tried your code for training purpose and its work really great. now im running this script to predict sentence. its throw me an error.

if __name__ == '__main__':
    # model = TDLSTM()
    # model.train()
    parser = argparse.ArgumentParser()
    parser.add_argument('-s', '--sentence', type=str, default=None, help='predict with sentence')
    args = parser.parse_args()
    model = TDLSTM()
    if args.sentence:
        model.predict(args.sentence) #"Obama is so kind and i love him"
    else:
        model.train()

by running python td_lstm.py -s "Obama is so kind and i love him" , throw error =

ValueError: Error when checking model input: the list of Numpy arrays that you are passing to your model is not the size the model expected. Expected to see 2 array(s), but instead got the following list of 1 arrays: [array([[  0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
          0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
          0,   0,   0,   0,   0,   0,   0,   0,   0, ...

thanks for your great works for creating this code. really helped me a lot 👍

Getting error - None values not supported when running ram.py

Here is the traceback:

Build model...
Traceback (most recent call last):
File "ram.py", line 117, in
model = RecurrentAttentionMemory()
File "ram.py", line 86, in init
x = shared_attention((memory, x))
File "/usr/local/lib/python3.6/site-packages/tensorflow/python/keras/_impl/keras/engine/base_layer.py", line 239, in call
output = super(Layer, self).call(inputs, **kwargs)
File "/usr/local/lib/python3.6/site-packages/tensorflow/python/layers/base.py", line 714, in call
outputs = self.call(inputs, *args, **kwargs)
File "/Users/tushar/workspace/python/impact/songyouwei/SA-DL/attention_layer.py", line 66, in call
score *= K.cast(mask, K.floatx())
File "/usr/local/lib/python3.6/site-packages/tensorflow/python/keras/_impl/keras/backend.py", line 1226, in cast
return math_ops.cast(x, dtype)
File "/usr/local/lib/python3.6/site-packages/tensorflow/python/ops/math_ops.py", line 779, in cast
x = ops.convert_to_tensor(x, name="x")
File "/usr/local/lib/python3.6/site-packages/tensorflow/python/framework/ops.py", line 950, in convert_to_tensor
as_ref=False)
File "/usr/local/lib/python3.6/site-packages/tensorflow/python/framework/ops.py", line 1040, in internal_convert_to_tensor
ret = conversion_func(value, dtype=dtype, name=name, as_ref=as_ref)
File "/usr/local/lib/python3.6/site-packages/tensorflow/python/ops/array_ops.py", line 1026, in _autopacking_conversion_function
return _autopacking_helper(v, inferred_dtype, name or "packed")
File "/usr/local/lib/python3.6/site-packages/tensorflow/python/ops/array_ops.py", line 988, in _autopacking_helper
constant_op.constant(elem, dtype=dtype, name=str(i)))
File "/usr/local/lib/python3.6/site-packages/tensorflow/python/framework/constant_op.py", line 214, in constant
value, dtype=dtype, shape=shape, verify_shape=verify_shape))
File "/usr/local/lib/python3.6/site-packages/tensorflow/python/framework/tensor_util.py", line 421, in make_tensor_proto
raise ValueError("None values not supported.")
ValueError: None values not supported.

Is there something that needs fixing?

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.