Podcast 004 Crash Course on Algorithms

We’ll discuss a brief history of algorithms and how a few of the major types like matching and recommendation work when you break them down. We hope to inspire you to think of ways you could implement algorithms into your day to help you work smarter, not harder.

Don’t forget to subscribe to the show here or wherever you listen to podcasts!

Episode 004 Crash Course on Algorithms Transcript

Heather McKee:              Welcome to The Modern Polymath, where we discuss topics in technology, economics, marketing, organizational behavior, market research, human resources, psychology, algorithms, higher education, cybersecurity.

Heather McKee:              Hey, podcast universe, thanks for tuning in. On today’s episode of The Modern Polymath, we’re going to give you a crash course in algorithms. Now, some of you may already be familiar with algorithms and how they work, but others may only know surface level details, or just the definition, if that.

Heather McKee:              If you’re in that second or third group, we hope you get a lot out of this episode. For those of you in the more familiar group, maybe you’ll learn something new, like where algorithms came from, and how many years they’ve actually been around.

Heather McKee:              Today we’ll discuss a brief history of algorithms and how a few of the major types, like matching and recommendation work when you actually break them down. We hope to inspire you to think of ways you could implement algorithms into your day, to help you work smarter, not harder.

Heather McKee:              Today we have Dr. John Christiansen, John David McKee, Will Callaway, and I am Heather McKee. But without further ado, let’s get this crash course started. Let’s first start off with answering the question, what is an algorithm?

John-David M:                 Putting it really simply, algorithms are just a set of specific steps.

Heather McKee:              John-David McKee speaking there.

John-David M:                 To solve a problem or to perform a specific task.

Will Callaway:                  It’s basically instructions, right?

John-David M:                 Right. I mean it’s what you need to do to get the outcome, but get it on a regular basis. It has to be repetitive.

Heather McKee:              That’s definitely a less daunting definition than I think a lot of people thought it would be. And knowing that’s the case, where would you tell people that we really see algorithms?

John-David M:                 We see them all the time. Algorithms are everywhere, whether we know it or not, and most of the time we don’t. But every piece of technology we use today has multiple algorithms running in the background. With the whole idea of the Internet of Things, there are algorithms talking to your refrigerator, your security system and all these other things that we use on a regular basis.

John-David M:                 But it’s also something that we do naturally as people. The word itself shouldn’t be intimidating because it’s core to mankind and how we think, it’s something that we’ve always had and always done.

John-David M:                 In fact, algorithms have been around all of recorded history. The Sumarian civilization first used algorithms in a very rudimentary form, over 4,000 years ago and this is also where the invention of writing came from, around the same time. So as long as there’s been writing, we’ve been using algorithms and documenting them.

John-David M:                 The term we know today as algorithm comes from Muḥammad ibn Mūsā al-Khwārizmī, who was a Persian polymath who live in the eighth century, most famously is one of the founding fathers of algebra and created the idea of the algorithm in its modern form and gave it that nice name. The need to develop efficient algorithms and the study of these algorithms, these recipes, these specific set of instructions, led to the science around computation, which then led to modern computer science in the era we know today, with algorithms still being fundamental building blocks of the field of computer science.

John-David M:                 Not all algorithms are created equal. Some are better than others, even if they produce the same results. Many cases there are numerous different algorithms that would get the result that you need, but it’s what’s the best, what’s the most efficient? Usually it’s the least number of steps involved, because it’ll get there very quickly. But it may also be something like how much memory it uses that’ll make one better than the other, and this is why you have to know the different types.

Will Callaway:                  Note that when we say efficiencies, we mean optimization.

John-David M:                 But take it a step back since this is a crash course, there are numerous different examples of algorithms we see and do every day. And again, it’s something that we need to be comfortable with understanding what this is and not just associating with computer science because we do it naturally.

John-David M:                 For instance, when you’re doing laundry and you divide up your laundry in the different piles. You have your whites and your darks, you may take your delicates, put them over here. I’m still not sure where those are. I’m one day going to find that out. My algorithm isn’t as efficient as some people in doing laundry, workout clothes and towels, all these different types, you’re separating those out. As you separate them, that as an algorithm. Knowing whites go in this pile, darks go in that pile, et cetera, et cetera.

John-David M:                 Simple routines that you do every day like taking a shower and driving a car. We have steps that we follow, and usually their tried and true until we were advised them to the point where they work for us. But, if you start with your hair or your body wash or whatever it might be and move sequentially from there, this is a basic form of an algorithm.

John-David M:                 The easiest one to understand because we’ve all done this to some capacity is following a recipe. This simple cooking, say a squash casserole recipe.

John-David M:                 It’s important to note that algorithms must be precise. If you’ve ever cooked, you know that not all recipes are precise as they should be. It may say cook on high for 25 to 30 minutes or until done. Well, five minutes between 25 and 30 is a large range. But until done, what does done mean? These still leave room for interpretation. That’s something that an algorithm should not do.

Heather McKee:              Right. But so there are different instructions that an algorithm can be given or that different algorithms have that essentially lead to the same end. Multiple algorithms can actually be used to solve the same problems.

Heather McKee:              So if we take squash casserole recipe, for example, I actually found a picture on my phone of last Thanksgiving, where I took a picture of a recipe book with two squash casseroles-

John-David M:                 Wow. That’s convenient and actually real.

Heather McKee:              It is. I’m staring at it right now.

John-David M:                 We’re share it on the site.

Heather McKee:              But they each have, they call for different ingredients. One only says a half a pound a squash, the other one says two pounds. One calls for carrots, the other one doesn’t. I mean, there’s just different pieces here, but at the end of the day, I’m making a squash casserole and that’s what I’m going to get out of it.

John-David M:                 As long as the instructions are precise, right?

Heather McKee:              Correct.

John-David M:                 But you’re taking all these different inputs … And we’ll get into the building blocks in a minute, inputs and outputs, and you’re getting to an end goal through a precise set of instructions. Anybody who’s ever read or watched Harry Potter knows the sorting hat. Well, sorting is one of the most common examples of a basic algorithm. It’s used in everything from your computer, sorting your contacts alphabetically to sorting your new emails in your inbox. Things like that happen all the time.

John-David M:                 And, we say the things we see every day, like sorting algorithms, and we take them for granted. But a couple hundred years ago this would have looked like magic. And I think it’s funny to look at the sorting hat basically could be replaced by an algorithm. That’s all it’s doing is running through oh, we have the four available houses, these are your characteristics, these are your goals, this is what the body of those houses look like, therefore you’d be likely to fit in this area, and make some dramatic speech in a weird voice flapping this little hattie mouth, and it sorts you into a house. But all it’s doing is running through some algorithm in his head.

Heather McKee:              Exactly. You basically just have to take like a personality profile test, that’s it.

John-David M:                 Right. Yeah. And then they all trusted and said, you can’t question the sorting hat. Well that’s because they trust the algorithm. It’s the same thing.

John-David M:                 But we see algorithms outside of the wizarding world, although that’s best in that area, and a lot of computer algorithms obviously is where we think about this and we see it every day. I mean you go on Amazon, you’re getting recommendations, customers who bought this item also bought these items. Or based on your search history, we think that you would like this.

John-David M:                 Algorithms on Facebook or Instagram that put ads in front of you based on other things you’ve looked at while you’ve been on the web. You’re finding a pair of shorts that you’ve always wanted and these fit great and these are awesome, right?

Will Callaway:                  Brands you follow.

John-David M:                 Brands you follow. They base it off of that and [crosstalk 00:08:29] a lot of your characteristics.

Will Callaway:                  Me and John literally get shown-

Heather McKee:              That’s Will Callaway.

Will Callaway:                  … The exact same ads on Instagram. And then we both largely click it and buy stuff from them.

John-David M:                 [crosstalk 00:08:42] that on company time.

Will Callaway:                  Yeah, yeah. But I think that’s another thing is like that algorithm could look at the people you follow and then extract like a brand that’s similar, maybe at a discount.

John-David M:                 At the end of the day, they’re running multiple algorithms to get to that point and all of these are. But, you know, Google maps or Waze, whatever GPS system you use to get you from A to B and finding the most efficient route in the process, those are algorithms.

John-David M:                 Plane tickets. The prices change at different times leading up to the flight algorithm will tell you within the parameters of what you’re searching for, dates and places leaving from, finding the best ticket prices for instance.

Heather McKee:              Okay, so now that we’ve given a better understanding to the audience, or those members who weren’t really sure what algorithms were, let’s talk about how they work and explain the building blocks of those.

John-David M:                 It’s simply inputs and outputs. Those are the core of any algorithm. Typically we’re more familiar with the output of the algorithms such as the recommendations that you receive on Amazon based on your purchases, or Facebook suggesting new friends you may know based on your friends, things like that. But algorithms are designed to take information as an input and then perform a task to produce an output.

John-David M:                 When you put your address into Waze and ask it to find you the best route home, we know that the output is the route and the directions, but there are multiple algorithms running in the background taking your inputs to then determine that output.

Will Callaway:                  Right.

John-David M:                 By default, outputs can only be produced through inputs. So all algorithms are made up of these two pieces. It can be as simple as a couple of numbers, but more and more they become complex considerations taken from many different sources, especially as computing power and things like machine learning and the like are able to let us calculate much more complex bodies and information to come up with outputs.

John-David M:                 Inputs should consider any variable that might be used to solve your specific problem.

Heather McKee:              Yeah. So for example, whenever you search for the cheapest flight from airport A to airport B, leaving between let’s say 2:00 and 4:00 PM Eastern time, just because we’re on the East Coast, on a specific date, and you can see that many of those inputs are involved in determining the output, which is the best flight that meets your criteria.

Heather McKee:              But these algorithms leverage many other inputs, including a database of all the flights, incoming and outgoing, companies providing the services, their routing, weather conditions, et cetera, et cetera.

Heather McKee:              Same thing where if you take a package to the post office to send out. It’s an algorithm that’s deciphering the handwritten zip code on the slip. Specifically, this is a machine learning algorithm that takes countless examples of handwriting with a known output to help it learn what was right from wrong.

John-David M:                 So it’s taught to distinguished somebody’s name, which they know, and then the handwriting, they can say that it goes back to that specific person.

Heather McKee:              Correct.

John-David M:                 That’s the training data. So I mean overall the algorithms are pretty much trying to do one or more of three basic things. Making a decision, thus searching for a feasible solution, optimization, which is searching for the best solution, and enumeration meaning finding all the feasible solutions.

Heather McKee:              Okay. We’ve talked about the building blocks of algorithms, how they work, which are basically using inputs to provide an output, and ways that people really use them either in decision making, optimization or enumeration. But let’s talk about now types of algorithms.

John-David M:                 In terms of types of algorithms, we really can’t go into the specific types here. There are too many different ways to categorize these things. The new ones come out all the time, but we were just going to outline a few of the major types that you may see.

Will Callaway:                  Yeah, we could go on and on about all the different kinds. Brute force algorithms, backtracking algorithms, divide and conquer algorithms, recursive, greedy algorithms. We can go into all those, but honestly, without visuals and without explaining it in mathematical notation, it’s going to be kind of hard to-

John-David M:                 Make it interesting?

Will Callaway:                  Yeah. For us to say the information and you not fall asleep, and if you’re driving, we don’t want that.

John-David M:                 Yeah. Please don’t fall asleep on our behalf.

Heather McKee:              And it also one of your crash course if we did that.

John-David M:                 It’s true.

Will Callaway:                  Right.

Heather McKee:              So we’re trying to [crosstalk 00:13:06]-

John-David M:                 Let’s just go a couple more examples out there. I think people understand this best through an example.

Heather McKee:              Yes.

John-David M:                 People often think of algorithms based on their core functions such as matching, recommendation, learning and automation, screening, inventory based, et cetera.

Dr. John C.:                       So why not start with matching? And I think this is kind of the easier one because this is .. I say matching and recommendation-

Heather McKee:              Dr. John Christiansen speaking there.

Dr. John C.:                       … Algorithms are two of the ones that we … We can’t go a day without some version of this.

John-David M:                 It’s all over our world and has been since internet became a thing.

Dr. John C.:                       Yeah. Yeah. So like you can pretty easily figure out matching by saying, if I’m going to the grocery store and I get hamburger patty, then I probably need hamburger buns.

Dr. John C.:                       It’s the simplest concept about just a simple match. So that’s essentially exactly how matching and recommendation algorithms work. That’s how Amazon’s recommendation engine works. It knows that if you buy hamburger meat, there’s a pretty high probability that you’re going to need hamburger buns, because they’re complimentary, hence the matching.

Dr. John C.:                       But there’s so many examples. Dating sites, baseball metrics works, occupational coding, sister city coding, how real estate comps work, stock price matching, market matching, store matching, brands similarities.

John-David M:                 An interesting matching algorithm are dating sites. One thing that’s interesting about them, we all know that they’re out there, great. We have a pretty good idea of how they work, I think, not the algorithms underlie that we’ll talk about in a second. But looking back on it like pre-dating site, a little site called Facebook that started off as a very simple matching algorithm. Hot or not basically is what it was. And that’s where if you’ve seen the movie, The Social Network, you know that.

Dr. John C.:                       Yeah. But what’s funny is now a lot of dating sites are pretty much hot or not.

John-David M:                 Yeah, pretty right.

Dr. John C.:                       Yeah. It’s like swipe right if hot, because I want hot and-

John-David M:                 But on the matching algorithms side, I mean what, you know eharmony kind of pioneered-

Dr. John C.:                       Or match.com.

John-David M:                 Match.com, I was going to go there. But eharmony was first, and the …

Dr. John C.:                       I just laughed like Elijah Wood by the way.

John-David M:                 That’s some complicated matching. I mean then what they do is very impressive.

Dr. John C.:                       They’ve had success for a very long time. And there’s a good reason and it’s because … It’s kind of two parts. One part is what we’re going to get into, an inventory modeling, which is like what you’re interested in, what your goals are, those types of things, and knowing what makes you compatible. But also taking the whole realm of the entire dating world and scoring it, to say these are your top matches.

Dr. John C.:                       Now the reality is what they’re finding is that doesn’t necessarily say that the person that’s like 98% compatible is the one, versus someone that’s 86, right. It’s just attributing a score to whatever. So what gets-

John-David M:                 The score is not going to be perfect.

Dr. John C.:                       What gets interesting though is when differentiating this from what Pandora can do, which is I’m not so concerned with like 98% is the better than the 86. Well no, there’s just a little more here, but there’s a lot of unobservable that goes on with how we choose who are interested in and who … Compatibility is not always the thing either.

Dr. John C.:                       But what I’m getting at is, so it might take into account all of the sing and hold them all equal. So like I don’t smoke, and on a night owl or whatever, now I sound more like somebody who’s trying to match a dorm room roommate. But, maybe there are certain things that have greater order of magnitude.

John-David M:                 There should be.

Dr. John C.:                       And Pandora and some of these other algorithms actually do a lot of that because the more you do the thumbs up towards things, it’s learning about you. That, it’s not necessarily this artist, it might be more about you just love a long guitar solo. It might just be something like that.

John-David M:                 Yeah. I think actually the Pandora example is given because it’s often been attributed just to the artists and I think that Apple within iTunes is not doing a great job because, first of all, let me listen to all of the artists music. Don’t make me click the friggin specific album. But anyway, that’s another story for another day.

John-David M:                 But, you may like one song of a specific artist that falls under a sub genre because if you’re an artist you should be making a lots of different types of music. And just because I like this one, doesn’t mean I’m going to like the rest of their music, and Pandora is able to pick up that. And, you can create specific stations based on the song, not even just the artists.

Dr. John C.:                       Yeah. Like literally, the song.

Heather McKee:              Yeah. So Will you had a really interesting analogy or example that you’re talking about with something that most people know about, Uber, little thing called Uber.

John-David M:                 Uber.

Will Callaway:                  How Uber’s drivers kind of have an algorithmic boss, where the algorithm is finding a way to basically solve two problems. Get people where they need to go at a reasonable time, and maximize the number of rides that drivers can provide, which obviously gets them paid.

Will Callaway:                  There are a bunch of different things that go into the algorithm. There’s an AI layer, there’s an optimization layer, there’s a geo layer, there’s a time layer to it where different time periods are more active. But …

John-David M:                 If it’s isolating it down to a single ride. So you know, John DOE here wants to go to one, two, three main street. Like that’s something that an individual can do. But we’re doing is leverage this as a tool and being able to do so many different rides for so many different people with so many different drivers and so many different places.

John-David M:                 And my mom helped run a charity and they would deliver food to addresses throughout the Florence, South Carolina area, Cooks for Christ, little shout out, awesome organization. But I would watch her do the routing and she would do that, she and a couple people would get together, they would take the different delivery locations and spread them out on the floor and try to find the best routing for 100 plus different deliveries that had to be done from one central location. It took hours and hours to do this every time.

Heather McKee:              That’s funny, because I mean what Uber and Lyft do is way more complex and they do it in actual real time.

Will Callaway:                  I mean that’s just a simple optimization algorithm to find the best route. We talk about that and AI and ML crash course is, how AI is being trained to understand, to basically optimize the logistics of a trucking company.

John-David M:                 Exactly.

Will Callaway:                  Find the best routes, find the best inventory for storage management, find the best speeds for it to drive to maximize what it can do with gas. All of that. It’s just an optimization algorithm in different layers.

John-David M:                 But it’s extremely powerful. Think about the hours that saves in one individual case. This happens in a lot of different places.

Will Callaway:                  Okay. So let’s move on to another probably pretty good example people know about is Google and their page rank algorithm, right? How does that work?

John-David M:                 Well, obviously they continue to update it all the time and it does different things. But early on it was really on a few different factors such as the frequency and location of keywords within the webpage. If a key word only appeared once within the body of a page, it would receive a low score. Of course, then people realized they could ghost the words, right?

Will Callaway:                  Right. The SEO [crosstalk 00:21:02]-

John-David M:                 If SEO. Yeah, for SEO, search engine optimization, they realized that they could put, say they’re trying to optimize for the word cookie, and they would just put in white text on a white background, the word cookie repeated time and time again. So they realized that wasn’t the best way to do that anymore. So page rank had to be updated.

John-David M:                 It looks at things like how long this page exists, so it shows it’s a credible site, but most importantly what they really based it on was back links. So they would look at the credibility of the content based on how many credible sources linked to whatever they were saying.

Will Callaway:                  So what you’re saying is that in some context, algorithms can be gamed?

John-David M:                 Oh, absolutely.

Will Callaway:                  Okay. So like if an Uber driver knows that at 1:30 on a Saturday, downtown somewhere, it’ll maximize what it can do if it stays downtown and doesn’t drive you 30 minutes outside of downtown to take you home-

John-David M:                 They’re going to turn that down.

Will Callaway:                  Right. Okay, so it’s gaming the algorithm, right?

John-David M:                 Yeah, absolutely. That’s one of the things that’s amazing about Google and their continual optimization and updating of their algorithm, is they continue to take in new factors and add these new inputs and adjust the calculations within the algorithm, based on how people are using it, the data that’s available, computational capabilities and power, et cetera.

Heather McKee:              Like we said, there are numerous algorithms out there and way too many to cover in a 20 minute podcast. Our goal was to at least get you familiar with what algorithms are from a simplistic level, and then encourage you to go in depth on your own to learn more about specific ones that interest you.

Heather McKee:              But that’s all the time we have for today. Don’t forget, you can always find our in depth content on our website, www.insandouts.org for this episode and all things we discussed on the podcast.

Heather McKee:              Thanks for tuning in. Catch you later.

Leave a Reply

Your email address will not be published. Required fields are marked *