AI YouTube Comments - Computerphile

Computerphile · Beginner ·📐 ML Fundamentals ·8y ago

Key Takeaways

The video demonstrate generating YouTube comments with a neural network trained on YouTube comments using techniques from deep learning and neural networks.

Full Transcript

Michael these YouTube comments you've got on your screen it no these are completely fake comments that I've generated using a neural network so I've trained it on YouTube comments for computer file so basically I've read a lot of computer file comments and now I'm generating semi plausible new comments but talk about Linux and crappies and Java for example all kinds of semi plausible things but not really if you actually read it let's talk a bit about recurrent neural networks we've covered neural networks a few times on our videos on machine learning deep learning convolutional neural nets Google deep dream and this sort of thing a lot of people are doing research in neural networks now and some of them are doing things like natural language processing so things like trying to predict sentences or work out sentiment analysis from sentences so things like is this sentence a happy sentence or sad sentence if it's an angry tweet or a relaxed tweet right I'm going to very briefly recap but I would advise people to go back to these other videos first so if you've got a neural network and you're trying to make some prediction on some text or anything sequential really so we've got various you know links going up here and like this and we put in something in this side let's say a sentence and we want to predict something about that sentence maybe what the next word is going to be or whether or not the sentences are positive or negative one also you know this sort of thing the problem is that this is a very fixed structure it's not very good at sequential data you can imagine I might put the first letter in here and the second letter in here and the third letter in here and as long as all my sentences have the exact same length and the exact same structure that kind of thing work but as soon as things start to move around a bit like words but we're looking for like the first name of the person in the sentence or the subject it's going to become much more difficult so let's imagine you know using that example that I'm trying to predict the subject of a sentence based on some sentences alright so I've collected together lots and lots of sentences and I've got lots and lots of the subject of that sentence and I put all the sentences in and try and learn the subject the problem is that the subject moves around in the sentence sometimes it's over here sometimes it's over here so this network has got quite a difficult job to learn not only how to determine what the subject is but also how to do that when it could be anywhere so you might say you know I went to the park on Tuesday right but you might also say on Tuesday I went to the park so if you're trying to predict when you went to the park you've got to learn a little slightly that's more complicated than you perhaps first think so what we really want to try and do is is put in sequential data we want to put in one word or one letter at a time and then try and make decisions on that so we need some way of examining this over time so if we simplify this into a sort of a different slightly different structures let's imagine we're training a very simple neural network to take characters let's say T H E and produce a guess as to what the Nets character will be that way we can work out things like what a likely word we could also for example have an output that measures sentiment analysis because it's starting to generate and work out the structure of words so let's say our input is T and then H and then e in a row right so we have our input nodes here of our network we have our hidden nodes and we have some kind of learn mapping between these two things and then we have an output which is our prediction of what the next character will be all right now in a normal neural network situation although you know this is I've turned this now on its side a bit essentially what we're trying to do is say well look our output here is H or it should be H so we go forward to the network we see whether it gets his age and we essentially calculate a loss and say well that wasn't very good you thought it would be Zed and so we then adjust these weights here to try and make that a little bit better the problem with this sort of structure is that we're only ever trying to make a decision based on one character input so you know that the letter that follows e is going to differ depending on what the other letters are you know it isn't always going to be an A or a T or something else this is inherently going to struggle with this kind of problem so what we do is we also want to bear in mind what we've seen before we want to say we've seen an H but we've also seen a t previously can we make a better decision about what our output will be all right and we do that by basically making more weights and connecting up these hidden layers like this this is essentially a recurrent new network this is school of the expanded unrolled structure but it's the same kind of principle when we first start this H is zero we put in a T and it goes well I'm predicting given a T what the most likely debtor is it could be an H it could be an a could be lots of different things all right so we make it we make an attempt at guessing here we don't know very much we put in an H and we say well we've already seen a T and we know about because it's stored somewhere in this hidden area so maybe we can make a slightly better guess right we've seen a T now we've seen an H so you know it could be an e next further or it could be an A for that like that kind of kind of guess it's unlikely to be a Zed you know unless people make lots of typos we can predict maybe that this could be an e next they want you actually do see an e now and so we can put in here and say well we look we saw a t we saw an H now we're seeing an e can we make it really any more informed decision as to what's going on next and it turns out we can so we can say well it could be a space because it may be where at the end of the word or it could be an a because this is the word is theater or an N because the word is then there's lots of different ideas it could be but you can imagine if this was very long we could be bringing in words from previously as well so we could say well look and is what makes more sense than and then actually it's not truly doesn't really make more sense it depends only you've got you have more sentence the more sentence you have the more powerful your your your prediction is going to be and what its will actually predict is basically the likelihood of the next letter so it will say given th e I think the next output has a 10% chance of being an A or put a 50% chance of being a space right and some other chances are being other characters maybe you get the idea the only other interesting thing about recurrent neural networks is that the weights here and here and here are shared so they are the same because otherwise this one here would always be learning what it is to see the first character and this one would be you know seeing the first two characters it doesn't generalize very well so what we do is when we when we train this network up we actually train these hidden neurons to predict in the general case of wherever they are in the sentence and that makes them really good at varying the length of the input right so this works really well for YouTube comments for example because they're often different links they might have a similar structure but they're very very diff link's so I thought have moved off my sentiment analysis and you know word prediction kind of thing to a kind of character level low level thing but you could imagine if you just ignored these outputs here and we have only one output at the end of a sentence you could try and predict something like a sentiment of a sentence whether it's a happy one or predict the subject of a sentence or something like that right so natural language processing lends itself quite well to this kind of idea so I've trained one of these up and I thought well what I want to do is do some word prediction there's lots of fun examples online and we'll link a blog a really good blog post in the comments of some really fun examples of predicting text right you can basically create a neural network that does this and then basically just start generating random text it's quite fun so I thought what text do I have access to which will be fun to generate and then I realize that we have access to all the YouTube comments for computer file write all the historic YouTube comments for computer file so what I've done is I've downloaded all the comments since the beginning of computer file and I've put them into a network a little bit like this and try to get it to predict more words and it has a stab right so let's have a look and see what it does so yeah so this is one of our machine learning servers so I borrowed to just trade up this with the common network the machines name is Deadpool and you're welcomed by and asked about Deadpool when you log him time well-spent as far as I'm concerned now it's the only server that does it no one else seems to be interested now what I described just now is is overcoming your networking it's sort of traditional form the modern neural networks that we use to do this a slightly more powerful called long short term memory networks we'll cover maybe the architecture of those in a different video but that's what I've trained here ok so you know YouTube comments come with things like timestamps and what their comment ID is and who they've applied to and things like this I decided not to make the my life too complicated so I got rid of most of that and the structure broadly speaking is the word comment then in brackets the person who commented like cheese er diggity here then a colon and then what they actually said right so I haven't done any kind of filtering of expertise and things like this so let's hope nothing comes up but I have done some things like we move slightly odd characters and things like this just to make and make it a bit different you've got to think that if you're training your neural network you have to output nodes for every possible character so the fewer of those you have the easier it'll be the most recent comment would be will be these but of course I scrape these off a couple of weeks ago and so maybe some more people have commented since then now I've trained this network up and basically you know I left it running for a few hours and what we're doing is we're putting in strings of text and having it learn what the next characters are likely to be all right so when it sees TIG it's probably going to see a space or an N when it sees comment space it's probably going to put in a starting bracket because that's the beginning of a comment it's this kind of rules and then what we can do is want as trained we can basically just ask you to keep spitting out text based on the most probable letters so we start it off we say right go and it says well there's a there's there's probably a fairly high chance that the first letter is a d let's say so it puts puts out a D and then it goes well given that we've seen a d the next letter is probably an A let's say but it could be an E or it could be an R so and we pick one at random based on how likely they are so we're always a basically typing at random based on the suggestions of this network and it produces semi plausible text I mean it is nonsense but it's also not totally stupid so let's see what it does based on my pre train Network I'm going to produce five thousand characters of random text and let's see what it looks like so we'll just boot up for a minute and then it will run it's pretty quick once it gets going there we go so you can see we've got comments we've got replies at first glance it looks plausible when you actually read into the comments they're very bizarre let's pick a couple and see us I so so this guy by blocky thought now that might be a real person but it probably is just a completely made-up username I was know pretty puzzling the code gaming so they would have found out something tred the largest stop information I filled this guy Hetzel 200 as replied I find your own difference I found certainly haha use useful usually a and so full stop I mean it's got the punctuation correct right it's finishing sentences with four stops let's try again it was a long one there there is so some of them are very long New Orleans is who I match it humans but for cooling of the most complex or magnetic consistent brackets like a computer to expect founding creating organizations the interesting thing about this is that so sometimes you'll say gets looking at YouTube mine to let you stand out now the sentence doesn't really make sense but the words were actually spelled correctly and YouTube for example has a capital y in a capital T which is you know quite clever it's learned that usually when you should is seen there's a capital y and capital t but we're not picking the most likely letter at every time we're picking one of the plausible possibilities so sometimes it's going to pick the wrong one so up because of the way we're sampling so it might say we've seen a y ou u tu B if there's a 99% chance of an e but there's also a 1% chance of a space and so it'll put in the space that 1% of the time so sometimes you're going to see typos basically using this approach what another interesting thing is the reply sometimes specify the target of the reply with this plus plus another username also probably messed up this username ice metal Punk appears quite a lot in my output now I actually think that that's a real user name so if you're watching you know congrats you've posted so many times in our comments but my network has learned your name and is now just generating your comments for you it's this is quite fun right this alone it is I mean I'm quite impressed by this people might be thinking well it's just generating nonsense but you've got to consider if this is quite a small neural network looking at the random stuff on computer file comments bearing in mind lots of different types of people commenting lots of different video content and it's learned a kind of broad structure for a comment system it's got comments it's got replies it's tagging people in replies it's making up usernames it's learned some people's usernames I mean it's it's surprisingly impressive in the blog post that I link to there's some some other really impressive examples of sort of things these things can do this has got uses in things like natural language processing but convolutional versions of these things are starting to see use in image processing as well can we for example start to do things over video sequences or over three-dimensional data things like this so L STM's and recurrent neural networks are going to see a lot of use going forward because they can do some really impressive things over time oh look so that's interesting is that it gone wrong yeah people tend to put numbers in a row let's say when they're typing out you know big numbers or something like that so when it starts with numbers it tends to just get stuck in a loop just producing more numbers it doesn't happen very often but it doesn't happen this is not infallible as you might have noticed from the grammar but could this be used as a chatbot or something like that I mean theoretically you could yes the text I've trained this on is far too bored in some sense to make a reasonable chatbot because clearly none of it makes any sense I mean you might get the occasional sentence of kind of makes sense or seems a bit like broken English but it's not very useful if you targeted this though at let's say someone's own emails if we start to probably generate quite plausible emails of theirs or suggest words for so for example for auto-completion purposes usually what we would be using this kind of thing is not the necessarily generating text but to make some decisions based on what it's seen so it's because it can chained together all of these kinds of sentences you could think it's starting to look at least 50 or 100 characters into the past we can start to maybe use sentiment analysis or do predictions of of a kind a sentence or the content of a sentence this is the kind of practice perhaps more practical purposes of this apart from just a bit of fun I like this one great video see now it now we're getting somewhere computer file sounds more helpful than than what it doesn't go into detail he's working with the phone customisation I mean we know we're not ready to take over the world with this network yet but you know one step at a time people complain about my fingerprints on my monitor when I have it off but I haven't cleaned it yet because I lazy right under thought by now with all these views on YouTube you'd have someone to clean that for you but and yet no one's appeared unbelievable I know there is a reply from computerphile though if you notice where was that then about five lines up oh and as I'm from the PI from Professor Dave B as well

Original Description

Generating YouTube comments with a neural network trained on YouTube comments. What could possibly go wrong? Dr Mike Pound replied to our comment... EXTRA BITS: https://youtu.be/PpYJcrNCP3U Neural Networks & Deep Learning: https://www.youtube.com/playlist?list=PLzH6n4zXuckoezZuZPnXXbvN-9jMFV0qh Andrej Karpathy Blog post mentioned by Mike: http://bit.ly/C_Blog_RNN Code that Mike used to create this: http://bit.ly/C_RNN_Code http://www.facebook.com/computerphile https://twitter.com/computer_phile This video was filmed and edited by Sean Riley. Computer Science at the University of Nottingham: http://bit.ly/nottscomputer Computerphile is a sister project to Brady Haran's Numberphile. More at http://www.bradyharan.com
Watch on YouTube ↗ (saves to browser)
Sign in to unlock AI tutor explanation · ⚡30

Playlist

Uploads from Computerphile · Computerphile · 0 of 60

← Previous Next →
1 Follow the Cookie Trail - Computerphile
Follow the Cookie Trail - Computerphile
Computerphile
2 EXTRA BITS - Follow the Cookie Trail - Computerphile
EXTRA BITS - Follow the Cookie Trail - Computerphile
Computerphile
3 Musical Floppy Drives - Computerphile
Musical Floppy Drives - Computerphile
Computerphile
4 The Hair Algorithm - Computerphile
The Hair Algorithm - Computerphile
Computerphile
5 Getting Sorted & Big O Notation - Computerphile
Getting Sorted & Big O Notation - Computerphile
Computerphile
6 Quick Sort - Computerphile
Quick Sort - Computerphile
Computerphile
7 Hyper History and Cyber War - Computerphile
Hyper History and Cyber War - Computerphile
Computerphile
8 Entropy in Compression - Computerphile
Entropy in Compression - Computerphile
Computerphile
9 Original Elite on the BBC B - Computerphile
Original Elite on the BBC B - Computerphile
Computerphile
10 IP Addresses and the Internet - Computerphile
IP Addresses and the Internet - Computerphile
Computerphile
11 A Career in Video Games - Computerphile
A Career in Video Games - Computerphile
Computerphile
12 Error Detection and Flipping the Bits - Computerphile
Error Detection and Flipping the Bits - Computerphile
Computerphile
13 Programming BASIC and Sorting - Computerphile
Programming BASIC and Sorting - Computerphile
Computerphile
14 Birthplace of the World Wide Web - Computerphile
Birthplace of the World Wide Web - Computerphile
Computerphile
15 Punch Card Programming - Computerphile
Punch Card Programming - Computerphile
Computerphile
16 Programming Paradigms - Computerphile
Programming Paradigms - Computerphile
Computerphile
17 CERN Computing Centre (and mouse farm) - Computerphile
CERN Computing Centre (and mouse farm) - Computerphile
Computerphile
18 Error Correction - Computerphile
Error Correction - Computerphile
Computerphile
19 Home-Made Code - Computerphile
Home-Made Code - Computerphile
Computerphile
20 Security of Data on Disk - Computerphile
Security of Data on Disk - Computerphile
Computerphile
21 Gesture Controls - Computerphile
Gesture Controls - Computerphile
Computerphile
22 How Intelligent is Artificial Intelligence? - Computerphile
How Intelligent is Artificial Intelligence? - Computerphile
Computerphile
23 Encryption and Security Agencies - Computerphile
Encryption and Security Agencies - Computerphile
Computerphile
24 Virtual Machines Power the Cloud - Computerphile
Virtual Machines Power the Cloud - Computerphile
Computerphile
25 Hacking Websites with SQL Injection - Computerphile
Hacking Websites with SQL Injection - Computerphile
Computerphile
26 How Huffman Trees Work - Computerphile
How Huffman Trees Work - Computerphile
Computerphile
27 Cracking Websites with Cross Site Scripting - Computerphile
Cracking Websites with Cross Site Scripting - Computerphile
Computerphile
28 Cloud Computing (Cloudy with a Chance of Pizza) - Computerphile
Cloud Computing (Cloudy with a Chance of Pizza) - Computerphile
Computerphile
29 Texting Cabbage with a Recorder - Computerphile
Texting Cabbage with a Recorder - Computerphile
Computerphile
30 Hashing Algorithms and Security - Computerphile
Hashing Algorithms and Security - Computerphile
Computerphile
31 How YouTube Works - Computerphile
How YouTube Works - Computerphile
Computerphile
32 How NOT to Store Passwords! - Computerphile
How NOT to Store Passwords! - Computerphile
Computerphile
33 A New Golden Age of Video Games - Computerphile
A New Golden Age of Video Games - Computerphile
Computerphile
34 A Universe of Triangles - Computerphile
A Universe of Triangles - Computerphile
Computerphile
35 Cross Site Request Forgery - Computerphile
Cross Site Request Forgery - Computerphile
Computerphile
36 The True Power of the Matrix (Transformations in Graphics) - Computerphile
The True Power of the Matrix (Transformations in Graphics) - Computerphile
Computerphile
37 The Great 202 Jailbreak - Computerphile
The Great 202 Jailbreak - Computerphile
Computerphile
38 EXTRA BITS - Printing and Typesetting History - Computerphile
EXTRA BITS - Printing and Typesetting History - Computerphile
Computerphile
39 Triangles to Pixels - Computerphile
Triangles to Pixels - Computerphile
Computerphile
40 The Problem with Time & Timezones - Computerphile
The Problem with Time & Timezones - Computerphile
Computerphile
41 The Visibility Problem - Computerphile
The Visibility Problem - Computerphile
Computerphile
42 Lights and Shadows in Graphics - Computerphile
Lights and Shadows in Graphics - Computerphile
Computerphile
43 The Penguin Barcode - Computerphile
The Penguin Barcode - Computerphile
Computerphile
44 Typesetters in the '80s - Computerphile
Typesetters in the '80s - Computerphile
Computerphile
45 The Font Magicians - Computerphile
The Font Magicians - Computerphile
Computerphile
46 The Little Mac with the Big Bite - Computerphile
The Little Mac with the Big Bite - Computerphile
Computerphile
47 EXTRA BITS - More on the Original Mac at 30 - Computerphile
EXTRA BITS - More on the Original Mac at 30 - Computerphile
Computerphile
48 XP to Ubuntu with an 8yr old Hacktop - Computerphile
XP to Ubuntu with an 8yr old Hacktop - Computerphile
Computerphile
49 EXTRA BITS - Hacktop Real-Time Boot Comparison - Computerphile
EXTRA BITS - Hacktop Real-Time Boot Comparison - Computerphile
Computerphile
50 EXTRA BITS - Making a Bootable USB in Linux - Computerphile
EXTRA BITS - Making a Bootable USB in Linux - Computerphile
Computerphile
51 EXTRA BITS - Installing Ubuntu Permanently - Computerphile
EXTRA BITS - Installing Ubuntu Permanently - Computerphile
Computerphile
52 The Dawn of Desktop Publishing - Computerphile
The Dawn of Desktop Publishing - Computerphile
Computerphile
53 What is Bootstrapping? - Computerphile
What is Bootstrapping? - Computerphile
Computerphile
54 Reverse Polish Notation and The Stack - Computerphile
Reverse Polish Notation and The Stack - Computerphile
Computerphile
55 Home-Made Z80 Retro Computer - Computerphile
Home-Made Z80 Retro Computer - Computerphile
Computerphile
56 Should Everybody Learn to Code? - Computerphile
Should Everybody Learn to Code? - Computerphile
Computerphile
57 Programming in PostScript - Computerphile
Programming in PostScript - Computerphile
Computerphile
58 Heartbleed, Running the Code - Computerphile
Heartbleed, Running the Code - Computerphile
Computerphile
59 YouTube's Secret Algorithm - Computerphile
YouTube's Secret Algorithm - Computerphile
Computerphile
60 YouTube Search & Discovery - Computerphile
YouTube Search & Discovery - Computerphile
Computerphile

This video teaches how to generate YouTube comments using a neural network trained on YouTube comments, and discusses the potential pitfalls of this approach. The video provides a beginner-friendly introduction to deep learning and natural language processing.

Key Takeaways
  1. Choose a dataset of YouTube comments
  2. Preprocess the data for training
  3. Train a neural network on the data
  4. Generate new comments using the trained model
  5. Evaluate the quality of the generated comments
💡 Training a neural network on a large dataset of text can generate realistic-sounding comments, but may also perpetuate biases and errors present in the training data.

Related Reads

Up next
Arrays vs Lists: What AI Actually Prefers | Common Tech Interview Questions
SCALER
Watch →