Jump to content

[UPDATE] Python project - I made a Twitter bot that will tell you if your tweets are more like Donald Trump or Hillary Clinton.

To use the twitter bot mention or tweet @trigger_me_bot on Twitter. This bot is an implementation of a project I am working on for my final year project on an engineering degree.

Code for the main project and the bot found here

 

I'm more than happy to answer any questions or take suggestions, apologies in advance for my awful (lack of) naming convention and code style that is the result of me hacking this project together for now.

 

Update 26/02/17

 

The bot now uses proper machine learning in the form of latent semantic analysis and a support vector machine classifier.

Give it a go here https://twitter.com/trigger_me_bot

Data Scientist - MSc in Advanced CS, B.Eng in Computer Engineering

Link to comment
Share on other sites

Link to post
Share on other sites

If I said "build a wall, we should create a no-fly zone." Who would it more be like?

Specs v-v

Spoiler

Cpu: Ryzen 9 3900x @ 1.1v / Motherboard: Asus Prime X570-P / Ram: 32GB 3000Mhz 16-16-16-36 Team Vulcan (4x8GB) / Storage: 1x 1TB Lite-on EP2, 2x 128GB PM851 SSD, 3x 1TB WD Blues / Gpu: GTX Titan X (Pascal) / Case: Corsair 400c Carbide / Psu: Corsair RMi 750w / OS: Windows 10

Spoiler

I'm lonely, PM me to be my friend!

 

Link to comment
Share on other sites

Link to post
Share on other sites

1 minute ago, Ashiella said:

If I said "build a wall, we should create a no-fly zone." Who would it more be like?

Funnily enough it's Hillary Clinton, mainly because for the time period the bot was trained on both candidates talked about walls but Trump tends to use personal pronouns (I, me, he she) whereas Hillary tends to use plural pronouns (We, us, they)

Data Scientist - MSc in Advanced CS, B.Eng in Computer Engineering

Link to comment
Share on other sites

Link to post
Share on other sites

2 minutes ago, tlink said:

pretty cool project, i like it

Thank you!

Data Scientist - MSc in Advanced CS, B.Eng in Computer Engineering

Link to comment
Share on other sites

Link to post
Share on other sites

Does/Did it update via their twitter automatically or did you have to add tweets to a file manually?

Link to comment
Share on other sites

Link to post
Share on other sites

2 minutes ago, Wrb said:

Does/Did it update via their twitter automatically or did you have to add tweets to a file manually?

It does so automatically. The Twitter api and Tweepy library let me monitor what is called the 'Twitterstream' these tweets are input to my program, processed and classified then the result is tweeted back out at the person who sent the tweet.

Data Scientist - MSc in Advanced CS, B.Eng in Computer Engineering

Link to comment
Share on other sites

Link to post
Share on other sites

Being super awkward on social media vs posting memes

 

 

Link to comment
Share on other sites

Link to post
Share on other sites

2 minutes ago, Mooshi said:

Being super awkward on social media vs posting memes

I think twitter is the best place because all awkwardness gets lost and forgotten about pretty quickly!

Data Scientist - MSc in Advanced CS, B.Eng in Computer Engineering

Link to comment
Share on other sites

Link to post
Share on other sites

1 minute ago, randomhkkid said:

I think twitter is the best place because all awkwardness gets lost and forgotten about pretty quickly!

It eventually turns into memes, the circle of meme :D

 

 

Link to comment
Share on other sites

Link to post
Share on other sites

2 minutes ago, Mooshi said:

It eventually turns into memes, the circle of meme :D

Long live the meme

Data Scientist - MSc in Advanced CS, B.Eng in Computer Engineering

Link to comment
Share on other sites

Link to post
Share on other sites

17 minutes ago, laminutederire said:

Have you examined classifying errors? 

If so, how accurate is it? :)

Yeah I'm getting about 70% correct classification, trying to improve it by moving to a k-nearest neighbour classifier.

Data Scientist - MSc in Advanced CS, B.Eng in Computer Engineering

Link to comment
Share on other sites

Link to post
Share on other sites

2 minutes ago, randomhkkid said:

Yeah I'm getting about 70% correct classification, trying to improve it by moving to a k-nearest neighbour classifier.

That was what I was about to suggest :)

At least you may have an idea for the similarity to use in knn, based on what works best currently! I don't know much about neural networks so I won't suggest much about that, but have you thought of using a good kernel for a classifier using SVM?

70% is not bad anyway at least :)

Link to comment
Share on other sites

Link to post
Share on other sites

7 minutes ago, laminutederire said:

That was what I was about to suggest :)

At least you may have an idea for the similarity to use in knn, based on what works best currently! I don't know much about neural networks so I won't suggest much about that, but have you thought of using a good kernel for a classifier using SVM?

70% is not bad anyway at least :)

You're spot on! I plan on seeing how k-nn turns out then from there using something PCA or LDA to try and reduce dimensions then implement an SVM or neural net if I have time.

Data Scientist - MSc in Advanced CS, B.Eng in Computer Engineering

Link to comment
Share on other sites

Link to post
Share on other sites

19 minutes ago, randomhkkid said:

You're spot on! I plan on seeing how k-nn turns out then from there using something PCA or LDA to try and reduce dimensions then implement an SVM or neural net if I have time.

Your own implementations or will you transform the data to fit in scikit learn algorithms ? 

For the second option , I know I'd first try to select relevant occurrences of words or expressions to have finite vectors. That's where neural networks could be a good idea, not to have to rely on meta data or to update the model easily

Link to comment
Share on other sites

Link to post
Share on other sites

16 minutes ago, laminutederire said:

Your own implementations or will you transform the data to fit in scikit learn algorithms ? 

For the second option , I know I'd first try to select relevant occurrences of words or expressions to have finite vectors. That's where neural networks could be a good idea, not to have to rely on meta data or to update the model easily

I'm still unsure, I'm new to all of these techniques so my understanding doesn't quite match my ambition yet. I'll need to research the different options and see if they are viable for implementation in time for my project presentation.

Data Scientist - MSc in Advanced CS, B.Eng in Computer Engineering

Link to comment
Share on other sites

Link to post
Share on other sites

Thread was moved to Programs Apps and Website section

If you need help with your forum account, please use the Forum Support form !

Link to comment
Share on other sites

Link to post
Share on other sites

52 minutes ago, randomhkkid said:

I'm still unsure, I'm new to all of these techniques so my understanding doesn't quite match my ambition yet. I'll need to research the different options and see if they are viable for implementation in time for my project presentation.

Well I can explain you a few things if you want and need! Is this part of a machine learning course ? 

Link to comment
Share on other sites

Link to post
Share on other sites

1 hour ago, laminutederire said:

Well I can explain you a few things if you want and need! Is this part of a machine learning course ? 

I may take you up on that in the future, thanks! It's a final year project for me, so I'm guided in terms of ideas but implementation and theory is up to me unless I actually ask for it. 

Data Scientist - MSc in Advanced CS, B.Eng in Computer Engineering

Link to comment
Share on other sites

Link to post
Share on other sites

10 hours ago, randomhkkid said:

I may take you up on that in the future, thanks! It's a final year project for me, so I'm guided in terms of ideas but implementation and theory is up to me unless I actually ask for it. 

I only followed an introductory course in machine learning so I'm solid on everything but neural networks. For those I only know the basic theory, but I lack the implementation skills.

That being said we used scikit learn a lot!

Quote me here or send a pm when needed :)

Link to comment
Share on other sites

Link to post
Share on other sites

  • 3 weeks later...
On 2/10/2017 at 7:56 AM, laminutederire said:

I only followed an introductory course in machine learning so I'm solid on everything but neural networks. For those I only know the basic theory, but I lack the implementation skills.

That being said we used scikit learn a lot!

Quote me here or send a pm when needed :)

Thought I'd update you. I managed to make a load of progress and now the Twitter bot uses a support vector machine to classify the tweets that have been processed for Latent Semantic Analysis. On to neural networks for me! :D

Data Scientist - MSc in Advanced CS, B.Eng in Computer Engineering

Link to comment
Share on other sites

Link to post
Share on other sites

6 hours ago, randomhkkid said:

Thought I'd update you. I managed to make a load of progress and now the Twitter bot uses a support vector machine to classify the tweets that have been processed for Latent Semantic Analysis. On to neural networks for me! :D

Have you tried other algorithms? How does it perform?

Link to comment
Share on other sites

Link to post
Share on other sites

8 minutes ago, laminutederire said:

Have you tried other algorithms? How does it perform?

Yep! I built a k nearest neighbour algorithm that performed at around 65 to 70% accuracy on a PCA/SVD reduced training and test set. My current SVM implementation has been tuned to roughly 87% accuracy for the same data. I need to go back and run comprehensive tests to compare my different algorithms but i'm hoping a neural network can get me into the 90s

Data Scientist - MSc in Advanced CS, B.Eng in Computer Engineering

Link to comment
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×