Podcast Lookup

Applied Artificial Intelligence

Programming Throwdown

  • June 13, 2013
  • 1 h 8 min
  • Episode 28
Episode page
About this episodeThis show covers Applied Artificial Intelligence, techniques for applying AI to work or hobby projects. Tools of the show: WebM and…

This show covers Applied Artificial Intelligence, techniques for applying AI to work or hobby projects. Tools of the show: WebM and FFMpeg. Books of the show: 2br02b http://www.gutenberg.org/ebooks/21279 and The Code Book (Kindle: http://amzn.to/14zADaL), (Paperback: http://amzn.to/11j2l7G)

★ Support this podcast on Patreon ★

Transcript

From the publisher

This transcript comes from the podcast’s own feed, shown as the publisher wrote it.

Applied Artificial Intelligence

00:00—
  1. A

    Hosting provided by Host Tornado. They offer website hosting packages, dedicated servers, and VPS solutions. HostT.net. Programming Throwdown, Episode 28: Applied Artificial Intelligence. Take it away, Patrick.

  2. B

    Wow, nice. All right, so this episode we're going to skip the news.

  3. A

    Yep.

  4. B

    Because we've got a lot to talk about. Definitely. And then also, you know, I'm not sure whether everybody likes the news. And by the time we release it, it's not always fresh news. It's not new, it's old. So it's much more just our discussion. But we have a lot of feedback, so I want to talk about that. So first of all, thank you everybody for sending us feedback, you know, via email, comments on the Google Plus post, comments on our, I don't know how many comments on our blog, really. Yeah, one.

  5. A

    Thing we—well, at least I haven't been really following the G+ page. I've kind of abandoned that in favor of the G+ Community, which I feel like kind of has a better UI. So definitely post on the Community. You know, we've gotten a lot of posts about, you know, new languages like Haskell. Well, not new languages, but the language that we haven't covered. That's right. And so we definitely take those seriously, and there will be definitely a Haskell episode this season. And so where?

  6. B

    A season is an indeterminate number of episodes.

  7. A

    Actually, we should probably figure out how long the season goes. It's okay. I don't know how they do it in the movies.

  8. B

    It's arbitrary. It's arbitrary. So anyways, but thank you for your feedback. Yeah. We really appreciate it. And sorry, we don't always reply to everybody. We're, you know, got busy, crowded email inboxes like it. But we do read them. We do see them. We do appreciate even the people who tell us we're wrong. That's okay. We don't mind.

  9. A

    Yeah, we appreciate constructive criticism.

  10. B

    Or deconstructive criticism. I don't appreciate it, but it's okay. We read it and smile.

  11. A

    A couple of people said something like, 'Oh, you'd be much better off listening to my podcast.'

  12. B

    than you're going

  13. A

    To start, which that's how you know you've made it.

  14. B

    Yeah, maybe. So speaking of that, I checked, and we have 107, as of this recording, podcast reviews in iTunes. Nice. Thank you all. I know not all of you listen via iTunes or iOS devices, and so I know that's not nearly representative of the total amount of people who are giving us love. But we really do appreciate that feedback. We noticed, actually, even though we had a big break before last episode and this episode, that people are still finding the podcast. You know, we're building up a set of topics which people are interested in. So if you're new, welcome. Yeah. But we're definitely building up people, and it's growing over time. And so, like, that definitely keeps Jason and I interested and engaged in recording each interval. Yeah.

  15. A

    So just some stats. Last month, our stats actually went down because the website was down. So if you were following our G Plus community, you know, you knew about that. We had an issue with our ISP. That took a couple weeks or a week or so to resolve. But before that, we were hitting 1.2 terabytes a month of bandwidth. So you guys are definitely downloading a lot of episodes. So which

  16. B

    One of you is downloading just like 1,000 of them?

  17. A

    Yeah. Well, according to FeedBurner, we have over 2,000 unique subscribers. Nice. So totally awesome. You know, definitely, you know, we had 2,000 subscribers and 100 comments. So a lot of you out there, if you're shy, don't be shy. Tell us what you think we could do to make the show better. A couple of people have given us advice, like, you know, don't do the news every time because it starts to get old. And we take that advice very seriously.

  18. B

    Yeah. And there's a fine balance there. Like, we don't listen to everybody's advice. Like, no offense. Like, we do appreciate the advice. Feel free to share. And we do try to listen to, you know, if a lot of people are saying something. But, you know, this is Jason and my podcast. That's horrible grammar. I'm sorry. But this is our podcast. And so, like, you know, at some level, we want to keep it what we want to be. Like, we need to keep doing it, right? So we have to do something that we like doing. Yeah. So, you know, don't feel, like, offended if you have, like, oh, I really want to talk about this or that, and Jason and I aren't really into it. Then, you know, we may not talk about it because, you know, we won't give it passion. We want to be passionate about what we do.

  19. A

    Yeah, definitely. It's sort of a blend between, you know, getting feedback from the community and making the best possible show from the community. But also, you know, doing something that we're knowledgeable and staying true to ourselves too. And so, yeah, it's a fine line. But we definitely, that's the line we want to walk because your feedback has made the show much, much better.

  20. B

    Yeah. So thank you for all the iTunes love. If you're into such things, please rate us on iTunes. That would be awesome. We do appreciate it. It makes us feel good. So one of our listeners, Neil, wrote in to recommend a TV show that he appreciates. I thought I was going to get, like, an awesome sci-fi recommendation. But this maybe in some ways is cooler. He recommended a cooking show, America's Test Kitchen. And I have actually watched this show a number of times. I don't watch it every episode. But this comes on PBS. So public broadcasting station or whatever. Everybody's got their own different one locally, at least here in the United States. And maybe it's online if you live in another country. Because we do actually, Jason shared the stats with me as well. A lot of you are in the United States, but there are a lot of people who listen and aren't in the United States. And that's really awesome as well.

  21. A

    Do you know how to say hello in German? I'm going to look it up.

  22. B

    No. Okay. I'm going to look it up. So while he looks that up, I'm going to tell you about America's Test Kitchen. So Neil said that they kind of try to develop an algorithm for cooking. And I agree. I think they—it's not a techie show. But if you ever have watched a cooking show and it's like, ah, a pinch of this, a pinch of that. These people try to say like, let's try five different ways to batter a piece of chicken and really get the—we really determine people like crispy skin that sticks good and is about medium thickness. So like what can we put in, even if it doesn't make a lot of sense, that really makes that work. And they try to like try various combinations as opposed to just kind of, you know, you'll know when it's good. So I do appreciate that. That's kind of interesting take. So thank you, Neil.

  23. A

    I haven't seen that show yet, but I'll definitely check it out.

  24. B

    Yeah. I mean, all of us have to eat. So that means some of us at least cook some of the time. So definitely interesting. Yeah.

  25. A

    So our two—the two number—number two and three most popular countries for Programming Throwdown viewership are Japan and Germany, respectively. Nice. So konnichiwa to our Japanese friends and hallo to our German friends.

  26. B

    Why are you laughing?

  27. A

    No, I'm laughing because it's so close to English. I just—at first I thought that Google was playing games with me because it wasn't an actual search result. I put hallo in German and it went straight to Google Translate. And it just said 'hallo,' and I thought that something had gone horribly wrong.

  28. B

    Okay. So maybe we'll talk about machine translation today. Yeah. How apropos. So thank you guys out there listening all over the world. And please forgive Jason if he said that poorly. So Travis wrote in to discuss. He had a number of good comments and points. But he was also saying, 'You know, like, you know, hey, you guys got a lot of episodes. I'm listening to some of them. But, you know, it's kind of hard to, you know, understand, like, when I have a new project, like, what language should I write it in?' And this is something like Jason and I discussed a little. And it's like, yeah, you know, it's a hard question. But sometimes, you know, and I won't steer your point. But my point is, like, it is true. Like, sometimes you can get bogged down, though, like, trying to figure out too much analysis. Like, what do I want to do? And we do cover a lot of languages. There's not really a good format for us to, like, cover every, like, application of the language as episodes that you can then see your choices. And, like, many things in life, there's more than one way to solve the problem. Some ways are better than other ways. But between two choices, like, even if the man or Google or the Internet or whatever says that, like, 'You know, this way is the best,' like, you should always do it this way. That's just over opinionated people for the most part. Because for you, the best way is dependent on you completely. If you know a language and there isn't an obvious reason why it won't work in that language, you know, go for it. Like, maybe that can be the best learning experience for you is to try it in that language. And that's often how new languages get created. You know, people find shortfalls in what's there. But definitely it's, like, your personal situation. And, like, don't—and I think I get stuck in this rut a lot. Like, you go online, you're, like, looking up, like, 'I want to buy a, you know, new pair of pants.' Oh man, this pair of pants has, like, three-star reviews. You know, like, oh, it's terrible, too. But it's, like, wait, wait, hang on, hang on a second. First of all, it's just a pair of pants. Like, it doesn't really matter. Second of all, it's, like, those people could be very different than me. Like, if they all talk about the fit. But I don't know what they – like, their body type may be very different than my body type. So, like, that advice doesn't always apply to me. So just a general, you know, big caveat to the Internet in general and advice on the Internet, you know. Just remember, take it with a grain of salt because everybody's situation is different. Yeah, definitely. So what are your

  29. A

    thoughts? Yeah, so Patrick's absolutely right. You should just dive into it. Pick a language that, you know, you feel comfortable with or one that would be fun to learn if it's a project you're doing for fun. And jump into it. And you'll either learn why that was a bad choice, which is really interesting to find out. Or most likely, you will do fine in that language. It might not be the most efficient, you know, but you can get almost anything done in any language for the most part. So the only thing I would want to add is think about your audience, right? So, well, two things. One, think about your audience. So if you're, you know, wanting this to be a web app, then, you know, JavaScript obviously is going to play a pretty heavy role. If you're wanting this to be some kind of like server, backend kind of thing that's going to serve, you know, thousands of customers, then you'll want to use C++ or Go or Java or something similar, right? So you have to think a little bit about your target audience. The other thing is, you know, know that, you know, you can have two programs written in two different languages communicate. You know, we talked in our IDL episode about, you know, Thrift and protocol buffers and things like that. So, you know, if it turns out you write it in Lisp, let's say, and all of a sudden you need a web frontend, you can always do that part in JavaScript. And then use Thrift RPC or something else to talk about it, to talk to your other programs. So, yeah, don't be too worried about picking a language. Just pick one that you want to learn or one that you're most comfortable with, depending on the type of setting you're programming. And if you need to get something done quick, then pick the language you're most comfortable with. And you should be just fine.

  30. B

    So we talked about it before, so I won't overly hash it here. But, you know, also remember that a lot of us aren't writing apps that need to scale for, you know, millions of users from day one. And so you can always, you know, develop something as you go, using what you learned, leveraging what you learned in advance. And you hear about epic mistakes like, you know, Facebook doubting whether or not maybe it should have been so heavy in implementing. Or, no, I guess it was Dig. Implementing stuff in PHP and then, like, only hiring PHP programmers and, like, how this was, like, they feel like a big problem for them. It's like, well, but first of all, they're the use case. And we talked about before, like, being in that situation is somewhat, like, good situation to be in that you have so many users that you can't support the traffic anymore.

  31. A

    If you're Dig, you can just rewrite it in another language and be just fine, right?

  32. B

    Although I don't think that worked out so well for them, but.

  33. A

    And Dig had other problems. A lot of their, a lot of their, there's a whole thing about it.

  34. B

    Yeah, yeah, it's not here and there.

  35. A

    Dig's growth model was fundamentally flawed. But anyway, that's for another. Yeah, I don't think their language is what killed them.

  36. B

    No, I don't think so either. Yeah. But yeah. All right. Time for tool of the show.

  37. A

    Tool of the show. So my tool of the show is WebM. WebM. WebM. So WebM is pretty awesome. It's becoming more and more popular. It's built into Chrome and Firefox and many of these modern browsers. Basically, it's a completely open source, royalty-free, patent-free video encoder and decoder. It's in C++, but there are, you know, Java and other bindings for it. Or as we just talked about, you could have some kind of Thrift RPC server where you pass video frames to this thing and get, you know, compressed video back, etc. But WebM is pretty epic. It has better compression than H.264. So for people who aren't that familiar, if you go on, you know, YouTube, let's say, and you watch a video, you're going to watch it in H.264 format, which is this format developed by the same people who made MP3. And it has a set of patents associated with it. And I believe Google actually pays the H.264 people royalties for every video they encode. Or there's some kind of negotiation. But basically, if you want to encode video in this format, as YouTube does, you have to theoretically pay money. And all of your programs, you know, say the program that connects your camcorder to your computer and compresses video for you, they have to pay this company money. And it's kind of a racket. There's also a bunch of issues with it. You know, the source code, the code itself doesn't have very good fidelity because it's closed source, etc. So WebM gets rid of all of that. It's totally open source. People are able to edit the code, fix the code, clean it up, etc. It has an unoptimized version, which doesn't do all sorts of crazy hacks. And that unoptimized version will run in anything. Like, you can encode a video in your Raspberry Pi or on your Android phone even. That's something that's not possible with H.264. So at least, well, it is possible using something Patrick will talk about. But that's a side issue. In general, and even if it is possible, there's litigation. There's litigious issues around it. So, yeah. So definitely check out WebM if you want to do anything with video.

  38. B

    So what is the... So the reason H.264, like, part of, like, it is really popular. And there's a lot of problems with it. But now, like, it's so ubiquitous that, like, I think there's a lot of hardware associated specifically with accelerating H.264 decoding at least. Yeah. And somewhat encoding. But, you know, let's focus on decoding because the idea is you create once and watch it many times. Exactly. Hopefully, at least for, you know, internet videos or whatever. Yeah. So, like, there's a lot of hardware on low-end phones and tablets and, like, specifically to decode H.264. Right. So does WebM suffer? Like, have to do all that in software? Can it leverage? Like, is that stuff generic enough to work for WebM? Is it going to hurt adoption?

  39. A

    Yeah. So, yeah. So to your point, there are hardware chips for H.264 decoding. I don't think there are hardware chips for WebM. At least I haven't heard of it. So, yeah, it will suffer in that arena. It will use more of your battery and things like that. Right now, they're kind of targeting desktop. And so if you look at, you know, there was a presentation on Google I/O about WebM two days ago. And almost all of the presentation was focused on the desktop experience. So I think it's one of these things you, you know, on desktop, they're, you know, WebM is just better in every dimension. And so they kind of, you know, do that part of it, get the desktop right, and then start to roll out the phones with WebM and things like that. So it's still got a few years out. But if you're developing, if you're writing code, and if you're part of, you know, a pretty medium or large-sized project, you know, you could use WebM. And in, you know, 12, 18 months, the phones will probably have hardware for it. Jason

  40. B

    predicts. That's my prediction. That's my Moore's law. And if he tanks your project, it's not his fault.

  41. A

    Yeah. But even in software, it's, decoding is never really an issue. You know, if you're watching tons of YouTube video, then, yeah, I mean, your battery will suffer using WebM.

  42. B

    Well, I know on my Nexus 7, so if I, I have a video player which will tell me if it's on hardware or software decoding. And when it's on software decoding, it doesn't work as well, and the battery drains much faster.

  43. A

    Oh, really? Like, maybe

  44. B

    That's just my feeling. Like a factor of

  45. A

    Two or something? It's hard to say.

  46. B

    I mean, I never measured it empirically. It just seemed like when I was finished watching it. And maybe that's psychological because it's telling me it's on software decoding. Maybe. But yeah, I mean, I know this is an issue. I was just curious. Yeah, I mean,

  47. A

    It would make sense for them to start, you know. I know that YouTube actually has something; if you go in the settings, you can actually put on HTML5 mode. This is something that anybody can do. I don't remember exactly how you do it. It's somewhere in your YouTube settings. And then it will use WebM. And so you can actually get a sneak peek of what a non-

  48. B

    Although, based on what you just said, you're not supposed to be able to tell the difference, really.

  49. A

    Yeah, you won't really notice. But it's just kind of a cool thing to do, just saying.

  50. B

    Yeah, and I mean, it's one of these things where, like, ideally, maybe this sounds, like, better idealistically. I just, like, we'll see. I mean, practically, maybe it's, like, an adoption thing. It's, like, regardless of whether you think it's right or wrong, like, everybody uses H.264, so there's a lot of peer pressure.

  51. A

    Right, yeah. I mean, but, you know, as I mentioned, the patent thing is kind of a big issue.

  52. B

    It is, yeah. It would be nice to get rid of it.

  53. A

    Yeah, if you're writing software for a company and you're, you know, selling the software to someone else—a consumer or another company—you will have to pay this Frankenhauser. You know, you will have to pay a lot of money in royalties. So for people doing business apps and stuff, it's a serious consideration.

  54. B

    Yep, definitely. All right, well, my tool of the week—actually being a tool this week, shocker, nobody passed out—is FFmpeg. Right? So similar to Jason talking about video, I guess, is a good tie-in and encoding MPEG. And FFmpeg has an open source library, I guess, probably the most used one for decoding video, various video encodings for you when you want to play a video in an application because all of us kind of get there at some point where you want to do something. But, you know, actually what I've used it for in the past, surprisingly, is, you know, there are a set of executables that they, you know, release to do kind of decoding to various formats or raw formats or whatever. But you can, I found myself in various times for various reasons wanting to, like, take a video and, like, create all the frames from the video. So if you, like, pause the video and, like, that, but, like, you know, kind of better and, you know, like, all along. Because you may, like, have had a really good video and you want to capture a shot. Now, obviously, those shots aren't as good as, like, taking a picture with your camera. But, like, for, you know, I want to run some, like, image processing. But I don't really want to bother hooking it into, you know, like, the whole decoding the video and everything. Like, that would be nice. But if I could just get the images and do a couple of them one by one, test it, you know, for that reason. Or, you know, I created a little animation once in, I think, MATLAB. Like, a little, like, oh, I wrote out some images, like, with some variations that I was doing. And I wanted to string them together in a little video so I could give to people. As opposed to, like, oh, just, you know, click through each of these pictures. And FFmpeg could do both of those for me with just, you know, on the command line. I just run the program. And it's, like, this file with this wild card, just, like, zip them all up together into one video and code them. And then also the other, like, take a video and explode them into a bunch of files. I know that sounds weird. Maybe you've never come across that before. I've come across it a couple times. And it's invaluable to know about this project and to know, like, that it can do this.

  55. A

    Yeah, it does audio, too.

  56. B

    Keep that in mind. Oh, I didn't know that. So what kinds of things can you do with audio?

  57. A

    Like, it can convert raw audio to MP3 or vice versa. Or it supports, I think, like, Aug, Orbis, like, a bunch of other audio codecs. If you want to take a video that's in one format and change it to another, almost any format, it will support. It's pretty epic.

  58. B

    Yeah, and a lot of the tools that you would use to do that, like, open source ones, free ones, these ones, like, use FFmpeg to do the, like, that's the engine. And really all they are is helping you set up the parameters. Yeah,

  59. A

    Exactly.

  60. B

    Which can be really confusing.

  61. A

    Yeah, yeah. It's a total nightmare. All right. Book of the show. Book of the show. So my book of the show is actually a short story, not a book. That's not a book. I know. I cheated. And it's totally free. The link I provided takes you straight to a website where you can download the short story. It's pretty awesome. So the name of it literally is 2BR02B. But what it really means, and it's sort of like the British way of saying it, is 2BR not 2B. And it's a cute story. I'm not going to give anything away because, like I said, a very short story. If I give anything away, you will know the whole story. So it's a pretty funny read. It's like a kind of sci-fi dystopian feature theme. And it's got a kind of twist at the end that I thought was pretty cute. So definitely give it a read. It's only going to take maybe 10, 15 minutes.

  62. B

    Is it recent?

  63. A

    Very early adventure. No, I think it's rather old.

  64. B

    Okay.

  65. A

    But I thought, you know, I came across it when I was looking for new sci-fi stuff to read. And it was a...

  66. B

    Oh, by Kurt Vonnegut. He wrote Slaughterhouse stuff. Yeah, that's right. And other stuff.

  67. A

    So, yeah, it's pretty awesome. And you guys should definitely check it out. It's... You only waste a little time.

  68. B

    I feel like I'm going to just read it right now. And you can just keep talking for a few minutes.

  69. A

    Yeah.

  70. B

    Is it that short?

  71. A

    I think it's like five or six pages maybe.

  72. B

    Okay. So maybe. All right. I'll read fast. All right. Just pause this while I go... No, I'm just kidding. All right. So my book is The Code Book. So this is a nonfiction but wide audience, not a textbook, written by Simon Singh. I hope that's how you say his name. And this is... What do they call this? Like a popular book or whatever? Not like that it's popular and that it sells a lot. I'm sure it does. But like it's written for a general audience to cover cryptography. Oh, I see. So he takes like a very storied approach and a lot of, you know, very plain English things to the history of encoding things. Is it

  73. A

    a fiction or a

  74. B

    public? No, it's nonfiction. But like I said, it's not a textbook. Like it's not going to teach... You're not going to... You may come out knowing how to do some sorts of like basic coding, but it's not going to teach you like encoding. But some... It's not going to teach you like, you know, here's how to write a public key cryptography system securely. It's not

  75. A

    that... So like David Deutsch, Fabric of Reality. Like one of these like books

  76. B

    that sort of

  77. A

    covers something at a high, like String Theory at a really high

  78. B

    level. Yeah. Okay. That would be exactly like... It doesn't

  79. A

    Go into equations right now.

  80. B

    I would equate it to like Brian Greene's books, like The Elegant Universe or whatever, like these kinds of things. Yeah. So they're writing about it. So pretty much anybody can read it. Like it's very approachable. It's very story-oriented. A lot of analogies. But there's some really good stuff in here. And it's rather old, 2000. So it's, you know, almost 13 years old now. But I remember reading this, you know, closer to when it originally came out and haven't read it in a while. But I remember I was coming across something the other day and I was like, oh, I knew that about cryptography. I was like, I have no idea where I knew that from. And then I remember like, oh, I had gotten some of this from this book. So it talks about, you know, like ancient Egypt, you know, ciphers, queens, you know, wanting to hide secret information. And then it does cover at a high level like quantum cryptography. So again, not good enough to ever. But like what is a fundamental ideas kind of. And being 13 years old, I'm sure it's maybe not completely up to date to what's going on now. But a read, like I think these books are, people have debates like how valuable it is. Like what would you do with this knowledge? But personally, as opposed to just reading a fiction book, which like, you know, doesn't apply at all. Like reading this book, even though I may not be able to like go write encryption algorithms that I may not be able to like, you know, actually use the information in here. I mean, it's like background story to the way things are. And I find it interesting. And it gives you like little bits of things to talk to other people about or, you know, just kind of satisfy the curiosity of the mind, which I find common among people who write code.

  81. A

    Yeah, definitely. It sounds awesome. I mean, one nice thing about books like this is, you know, I'm reading a fiction book right now. I'm reading Snow Crash. And, you know, it has a lot of ties to programming and hacking and this kind of stuff. But being a fiction book, I don't really know where it draws the line.

  82. B

    Oh, yeah. I've had this before. Like, oh, it says this. I wonder if this is true or not. Yeah,

  83. A

    Yeah. But with something like this, you kind of, you know that you really like, you should believe like it's trying to tell the truth. Like you feel confident in things that you've learned. But at the same time, it's not like reading a textbook.

  84. B

    Yeah. You can just read it in the evenings or on an airplane or whatever. And it's not like, oh, man, I don't get this. Yeah, yeah. So I've read a number of books about it. Like you pointed out some about, you know, the universe or cosmology or like these kinds of things. And, you know, quantum physics, especially for some reason, is really intriguing to me. Yeah. But it's like no application to like anything I do. But it's my recommendation. I'm sticking to it.

  85. A

    You mean you're not doing quantum physics? I thought everyone in the Valley just does quantum. Oh, yeah. That's

  86. B

    in our stealth startup. I've

  87. A

    entangled our listener. Oh.

  88. B

    Now it's unknown what state they're in. Yeah. Oh, man. You have to write us and tell us so that your super state can collapse. Yeah, exactly. Oh. All right. Oh, man. So apply artificial intelligence for us, Jason.

  89. A

    Yes. Apply. So, you know, I'm sure if you're watching or if you're listening to the show in order, you saw our theoretical soapbox rant.

  90. B

    Yes. And if not, maybe you should consider going back and listening to it.

  91. A

    Yeah. I don't really know which order would be easier.

  92. B

    Oh, wait. What?

  93. A

    Yeah. Maybe you should

  94. B

    See. Should we release these in parallel?

  95. A

    Oh, that would be pretty weird. Yeah. So this one's going to be more on specifics. The goal here is what can you do in AI that's going to help you or your business or your project that you're working on, et cetera? What are some things that sort of like everyone wanting to do stuff in AI needs to know, should know to make the process go a lot smoother?

  96. B

    At least according to Jason.

  97. A

    According to Jason and Patrick. Yes. And Wikipedia. And years of experience. I mean, we've been doing AI stuff for a long time together.

  98. B

    Well, you happen to have a PhD in it.

  99. A

    Well, yeah, I've been doing it for a long time.

  100. B

    I took a couple of classes in it.

  101. A

    So the two of

  102. B

    Us. And I watched a video on YouTube.

  103. A

    The two of us worked, have been working at the same company for what, seven years?

  104. B

    A long time. Long time. Yeah, like six years. Two

  105. A

    Different companies,

  106. B

    But at the same company. Right. Oh, that was hard. We were at one company together. Now we're at a different company together.

  107. A

    Yeah. Yeah, exactly. But yeah, we've done a lot of AI stuff. We have pretty good experience we want to share with you guys. So first some common terms in AI.

  108. B

    Definitions. Yeah. Go. So

  109. A

    We'll knock these out. So first is objective function. Objective function, in a nutshell, is like a formal math function of your target. So in other words, let's say your goal is to get as many people to click on your website as possible. Yes. Pay me money. Then your objective function is the number of clicks. That one?

  110. B

    Okay.

  111. A

    You might think that might be the way to go. Like on your website, every time somebody clicks, then your website is doing better. Yes. If somebody didn't click, their website would do worse. Right. I would cry. Another thing is features. Features are the inputs to your system. So, for example, you might do, the objective function might be will this person click or not click. And the features might be, you know, what you show them. So let's say you're Twitter. So you might show people random people's tweets. Like you might say someone might go to Twitter and not go on their feed or their friend's feed. They might just go in some kind of discovery mode. Like I've actually never used Twitter, so I'm making this up. But they might go in some discovery mode on Twitter where they say just show me random people's tweets. And so the features would be, you know, the person whose tweet they're currently looking at, the text of the tweet, any hashtags written in the tweet. And the objective function would be did this person follow that person or did they respond to that tweet. Right. If they did, that's good. They did something to increase the volume of content on Twitter.

  112. B

    So it's like given these number of things to consider, how likely do I think this thing I want to happen will happen?

  113. A

    Exactly. Yeah. So those are the features. So, you know, there might be, you commonly hear the term hidden features. And that's where there's just aspects of the problem that you didn't, you know, account for. Like, for example, if your only feature is, you know, day of the year or something like that, that's your only feature, then it's going to take you a year before you can learn anything and come back to, you know, February, right, or something. So you might have hidden features that are, oh, maybe this person really likes baseball players. But that wasn't one of your features. So you're not able to learn, you're not able to match the objective function very well.

  114. B

    So hidden features aren't something you have, they're something you're missing.

  115. A

    Right.

  116. B

    But you couldn't necessarily ever have.

  117. A

    Right, exactly. Yeah, there are some features that are just, you know, maybe they're like part of the human psychology that you just aren't able to capture. So actually along those lines, there's a concept called underfitting or overfitting. And so the idea is, you know, you have this objective function, and the objective function has a certain distribution. So you want to sort of, you want to sort of capture, you want to learn this objective function. So, for example, you know, Patrick went on Twitter and he went to this tweet and he clicked on it. So if the next person does exactly what Patrick does, I want my system to learn that it expects a click, right? What can happen is it could memorize exactly Patrick. Like it could say, 'Okay, if Patrick Wheeler comes to the site and does exactly these three things, then he'll click on the tweet.' But under any other circumstance, there won't be any clicks. So it has just memorized the answers. It hasn't really understood the problem. It doesn't realize that some people like athletes and some people like et cetera.

  118. B

    So this happens a lot with stock market algorithms. Yeah. People go through the whole history of the stock market and train their algorithm on, you know, the whole history or whatever. But then as soon as tomorrow comes, just because like you back-tested it, but it already had memorized all of history. It's like a very naive problem. Like theoretically, people are not supposed to keep doing it, but everybody does it. It's like you look at the whole history of the stock market. Then you give it some piece of that from the past. And of course, it knows exactly what to do. It's seen it before. Yeah. But then as soon as you go live with it tomorrow and it sees something it's never seen before, it just flips out.

  119. A

    Yeah,

  120. B

    exactly. It does something crazy it wasn't supposed to do.

  121. A

    Yep. And so that's called overfitting. So that means that you fit the objective function so perfectly, but the real world, you know, what's going to come in the future doesn't fit the objective function. The future has a different distribution than the past. And your algorithm was in general, it was very tied to the past distribution. And so it doesn't work when you try to predict future things. That's overfitting. The way we deal with that in Machine Learning is we split the data into two sets. We have what's called a training set and a holdout set. Let's say we do like a 90-10 split. So 90% of our data goes in this training set, and then we train a model on that set. And we take the model once it's been trained and we score it on the holdout set. So this is data that it hasn't seen before. If it does really well on the 90%, but then it fails on the 10% that it hasn't seen, that's a sign that the model has overfit. And so there's various things that you can do to fix this. You can lower some features. Like, for example, let's say I had a feature for every person on Twitter. I had a Patrick feature. I had a Jason feature. I had a you feature for the listener. Then it will use that information. It will memorize something about Jason that it won't apply to Patrick. So if I take that feature out of the system to where it doesn't know exactly who's using it, and I replace it with something like, 'Is the person male or female? Is the person young or old?' If I use more general features, you can sort of address this overfitting problem.

  122. B

    This is a dangerous thing to get in, right? Because, like, you can almost accidentally end up training it on the 10% that you're holding out as well. So, like, people who aren't careful, like, 'Oh, I trained the model on the 90%, but then I determine which models to keep and do further tweaking based on the 10%,' but then you've kind of allowing the 10% to creep in, right? That's true. So then now you're really training on everything. And so when you give even brand new data, it's a delicate balance. And this is where it doesn't come down to a formula like, 'This is what you do. You can keep this much data away,' and you take this much data, and it's hard if your data is really expensive or you don't have a lot of it. And then, like, you've got to be careful. You can't use just—you don't have an infinite supply of it. So you have very small sample size.

  123. A

    Yeah, definitely. No, that's totally right. But so, yeah. So underfitting is where you can't even learn on the 90%. So, in other words, you know, going back to the Twitter example, if all I gave you was Patrick's age and you had to determine whether he'll click on this baseball link or not, that's a pretty hard problem because there's some—how old are you going to get? You're like 30, 20? You asked a man his age on a

  124. B

    podcast. Anyway, so let's say Patrick is

  125. A

    104. Yes, that's right. There's probably some 104-year-olds who like baseball and some who don't. And so you're not going to be able to use just someone's age to determine if they will click on a baseball tweet. So you will just not do well on the 90%. That's underfitting. And so that when you have that problem, then it often comes down to these hidden features. And maybe there's some other part of the problem that you can capture that you're not capturing. So one last set of common terms. There's three basic types of Machine Learning. There's classification, regression, and control. So classification is kind of how it describes, you know. Like you might say—so even just—let's say you want to recommend somebody. You want to say, like, does Patrick like sports or does he like leisure? Does he like television? You want to fit Patrick into one of these buckets to determine what kind of Twitter user he is. Give me a label. Yeah, exactly. Regression would be, you know, if you want to do, like, stock market prediction. That's an example of regression where, you know, a stock doesn't do, you know, zero or one. There's some continuum of success for a stock. And so whenever you're dealing with these continua, you're dealing with regression problems. And last is control. Control is actually very similar to classification. You know, given a certain set of features in a certain environment, you want to, you know, choose one action versus another. The difference is control often involves a feedback loop. So you're doing many classifications, and the results of previous classifications matter. Like, you make a move in checkers, the board changes, and the fact that you made that move matters. So,

  126. B

    Yeah. So you said machine learning there. So how would you define the difference between artificial intelligence and machine learning?

  127. A

    Oh, man, I'm on the spot. So, yeah. In the past, in the previous episode, we focused on AI in general. You know, machine learning is technically a category inside of AI. There's a lot of, you know, as we mentioned in the podcast, in the previous podcast, there's a lot of intelligence which is innate in humans. And there's a lot of intelligence which is sort of can be captured, you know, by a human in a program. So in the case of, in the canonical case that we mentioned, image processing, of compressing the blue channel, that isn't machine learning. That's just understanding human physiology—the psychobiology of the brain—and then reverse engineering that. So that would be an example of something that I would consider that AI, but not machine learning. Machine learning is typically where, you know, you have a set of data and you have a set of features and objective function, and you want to create a fitness function, or another way of saying it is you want to create a model which, given, you know, new features, will create, you know, will try to predict the label for, you know, a new training example. So there's typically with machine learning, you're dealing a lot with sort of inputs and outputs and this kind of thing, and not so much with human biology and things like that, although that can get into it.

  128. B

    Okay. Fair enough. All right. So what are the methods? Like, you talked about having a model. I mean, you've got to get to that model somehow, right? It's like get to this objective function, figure out the objective function, and take some data. How do you go about doing that?

  129. A

    Yeah, definitely. So there are three main methods: supervised learning. And so the idea with supervised learning, as the name kind of suggests, is you have some sort of supervisor. So imagine if, for example, going back to our Twitter example, Patrick will go to the website, and he will either click or not click. My system might predict Patrick's going to click on this tweet, and then he doesn't, right? So we have what's called a residual or an error. Or my system might predict Patrick's going to click, and he does. So we have a confirmation, right? Supervised learning is where you're constantly getting this feedback that you can use to fix your model. And there are many different ways to do supervised learning: there's gradient descent algorithms, there's a perceptron, and then there's backpropagation, which backpropagation is pretty cool. The idea is you have sort of a set of errors. Like you told the robot to make a right, and it found out it couldn't make a right. So the 'make a right' has an error. And that causes the things which calculated 'make a right' to have an error, and the things which calculated those to make an error—all the way down to maybe at the bottom, you have just sensors and motors. And you start learning the errors there. And so you can even use things like backpropagation to find, you know, dead pixels in your robot display. Or if the robot wheel breaks, a machine learning system can pick up on that. So that's kind of supervised learning, and you're constantly getting this feedback. Now think about checkers, for example. When you make a move in checkers, no one pats you on the back or kicks you in the face. No one says, 'That was a terrible move.' Like, 'What were you thinking? That first move was horrendous.' With checkers, you get feedback at the very end. And so that feedback at the end is called the reward. That's what in general it's called, even with supervised learning. But with reinforcement learning, you have to estimate the value. So you really need to know if that first move was a good or bad move, even though I got no feedback. Because you can infer it from the feedback I get at the end of the game. So there's a set of techniques for doing this: reinforcement learning. There's temporal difference learning, there's Minimax, Monte Carlo Tree Search, genetic algorithms, and there's another algorithm called NEAT, which stands for, I think, Neuroevolution of Augmenting Topologies. Of course, yeah. So you can see these in the show notes. There's a ton of different methods for doing this, but they all kind of are focused on this idea of getting value from reward. And if you think about it in terms of, let's say you're making a website—you might want people to say, let's say you're making the next Amazon. You might want people to buy, you know, books from your website. But to do that, you have to, you know, get people on your website. Some of those people will register their credit card. Some will fail at that step, right? Some people will go on to, like, you know, some other part. They'll add it to their shopping cart, right? But all of these steps have some value. Like, if you add the book to your shopping cart, you're probably closer to buying it than somebody else. And so knowing how much closer you are is also a reinforcement learning problem. So in the web domain, there's actually a lot of reinforcement learning.

  130. B

    So tell me if I've got an example correct. So with the checkers example, if I was trying to train my model to replicate a specific human player. Okay? So then supervised would say, like, okay, what do you think the player is going to do? And then you ask the player to make the move. And you say, 'Well, did you get that move right or not?' Did you guess the move he said? So every step you're saying, did you match what somebody or something did?' Yep. So that's

  131. A

    called—there's actually a specific term for that. It's called imitation learning. It is when you have somebody kind of sitting alongside the computer and you make the computer match that person.

  132. B

    Okay. But then unsupervised would say, or sorry, reinforcement learning would say, like, okay, you're going to do good or bad, win or lose checkers. But I don't have a specific human I want you to model. I just want you to win.

  133. A

    Right.

  134. B

    So the only for sure thing you're going to know is at the very end if you won or lost.

  135. A

    Exactly.

  136. B

    So you've got to come up with your own metric for how well you're doing in the meantime.

  137. A

    Yep. That's exactly right.

  138. B

    Okay.

  139. A

    So one really cool thing about reinforcement learning is there's something called co-evolution. And the idea is you can actually have 10 computers. They can all play each other and then they can learn from each other's and their own mistakes. And in theory, you could use co-evolution to make the perfect checkers player. You know, it would just keep learning by playing itself and playing its opponents. It would keep, like, making mistakes. Because if two computers play each other, this gets back to our previous podcast where we talked about the two grandmasters and you could sit in between them, right? If two computers play each other, one of them will win and one of them will lose. And if the one who loses can learn something from its mistake, it will eventually win. And now the second one will learn something. If you could follow this process to infinity, then you'd have, you know, the world's top player. There are some caveats to this. So there's something called the Red Queen effect where it's another way of saying is the rock, paper, scissors effect. You can have three computers and just like rock, paper, scissors, each one can beat another one. But there's a cycle.

  140. B

    Those are called, like, transitive, right? Yeah. Just because I beat you and you beat Bob and Bob beats me. Oh, crap. Like, no, no. Like, so me beating you, you beating Bob doesn't mean I'm better than Bob. Bob could still beat me. Right. And there's nothing wrong with the universe.

  141. A

    Exactly. Exactly. And so you get into these Red Queen effects and it actually makes it very hard. So in practice, co-evolved players aren't the best players in the world, sadly. But that's totally possible in theory. And so that kind of makes that kind of alluring.

  142. B

    So I jumped the gun and I said unsupervised because I said supervised. And I was like, what's not supervised? Unsupervised. So what is unsupervised then?

  143. A

    So unsupervised learning, this was actually pretty hard for me to understand at first. But it's a little bit simpler. Another way of thinking of unsupervised learning is just two things: either clustering or dimensionality reduction. Sounds awesome. Yeah, they both sound pretty epic. So, you know, clustering, for example, if you go to, say, Google News and you look up a news article like the Tesla article that we mentioned a couple weeks ago, you know, you'll see this article like, you know, North Carolina, advanced Tesla. And then at the bottom, you'll see 200 similar articles, right? Well, that's because Google News is doing clustering on all the news articles in the Internet. And it's saying, 'OK, all of these news articles are in the same cluster. Like, they're all about Tesla being banned in North Carolina.' So that's an example of clustering. Dimensionality reduction is, let's say, for example, let's say you're Twitter and you're trying to capture user behavior—whether someone is 13 years old or 14 years old. Like, let's just look at people who are, you know, providing their ages on their accounts. That might not matter. Like, a 13-year-old and a 14-year-old might behave the same on Twitter. But a 13-year-old and a 70-year-old definitely don't behave the same, right? So if you think of every possible age as a dimension, so, you know, a 13-year-old and a 14-year-old are two different dimensions where, you know, someone's either in one dimension or the other. Some of those dimensions can be collapsed. Like, you can maybe collapse it down to preteen, teenager, young adult, middle-aged, and elderly. So that's—now you've collapsed what? The oldest person? Let's say 120. You've collapsed 120 dimensions down to five. And so that's an unsupervised problem. So you're just taking user behaviors and you're not trying to, like, predict anything. You're just trying to find out, 'Can I collapse some of this data?'

  144. B

    Yeah, it's a form of compression almost. Yeah, that's another thing. So, like, the classic one with image processing, right? And you kind of mentioned this with the human eye in a way. But, like, if you have red, green, and blue for a specific sensor type of activity you're doing. But, you know, that's a lot of data. If you have a full, you know, 64 by 64 of red, 64 by 64 of green. You know, there's a big array of every color. But you find out it turns out you're on Mars. I don't know. And there's a lot of red, but like no blue. Yeah. Right? So, like, red and green are really the only things that matter for my highlight. Like, blue just basically is always the same value all the way across. Right? So you're kind of wasting data by storing that. If instead you used all those bits you were using to store more red and green information, then you may be better off. Yep. So you can kind of reduce those dimensions or you just reduce how much you have to store a process and stay close to the original, you know, almost the same amount.

  145. A

    Yeah, definitely. So for both of these, these end up being the same problem. Yes. Like clustering, dimensionality reduction. If you think about it, it's a little bit intuitive that the same methods could be used to do either. Clustering is basically reducing down to one dimension, right? So the most common one, and, you know, if you make your own Google News site at home, you can use this. You can write the code in four or five lines. It's actually on Wikipedia. It's K-Means Clustering. This is what everybody does the first time they do some kind of clustering. There's also PCA, which stands for Principal Components Analysis. That's a little bit more advanced and involves a lot of linear algebra. You have to, like, invert a matrix, a transpose, and some other stuff. So that's pretty heavy. I'm sure you could find a library to do it if you don't want to tackle that one yourself. And then there's Neural Gas, which

  146. B

    is pretty awesome. But... I think that was from World War I, right? No, no, no. Neural Gas. That's mustard

  147. A

    Gas. Neural Gas. Oh, Neural Gas. So, yeah, Neural Gas is basically a little bit complicated, but kind of constructs these neural networks and uses this force-directed clustering to place the neurons. And, you know, these are kind of an increasing complexity. So if you need Neural Gas, you probably are doing something pretty heavy.

  148. B

    Yeah, I feel like I need to write these words you said down, and I'll just go Google them.

  149. A

    Yeah, definitely. So this is the kind of episode you want to look at the show notes. And, you know, Wikipedia is awesome at not only telling you about these, like we are, but also providing some pretty killer illustrations. I know for Neural Gas, if it's not Wikipedia, it's some other website that's pretty early in the search results. It actually, you can draw a shape on the screen. There's some Java applet. And the Neural Gas will create a model that fits this shape in real time. You'll see all these neurons going around your shape, fitting it. It's pretty epic.

  150. B

    Yeah, I mean, the goal of this episode isn't to tell you what lines of code to write to do these things, but more like you'll have heard these before, or you'll know what to look up if you say, oh, what was—I have this problem. I need to make two articles and determine if they're like each other or not. What was that thing Jason said, you know? It's like, oh, okay, yeah, I've heard that before. K-means. Like, oh, okay, good.

  151. A

    Yeah, definitely. I mean, at the end of the show, we'll talk about some tools, some open source tools that will make your life a lot easier. But, yeah, definitely we don't want to get too specific because that will just be kind of boring. Yes.

  152. B

    Those textbooks are boring. Yeah, yeah, exactly. We would be even more boring.

  153. A

    Yeah.

  154. B

    Because we'd also be doing it wrong. We'd still have to go read the textbook.

  155. A

    Yeah. Oh, man. So there's lots of challenges, obviously. Yeah, I mean, this is definitely not a pure science. There's a lot of—

  156. B

    I don't have a robot to clean my house yet.

  157. A

    No. That's totally—we should make one. That would be so epic. That

  158. B

    was last episode.

  159. A

    Yeah, true. Okay. So one of the challenges is making an objective function, right? So let's say you have a website, and you have some way of customizing the color scheme. And so you want your objective function to be every time someone clicks a button, that's good. And if they come to your website, they don't click a button, that's bad.

  160. B

    Bad. Electric shock.

  161. A

    So the system might learn, make the entire website, text, everything the same shade of pink. And just make one button blue. There's only one thing the user can do is click this button because everything else is completely camouflaged. So they might—yeah, everyone who comes to your website will either leave or like click this button. A lot of people will probably click the button just because they've never seen a crazy website like that, right? But that—although you maximized your objective function, you clearly—the system didn't do what you wanted, which is

  162. B

    Make a pleasing website, right? So would it be able to make the Hamster Dance website?

  163. A

    I've never seen the Hamster Dance website. Okay.

  164. B

    Sorry. Anyways.

  165. A

    Wait, describe. It sounds pretty epic.

  166. B

    It's like rows of little animated GIF hamsters singing a little song and dancing in unison.

  167. A

    What? Really?

  168. B

    It was, like, very old website. It's like—

  169. A

    Is that around the time I saw the Prime Number Pooping Bear? Have you seen this? No. It's a bear that poops prime numbers.

  170. B

    That sounds much more intellectual than what I'm talking

  171. A

    About. Despite a pooping bear being not sounding intellectual, it's

  172. B

    far more intellectual than the hamster dance website. But we're really out of—so how is this related to A/B testing? Oh,

  173. A

    Yeah. So definitely you want to take your model once you've trained it and you want to, you know, give it to some users and see how they interact with it, right? So A/B testing is where basically you have a new feature. It might be a new UI. It might be a new layout, right? It might be a new model of something you've trained which, you know, changes the text or whatever. You want to show it to a small group of your users and you want to see how their behavior differs from the control group. So, you know, for example, if you change the color scheme of your website, you might have two websites for a short amount of time, one with the old, one with the new. If people on the new one are clicking on way more stuff, that's a good sign, you know, that this new color scheme is the way to go.

  174. B

    Yeah. I mean, I think with all of these things we talked about, like, I guess it falls good under challenges, right? It's like it's hard, like no matter what the model says, it doesn't mean it's going to be right. Yeah. So, like we talked about that stocks again, like is a good thing, right? Just because it shows it's made money in the past. You may have made a flaw or just maybe like it's not, I don't know, it's not up to scrub. It's not good enough, right? So, you know, that you can end up when you try it in the real world, you don't want to just push it out to everybody. You don't want to put all your—I wish I had a million dollars—all your million dollars in the algorithm on the first day, right? Like that would be silly because you may have messed something up.

  175. A

    Yeah. Yeah, exactly. Yeah.

  176. B

    So same thing, you all just let your, you know, algorithm push live the all pink and one blue button thing. Sure, maybe performance goes up really fast initially and then people never come back to your website because they don't understand what's going on.

  177. A

    Yeah, actually that gets a really interesting point, which is, you know, your objective function often captures something that is very short term. Like, as we mentioned, people clicking on your website, it's often something that's very instant and it has to be. Otherwise, you wouldn't be able to train a model on it. So you have to sort of balance like what the model says with your actual business. You might not want people to click on your ads as often as you could, as they could. Like, if you have the system just say, 'Okay, I want every—like I want people to click on ads.' Like, when they click, I want the percentage of clicks on ads to be high. So the system, if you gave it total freedom, would make one ad that was the entire page and everyone who clicked anywhere on the page clicked on the ad. But that ruins, as you mentioned, the long term value of your website. And capturing things like long term value, user retention in an objective function are extremely difficult. So most of the time, you're sort of balancing, you know, the model and the objective function with what you really want as a developer. So that could be a challenge.

  178. B

    The way you described it is really interesting because I think a lot of times there's—people tend to think about Artificial Intelligence, Machine Learning. And they think as like a very like research PhD thing, like trying to build the next humanoid. You know, we talked about like RoboCup, you know, DARPA Grand Challenge. We talked about these things in the last episode. And I think people tend to think about those kinds of things, but they forget, like you're saying, you can use this Machine Learning stuff to help drive traffic on your website at some level. Or determine what you should do as opposed to just guessing. You know, and maybe not a single guy website. That's probably not the wisest use of time unless he really enjoys it. But if you get to a certain size website, you really can take advantage of this data if you know what you're doing.

  179. A

    Yeah, definitely. I mean, I'm sure a lot of you listeners are familiar with Google Analytics. So it's a product where you can put some JavaScript on your website and you can actually see what's called the user funnel. So you can see people come into your website. You know, 100% of the users visit your website. 100% of the users who visit, visit. And then of that 100%, some people click on links, some people leave, right? And you can actually see the user funnel, like who does what, who clicks on links, and the long tail, like who stays on your website for a really long time, et cetera. And now that, you know, you've heard us talk, you know that that is a Reinforcement Learning problem, right? You want somebody who visits your website for the first time, you know, they click. There's a little bit of a reward because, you know, they're on your website for longer for clicking. But there's also potential long-term value, right? I mean, just because, you know, if they click on one link versus another, that second link might get clicked on more often than the first. But the first might lead to many other clicks. Or if you're on YouTube, for example, one video might be like funny fail video, and it's all people falling off slides. And that might, you know, people might watch that video. But another video might be part one of how to cook. And people might watch part one through 1,000, right? Watch a ton of videos as a result of that one. So even though someone—more people might want to watch a fail video, it still might be better long-term value to watch part one of the cooking video. So now you can sort of see how Reinforcement Learning, supervised, unsupervised learning sort of play a role even in, you know, modern-day businesses. Another big challenge is what's called a training-serving SKU. So this is a little bit hard to explain, but basically, you know, let's say you're collecting data. And let's say you're using people's ages, for example. It's very often that there's a bug somewhere in the system. So, for example, when I collect everyone's ages and give it to the model, I'm doing it correctly. But then when I try and score the next people who visit the website, their ages are off by a factor of two because of some divide-by-two error somewhere in the system. So the Machine Learning algorithm isn't going to tell you, like, 'Hey, you have a bug.' You know, these ages are half of what I expect them to be. It's going to act literally like those ages are half, and it's going to treat everybody like a child. And it's not obvious that there is a bug in your system. So there's many ways of dealing with this. One way to deal with it is to, you know, look at the results. So eventually, you know, if I show Patrick a Twitter tweet and he clicks or doesn't click, that will become part of my training data. Like, once you take that action, and I'm saying you as Patrick, once Patrick either clicks or doesn't, that ceases to become serving. You know, I've already served that, you know, choice to him. And now he's taking it and actually becomes training. So if I keep my score from there and pass it forward, I can see, like, 'Oh, I thought 90% chance Patrick is going to click.' But now at training time, I see that there's a 3% chance. So something is buggy in the system. You know, in general, there can be bugs that are very hard to isolate. Yeah. Some other challenges. Another big challenge is just many of the problems or many of the algorithms are linear. Like, as we mentioned, PCA is linear. Grading descent is linear or can be. Perceptrons are linear. When I say linear, what it means is each feature will get a score, and then all those scores will be added together. So in other words, you know, Patrick is an adult. So adults will, you know, click on tweets X percent of the time, and children will click on tweets Y percent of the time. And maybe Patrick's also a male. Males will click Z percent of the time.

  180. B

    Wait, maybe also?

  181. A

    A male? No, no. Patrick's definitely a male. And males click Z percent of the time. And then just takes all these features and all the percents and basically adds them up. That's a linear system. So some things just aren't linear. Like, for example, 20-year-olds don't click on tweets twice as much as 10-year-olds. Or at least that's not obvious. Or 100-year-olds don't click 10 times as much as 10-year-olds, right? So dealing with linearizing the data and, you know, separating it out. Maybe age, instead of being one number from 1 to 100, it's actually 100 numbers, either 0 or 1. So, you know, somebody aged 13, somebody aged 14. Those are just completely different numbers in this system. That's not obvious. Yeah. So, yeah, there's a lot of sort of modeling tricks. And if you go into, like, what's called Feature Engineering, if you look into this, there's many different tricks that you can do to sort of make your models easier to learn. And so to deal with this underfitting problem. And finally, there are kernels. So, you know, in the case of age, you know that being a teenager and being preteen and being adult, like, you just, you're, as a human being, you know that there's sort of like a fundamental difference. You know, like when you are a teenager, you're in high school and you have a different, let's say, mindset than when you're an adult and you're in college or working, right? So you, that's not something that you want the machine to learn. That's something that you just know about humanity. And you can put that in directly. You can say, you know, is this person in the age bracket, you know, 13 to 18 or not, just based on what you know of the world. And those are called kernels. It gets a little bit more complicated than that. There's kernel functions and all this stuff. But in a nutshell, that's kind of what it is, is you taking some part of the problem that you know as a human and applying it to the machine.

  182. B

    are the basic

  183. A

    challenges. So we

  184. B

    have some tools to help us, some things you can look into maybe to help you out. So one of those we haven't talked about, but Natural Language Processing. And so that would be like, I want to understand not just like, okay, I see there are words here, but what do they really mean? Like I want to say, this is a verb and this is a noun. So think about like last episode. Man, I guess people really should have listened to last episode. We talked about a chatbot, right? So like in a chatbot, you want to recognize the noun of the sentence because you want to repeat the noun back to the person. So, you know, you want to process that language. Or, you know, it could even include things up to like, you know, sentiment analysis or whatever. Like is the person happy or sad or angry or feeling good? You know, are iTunes comments mostly positive or mostly negative? So it's got a star rating, but people are, you know, saying bad things also. So like that's kind of, they're using bad language. Like, okay. You could

  185. A

    combine. Oh, well, you go ahead and finish.

  186. B

    No, no, no. So it's okay. So one of the, there's actually a lot of packages to do it. One of them is OpenNLP. So by Apache. So don't, if you find yourself doing this, don't like code it yourself. Like don't say like, I'm going to figure out how to do this. Like go find somebody else who already did this, you know, and at least even if you don't use it for the full algorithmic part of it, like at least use it for like the basic parts, like segmenting what part of this sentence is a noun and what parts of verb and, you know, helping you with those kinds of things. Cause you're going to be a lot farther along the path of getting to the interesting parts. Yeah.

  187. A

    You can do interesting things. Like we could take the ratings that we got on iTunes and say, okay, people who use more verbs than nouns. Did they give us lower stars? You know, like things like that. And so there's a lot of interesting stuff.

  188. B

    Well, you can like monitor over time. Like our star ratings not dropping yet, but people are using less positive language to describe us. Then like, maybe we should be concerned even before the stars start dropping.

  189. A

    Yeah, exactly. So

  190. B

    don't try this. But like, yeah, like that's one thing, right? Or if you ever go on Amazon, sometimes it's confusing, right? Like it's hard for me. I look at the reviews and they're like low stars, but the people are saying stupid stuff. Right. And it's like, okay, I don't want, you know, if you could somehow find like, oh, I came up with an idea of how to tell that people are saying good things, but giving low star ratings. Like weight those differently than people who are both giving a high star rating and, you know, really positive feedback.

  191. A

    Yeah, definitely. I mean, you could combine OpenNLP with like a supervised method. Yeah, Amazon has the, you know, X people found this review helpful. You could find certain words or phrases which are indicative of a helpful review before the person has even posted it. Yeah, you can do all sorts of fun stuff.

  192. B

    We estimate this percentage of people will find this helpful. Yeah.

  193. A

    Your comment is not helpful.

  194. B

    Please do not post it.

  195. A

    So there's Minor Two sort of lower level things. One is Mason. I'll cover this one kind of loosely because it's a little bit more academic. But it has a whole cornucopia of different evolutionary computation algorithms. But another one, which I'll spend a little bit more time on, is Apache Mahoot. Mahoot? Mahoot. I don't know what it is. Mahoot? I think it's like an Indian word or something, isn't it?

  196. B

    That's okay. I'll wake it up and you can continue. But

  197. A

    Yeah, Apache Mahoot, you know, we talked about Hadoop.

  198. B

    The person who rides an elephant.

  199. A

    Oh, there we go. So we talked about Hadoop in the past, which is a way to do, like deal with massive amounts of data. And Mahoot is a machine learning system built on top of Hadoop. So if you have, say, the whole internet or a ton of data, like every time someone visits your website and moves their mouse or does anything, you're collecting that data. And you have terabytes and terabytes of data, you want to be using Apache Mahoot. And it's pretty awesome. Actually, a number of people I know are contributors to this project. And the people who contribute to Mahoot, it's definitely really well done. It's done by a bunch of really smart people. That's

  200. B

    Because it's you and your friends?

  201. A

    Well, it's not me. I haven't contributed yet. But it's a phenomenal library. I have used it. And it's great. I highly recommend using Mahoot. And another thing about Mahoot, a lot of companies are using it. So it's something that if you get familiar with, you could apply it in industry like almost immediately.

  202. B

    Yeah, and we talked about it before. But like, and this is much more in machine learning probably than in artificial intelligence, although the two are kind of closely tied, I guess. But, you know, this big data thing you always hear about, right? Like, I mean, a lot of that is ultimately Walmart wants to collect all this data about how much people are buying, you know, based on what input parameters. And they just want to measure everything because they don't know what's useful or not. But then it's not just a simple problem of like what machine algorithm learning, what machine learning algorithm to apply, but like actually doing it, right? So even like, you know, my role, like I don't do a lot of actual AI or machine learning stuff per se. Like that's not my job. But I help the people who do because I go ahead and do a lot of the number crunching and scalable processing that implements what they do. So they say, hey, I came up with this thing or I want to do this model, but the data is not in a good format or it's too much. So I'll go in and help them like reduce that data, you know, make sense of that data a little bit better so that they have an easier time. And so even if you don't say, well, you know, I don't think I'm going to end up, you know, being a machine learning person or, you know, I don't feel like that stuff's interesting to me. There's still a lot of interesting work to help those people out. You can work with those people, you know, and help them and it's still not, you know, you're not doing it yourself.

  203. A

    Yeah. It's not very common.

  204. B

    Maybe I'll just stick with processing it.

  205. A

    It's pretty awesome. Highly recommend you guys checking it out.

  206. B

    I would like to learn more about that. I think this is like a very broad subject. Like you could spend your whole career learning any just one of these things and that being your thing. Yeah, definitely. So, but there's something to be said too for learning when not to apply something.

  207. A

    Yeah.

  208. B

    So sometimes I think, and maybe that's like what we've learned today on this show. No, no. Just like today versus like in the past is like learning restraint. Yeah. That it's not necessarily true that Artificial Intelligence and Machine Learning will solve every problem today, you know, or like throwing it at it isn't necessarily the right answer. Yeah,

  209. A

    It's not a silver bullet or a magic bullet or whatever.

  210. B

    Right. It's another tool in the tool bag. Like we talk about programming languages are also tools in the tool bag. Yeah. So it comes full circle. Well, I think that's it for this episode.

  211. A

    Yeah. Some pretty heavy stuff. We're going to try and cover a language. It's been a little while since we've done that. So we'll cover a language next episode. English. I think we can both cover that sufficiently. Okay, good. I've been coding in English for a long time.

  212. B

    I don't know about that. I've been speaking English for a long time. Oh, they're

  213. A

    Not the same? I

  214. B

    Don't. I'm not sure. All right, anyways, before we board you guys, if we haven't lost you already, thanks for sticking with it. And have a good one. All right.

  215. A

    See you later. The intro music is Axo by Binar Pilot. Programming Throwdown is distributed under a Creative Commons Attribution Sharealike 2.0 license. You're free to share, copy, distribute, transmit the work, to remix, adapt the work, but you must provide attribution to Patrick and I and share alike in kind. One of the episodes...