Coder Social home page Coder Social logo

songyouwei / sa-dl Goto Github PK

View Code? Open in Web Editor NEW
35.0 35.0 14.0 1.44 MB

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

License: MIT License

Python 100.00%
aspect-based-sentiment-analysis attention-mechanism deep-learning keras machine-learning natural-language-processing nlp semeval sentiment-analysis tensorflow twitter-sentiment-analysis

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.