maxbbraun / trump2cash

A stock trading bot powered by Trump tweets
https://trump2cash.biz
MIT License
6.27k stars 859 forks source link

Better sentiment analysis #3

Open maxbbraun opened 7 years ago

maxbbraun commented 7 years ago

The sentiment analysis sometimes gets it wrong. It also assigns the tweet's overall sentiment to all companies, which may not be correct in some cases.

One idea would be to try targeted sentiment analysis, e.g. using the IBM Watson AlchemyLanguage API.

flaw600 commented 7 years ago

I've actually used Watson's API and would be happy to take a crack at it. Not sure at what pace that would be, but I'd be up for it

tbranyen commented 7 years ago

If you don't mind spawning a java jar and communicating with it over sockets, I worked on a project that did sentiment analysis on the 2012 presidential debate captions. You can see the implementation here (JS): https://github.com/sosolimited/recon_backend/blob/master/named-entity/index.js#L36

Not sure if it'll be helpful, but might be a little easier to start with (but certainly not as powerful as Watson).

maxbbraun commented 7 years ago

Ok, I tried both the Watson sentiment analysis and the targeted sentiment APIs.

Both perform worse than the current implementation using the GCNL APIs.

The targeted one is wrong a lot, I suspect because it just doesn't have enough words in a short tweet to work well. The non-targeted one is frequently neutral where GCNL detects the correct sentiment.

flaw600 commented 7 years ago

@maxbbraun can you share your test set of tweets and if possible your Watson implementation? My admittedly very limited testing is showing both types of sentiment being accurate

maxbbraun commented 7 years ago

@flaw600 Make the changes, run the benchmark, then look at the diff.

flaw600 commented 7 years ago

Interesting. You're correct of course. In my limited testing using tweets not used in the benchmark I noticed Watson performing better (meaning more accurately than on this set, I didn't compare against GCNL) on his most recent tweets but you're right to stay on GCNL for now. Very intriguing

labidus commented 4 years ago

For sentiment analyst, since you are using python, neural network with LSTM could be a solution Something like this : https://github.com/bentrevett/pytorch-sentiment-analysis