Latest / CyberSecurity Summary / Advanced Analytics with Spark: Patterns for Learning from Data at Scale
Transcript
- 0:00Speaker 1: Have you ever just stopped and wondered how your streaming
- 0:03Speaker 1: service seems to know your musical tastes like better than
- 0:06Speaker 1: you do, oh?
- 0:07Speaker 2: Absolutely? Or you know how a credit card company can
- 0:11Speaker 2: instantly spot a fraudulent purchase from halfway across.
- 0:13Speaker 1: The world, right blocking it before you even realize your
- 0:16Speaker 1: card was skimmed. It's I mean, if you're tuning into
- 0:19Speaker 1: this deep dive to figure out how the modern world
- 0:21Speaker 1: actually works, you know, it feels a lot like magic.
- 0:24Speaker 2: It really does. But the truth is there's a very industrial,
- 0:28Speaker 2: kind of gritty machine behind that curtain.
- 0:30Speaker 1: Yeah. And there's a quote right at the beginning of
- 0:32Speaker 1: our source text today from Auto von Bismarck that I
- 0:35Speaker 1: think completely shatters the illusion of this like pristine tech laboratory.
- 0:40Speaker 1: He said, data applications are like sausages. It is better
- 0:45Speaker 1: not to see them being made.
- 0:46Speaker 2: That quote perfectly sets the tone for the book we're
- 0:49Speaker 2: looking at today. It's called Advanced Analytics with Spark, and
- 0:53Speaker 2: the authors Sandy Riza, Uri Lasers and Sean Owen and
- 0:56Speaker 2: Josh Wills. They just aren't interested in the sanate highs
- 1:00Speaker 2: theoretical version of data science, right.
- 1:02Speaker 1: They want to get into the weeds exactly.
- 1:04Speaker 2: Our mission today is to demystify that whole pipeline because
- 1:08Speaker 2: they focus on the incredibly messy, chaotic reality of taking massive,
- 1:13Speaker 2: ugly data sets and forcing them through to create those
- 1:16Speaker 2: everyday insights for you.
- 1:18Speaker 1: And to understand the magic, you first have to understand
- 1:20Speaker 1: the machinery, which brings us to a really sharp line
- 1:23Speaker 1: the author's draw. They split this into analytics in the
- 1:26Speaker 1: lab versus analytics in the factory. That really stuck out
- 1:30Speaker 1: to me.
- 1:30Speaker 2: Yeah, that distinction is crucial because, well, the lab is exploratory.
- 1:34Speaker 2: That's where a data scientist sits with a subset of
- 1:37Speaker 2: data on their laptop, maybe using a framework like R
- 1:40Speaker 2: or Python, just kind of plan around right, testing wild theory,
- 1:43Speaker 2: seeing a model actually works. It's highly creative. But then
- 1:46Speaker 2: you have the factory that is operational.
- 1:48Speaker 1: Analytics, which is a whole different beast completely.
- 1:51Speaker 2: You have to take that delicate, bespoke model you built
- 1:53Speaker 2: in the lab and deploy it into a live production
- 1:56Speaker 2: application like a real time fraud detection system handling millions
- 2:00Speaker 2: of swipes a minute.
- 2:01Speaker 1: And historically those were completely different languages, right, Like a
- 2:05Speaker 1: data scientist would do the fun math in the lab
- 2:08Speaker 1: and then hand it off to a team of engineers.
- 2:10Speaker 2: Oh yeah, and those engineers would have to translate and
- 2:12Speaker 2: rewrite the entire pipeline from scratch in Java or C
- 2:16Speaker 2: plus plus just so it wouldn't crash on the factory floor.
- 2:19Speaker 1: Which sounds like a massive bottlenets.
- 2:21Speaker 2: A huge one. Older distributed systems like a Dupe's map
- 2:24Speaker 2: Produce were built to handle factory scale by breaking work
- 2:28Speaker 2: into small tasks across thousands of machines. But map reduce
- 2:32Speaker 2: operates with a very rigid map then reduced format meaning
- 2:36Speaker 2: what meaning every time it finishes a single analytical step,
- 2:40Speaker 2: it's forced to write those intermediate results back out to
- 2:43Speaker 2: a physical hard drive before it can move on.
- 2:45Speaker 1: Oh wow, I can imagine. That is painfully slow. It's
- 2:48Speaker 1: like doing a complex math equation, but after every single
- 2:51Speaker 1: addition or subtraction, you have to file your scratch paper
- 2:54Speaker 1: away and a cabinet across the room, walk back, and
- 2:57Speaker 1: then retrieve it for the next step.
- 2:58Speaker 2: That is exactly what it's like, and it's agonizingly slow
- 3:02Speaker 2: when you're dealing with terabytes of data. This is why
- 3:05Speaker 2: Apache Spark, the engine at the heart of this deep dive,
- 3:09Speaker 2: completely revolutionize the industry.
- 3:11Speaker 1: Because it skips the filing cabinet.
- 3:12Speaker 2: Essentially, Yes, Spark processes data in memory. It caches the
- 3:16Speaker 2: data in the ram of the cluster rather than constantly
- 3:19Speaker 2: writing it back to a physical disc. By holding it
- 3:22Speaker 2: all in memory, it performs complex operations lightning fast.
- 3:26Speaker 1: So it bridges the gap between the lab and the
- 3:29Speaker 1: factory exactly.
- 3:30Speaker 2: You can do your exploratory lab work and run your
- 3:32Speaker 2: factory production on the exact same framework without that massive
- 3:36Speaker 2: translation bottleneck.
- 3:37Speaker 1: Okay, let's unpack this. I want to push back on
- 3:39Speaker 1: the premise for a second. Why is raw computational speed
- 3:42Speaker 1: so fundamentally important to the science itself? I mean, is
- 3:45Speaker 1: it just about saving a corporation a few minutes of
- 3:47Speaker 1: cloud computing costs? Or does speed actually change the quality
- 3:51Speaker 1: of the model?
- 3:51Speaker 2: Oh, speed changes everything because it enables iteration. Iteration is
- 3:56Speaker 2: like a fundamental truth of this field. The authors make
- 3:59Speaker 2: it very clear that data scientists never get the model
- 4:01Speaker 2: right on the first try.
- 4:03Speaker 1: They don't just write a brilliant algorithm and call it
- 4:05Speaker 1: a deack never.
- 4:05Speaker 2: They don't just hit compile and walk away. They have
- 4:07Speaker 2: to tweak it constantly adjusting what we call hyper parameters.
- 4:12Speaker 2: Testing different inputs.
- 4:13Speaker 1: Wait before we go further. Hyper parameters are those just
- 4:16Speaker 1: like the dials and knobs on the side of the algorithm.
- 4:19Speaker 2: That is a brilliant way to visualize it. Think of
- 4:22Speaker 2: an algorithm like an amplifier, and the hyper parameters are
- 4:25Speaker 2: your base trouble and gain knobs. The data scientist has
- 4:30Speaker 2: to constantly twist those knobs, run the data through, listen
- 4:34Speaker 2: to the output, and twist them again until the signal
- 4:37Speaker 2: is perfectly clear.
- 4:38Speaker 1: Ah, I see.
- 4:39Speaker 2: And in a framework like map produce, where you have
- 4:42Speaker 2: to read the data set from a hard drive every
- 4:44Speaker 2: single time you tweak a knob, that delay physically limits
- 4:47Speaker 2: how many combinations you can try in a day.
- 4:49Speaker 1: But Spark removes that friction.
- 4:51Speaker 2: Right with sparks in memory processing, you can iterate endlessly.
- 4:55Speaker 2: You can twist the knobs a thousand times.
- 4:57Speaker 1: A minute, so Spark gives us this incredible lightning fast engine.
- 5:01Speaker 1: But an engine still needs fuel. Right, you can iterate fast,
- 5:05Speaker 1: but if the raw material is going into our sausage
- 5:07Speaker 1: factory or garbage, that speed is actually dangerous, absolutely dangerous.
- 5:12Speaker 2: And the data we collect in the real world is
- 5:15Speaker 2: just incredibly stubbornly.
- 5:16Speaker 1: Messy, which brings us to what the text calls the
- 5:19Speaker 1: most tedious but absolutely most critical step in the entire
- 5:23Speaker 1: pipeline data cleansing.
- 5:24Speaker 2: Yeah, the ausers really emphasized that the vast majority of
- 5:27Speaker 2: the work in any successful analysis isn't the cool math.
- 5:31Speaker 2: It lies in pre processing the raw data, and one
- 5:34Speaker 2: of the toughest challenges. There is a problem known as
- 5:36Speaker 2: record linkage.
- 5:37Speaker 1: Record linkage. You might also hear it called entity resolution
- 5:41Speaker 1: or emergent purge. Right.
- 5:42Speaker 2: Exactly.
- 5:43Speaker 1: This is the process of looking at two different records
- 5:45Speaker 1: in your massive database and trying to figure out if
- 5:48Speaker 1: they are actually pointing to the exact same physical thing
- 5:50Speaker 1: in the real world.
- 5:52Speaker 2: Right. Let's say you're pulling in data from multiple source
- 5:55Speaker 2: systems like a sales database and a marketing database. A
- 5:59Speaker 2: customer or a business might be entered with slightly different names,
- 6:02Speaker 2: or you know a typo in their address, and.
- 6:04Speaker 1: You need to link those to get an accurate picture.
- 6:06Speaker 2: Exactly. But a simple equality test where the computer just
- 6:10Speaker 2: asks if string A perfectly matches string B, well, that's
- 6:13Speaker 2: going to fail miserably the moment someone misspells a street name.
- 6:16Speaker 1: The book has a fantastic, incredibly relatable example of this
- 6:20Speaker 1: that we have to talk about. So imagine you were
- 6:22Speaker 1: looking at a list of business listings. Listing number one
- 6:25Speaker 1: is Josh's coffee shop located in West Hollywood. Okay, Listing
- 6:29Speaker 1: number two is josh Coffee located in Hollywood, and they
- 6:33Speaker 1: share the same phone number.
- 6:34Speaker 2: Right, So, to a human being, the context makes it
- 6:37Speaker 2: instantly obvious a data entry error left off the west
- 6:40Speaker 2: in Hollywood and the S in Josh's. We intuitively know
- 6:44Speaker 2: they're the exact same small coffee shop.
- 6:47Speaker 1: But then you can trast that with the second part
- 6:49Speaker 1: of the example. Listing three is Coffee Chain number twelve
- 6:53Speaker 1: thirty four located at fourteen hundred Sunset Blvd, Suite two.
- 6:58Speaker 1: Listing four is Coffee we Chain regional office located to
- 7:01Speaker 1: the exact same address, and they share the exact same
- 7:04Speaker 1: corporate phone number in Seattle.
- 7:06Speaker 2: Now, a computer looking at the raw similarity of those fields,
- 7:11Speaker 2: the identical address, the identical phone number, it might assume
- 7:15Speaker 2: they're the same entity.
- 7:16Speaker 1: But you and I know that a local retail coffee
- 7:18Speaker 1: shop branch and the regional corporate office are two totally
- 7:21Speaker 1: different things. You don't go to the corporate office to
- 7:23Speaker 1: buy a latte.
- 7:24Speaker 2: Right, human brains spot that difference in a millisecond because
- 7:28Speaker 2: we have a lifetime of context about how businesses operate.
- 7:31Speaker 2: But trying to write a hard coded rule to teach
- 7:33Speaker 2: a computer that distinction it feels impossible.
- 7:36Speaker 1: Because how do you tell the computer to ignore the
- 7:38Speaker 1: city difference in the first example, but care deeply about
- 7:41Speaker 1: the name difference in the second.
- 7:42Speaker 2: You've hit on exactly why record linkage is such a
- 7:44Speaker 2: thorny computational problem. The criteria we use to make the
- 7:49Speaker 2: duplicate or not duplicate decision changes depending on the specific
- 7:52Speaker 2: context of the pair.
- 7:53Speaker 1: So you can't just use simple true or false rules.
- 7:56Speaker 2: No, you have to dive into probabilistic matching. This system
- 8:00Speaker 2: calculates the likelihood of a match based on complex string
- 8:03Speaker 2: edit distances and weighted fields. It is mathematically grueling work.
- 8:09Speaker 1: There is a terrifying insight from the text here that
- 8:11Speaker 1: I think you the listener, really need to hear. We've
- 8:14Speaker 1: all heard the phrase garbage in garbage out right. If
- 8:17Speaker 1: your data is obviously full of blank fields and errors,
- 8:21Speaker 1: your result will be obviously bad. But the authors argue
- 8:24Speaker 1: that obvious garbage isn't the real danger.
- 8:27Speaker 2: It's not the real danger is getting a completely reasonable
- 8:30Speaker 2: looking answer from a reasonable looking data set that secretly
- 8:34Speaker 2: has major equality issues hiding under the surface.
- 8:37Speaker 1: That is wild.
- 8:38Speaker 2: It is the silent killer of data projects, because if
- 8:41Speaker 2: you don't properly handle record linkage, your algorithm might run flawlessly.
- 8:46Speaker 2: It might output a clean, confident prediction, and a company
- 8:49Speaker 2: might make massive financial decisions based on it.
- 8:51Speaker 1: But because the underlying entities were merged incorrectly, like combining
- 8:55Speaker 1: a thousand retail stores at their corporate offices, the entire foundation.
- 8:59Speaker 2: Is flawed, exactly as the authors bluntly state, Drawing significant
- 9:03Speaker 2: conclusions based on this kind of invisible mistake is the
- 9:07Speaker 2: sort of thing that gets data scientists fired.
- 9:09Speaker 1: Okay, so we survive the sausage factory. We've used spark
- 9:14Speaker 1: to rapidly iterate, we've carefully linked our messy records without
- 9:17Speaker 1: getting fired. What do we actually build with all this?
- 9:21Speaker 2: Let's apply this pipeline to something you interact with every
- 9:23Speaker 2: single day, music recommendations Yes.
- 9:26Speaker 1: To explore how recommendation engines actually function, the authors use
- 9:30Speaker 1: this fascinating data set published back in two thousand and
- 9:33Speaker 1: five by Audio Scrobbler.
- 9:34Speaker 2: Which was the foundation for the first music recommendation system
- 9:37Speaker 2: for last dot fm.
- 9:38Speaker 1: Right, and even by today's standards, this data set is substantial.
- 9:42Speaker 1: We are talking one hundred and forty one thousand unique users,
- 9:45Speaker 1: one point six million unique artists, and over twenty four
- 9:48Speaker 1: million recorded plays.
- 9:49Speaker 2: But what makes this data set so interesting isn't just
- 9:52Speaker 2: the here scale of it, but the type of data
- 9:54Speaker 2: it relies on. The entire system is built on what
- 9:56Speaker 2: is called implicit feedback.
- 9:58Speaker 1: Okay, implicit feedback.
- 10:00Speaker 2: Think about the difference between implicit and explicit data. Explicit
- 10:04Speaker 2: data is when a user actively gives a song a
- 10:07Speaker 2: five star rating or a thumbsuck. They are explicitly stating
- 10:10Speaker 2: their preference.
- 10:11Speaker 1: They're telling the machine exactly what they.
- 10:13Speaker 2: Think, right. Implicit data, on the other hand, is just
- 10:16Speaker 2: a passive record of an action. In this audio Scrabbler
- 10:19Speaker 2: data set, it's just a raw record that a user
- 10:22Speaker 2: played a song.
- 10:23Speaker 1: Okay, here's where it gets really interesting. I have to
- 10:25Speaker 1: push back on this. If the algorithm is basing my
- 10:29Speaker 1: entire taste profile on plays, isn't that a wildly weak signal?
- 10:34Speaker 2: What do you mean?
- 10:34Speaker 1: Well, think about your own habits. I fall asleep with
- 10:37Speaker 1: Spotify running all the time, or what if I put
- 10:39Speaker 1: an album on realize I absolutely hate the first track,
- 10:42Speaker 1: But the doorbell rings, so I walk away and the
- 10:44Speaker 1: album just keeps playing to an empty room. The computer
- 10:47Speaker 1: thinks I loved it.
- 10:48Speaker 2: That is a very fair point. A single implicit data
- 10:51Speaker 2: point carries far less information than an explicit five star rating.
- 10:55Speaker 2: It's a very noisy, highly flawed signal.
- 10:58Speaker 1: Because it captures all those accidents.
- 11:00Speaker 2: Absolutely going to capture accidental plays, skip tracks, that registered
- 11:04Speaker 2: as plays, shared accounts, all of it. However, the sheer
- 11:08Speaker 2: volume of implicit data more than makes up for that.
- 11:11Speaker 1: Noise, because listeners rarely take the time to explicitly rate
- 11:14Speaker 1: things anymore. I mean, I can't remember the last time
- 11:16Speaker 1: I actually clicked a star rating on a podcast or
- 11:19Speaker 1: a song exactly.
- 11:20Speaker 2: People are incredibly lazy with explicit feedback. You might only
- 11:24Speaker 2: get ratings from the most extreme fans or the most
- 11:26Speaker 2: vocal critics, which heavily skews your data.
- 11:29Speaker 1: That makes sense, but.
- 11:30Speaker 2: People generate implicit play data constantly, just by going about
- 11:34Speaker 2: their day. So while a rating data set might give
- 11:37Speaker 2: you highly accurate info on a few dozen songs, a
- 11:39Speaker 2: user loved and implicit data set gives you tens of
- 11:42Speaker 2: thousands of data points on their broader behavior. The massive
- 11:46Speaker 2: volume simply overpowers the individual moments of noise.
- 11:49Speaker 1: Okay, so we have twenty four million vague, noisy plays
- 11:53Speaker 1: spanning one point six million artists. The million dollar question
- 11:56Speaker 1: is how do we turn that massive pile of passive
- 11:59Speaker 1: actions into a highly accurate, personalized playlist, one that makes
- 12:03Speaker 1: you feel like the computer is reading your mind.
- 12:05Speaker 2: This brings us to the core math latent factor models,
- 12:09Speaker 2: and the specific algorithm the authors deploy and smart to handle.
- 12:12Speaker 2: This is called alternating least squares or als.
- 12:17Speaker 1: Okay, let's start with the latent factor part. The book
- 12:20Speaker 1: uses an analogy here that really clarified this for me.
- 12:23Speaker 1: Imagine looking at a single customer's listening history. They are
- 12:27Speaker 1: frequently buying albums by extremely aggressive heavy metal bands like
- 12:31Speaker 1: Megadeth and Pantera, right, But interspersed in those purchases, they
- 12:35Speaker 1: are also buying albums by the classical composer Mozart. Now,
- 12:39Speaker 1: if you just look at the raw metadata, it seems
- 12:40Speaker 1: completely random. What do Megadeath and Mozart possibly have in common?
- 12:45Speaker 2: On the surface, nothing They share no genres, no instruments,
- 12:49Speaker 2: no vocal styles, but a latent factor model doesn't care
- 12:52Speaker 2: about the labels we put on music. It tries to
- 12:54Speaker 2: explain those seemingly random observed interactions through a small number
- 12:58Speaker 2: of unobserved underlying reasons.
- 13:00Speaker 1: And those hidden reasons are the latent factors.
- 13:02Speaker 2: Exactly. The underlying reason. The latent factor might be that
- 13:05Speaker 2: this user enjoys a specific, complex spectrum of music that
- 13:09Speaker 2: spans from aggressive metal through highly technical progressive rock all
- 13:14Speaker 2: the way to intricate classical compositions.
- 13:17Speaker 1: Oh wow, so the algorithm doesn't know the word metal.
- 13:20Speaker 2: Or classical not at all, just mathematically discovers this invisible
- 13:24Speaker 2: bridge connecting these disparate artists based on how millions of
- 13:27Speaker 2: users behave in tandem.
- 13:28Speaker 1: That is wild. So how does it actually discover those bridges.
- 13:32Speaker 2: To do that? The algorithm uses matrix factorization. I want
- 13:35Speaker 2: you to picture a massive spreadsheet. We will call this
- 13:37Speaker 2: matrix a The rows going down the side are one
- 13:40Speaker 2: hundred and forty one thousand users. The columns going across
- 13:43Speaker 2: the top are the one point six million artists.
- 13:46Speaker 1: Okay, I'm with you.
- 13:47Speaker 2: If a user played an artist, there's a number in
- 13:49Speaker 2: that intersecting cell. If they didn't play them, it is
- 13:51Speaker 2: a zero.
- 13:52Speaker 1: I am trying to picture the spreadsheet in my head.
- 13:54Speaker 1: One hundred and forty one thousand rows by one point
- 13:56Speaker 1: six million columns, That is over two hundred and twenty
- 13:58Speaker 1: five billion individual cells. It is massive, and because no
- 14:02Speaker 1: single user has listened to even a fraction of one
- 14:05Speaker 1: point six million artists, almost every single cell in that
- 14:08Speaker 1: giant spreadsheet is zero. Right. It's incredibly sparse.
- 14:11Speaker 2: It is over ninety nine percent empty. So the mathematical
- 14:14Speaker 2: process of matrix factorization takes this massive, mostly empty matrix
- 14:19Speaker 2: A and breaks it down or factors it into two
- 14:23Speaker 2: much smaller, skinny matrices. That's called the matrix X, which
- 14:26Speaker 2: represents the users, and matrix Y, which represents the artists.
- 14:30Speaker 1: This reminds me of the jigsaw puzzle visual from.
- 14:32Speaker 2: The text Well that's a good one.
- 14:34Speaker 1: Yeah. When you only have a few scattered pieces of
- 14:36Speaker 1: a puzzle sitting on a giant table, it's incredibly hard
- 14:39Speaker 1: to describe what the picture is. That scattered table is
- 14:42Speaker 1: our giant, mostly empty matrix A. But if you actually
- 14:46Speaker 1: force those pieces together to finish the puzzle, you realize
- 14:49Speaker 1: it's just a simple picture of a cat.
- 14:51Speaker 2: Right, the complexity disappears.
- 14:52Speaker 1: Matrix X and y are the simple underlying reality of
- 14:55Speaker 1: the cat. The algorithm is trying to find that simple
- 14:58Speaker 1: truth hidden in the scattered pieces precisely.
- 15:01Speaker 2: And to find that cat mathematically, you have to multiply
- 15:04Speaker 2: matrix x and matrix y together to recreate the original
- 15:08Speaker 2: matrix A. But there's a massive catch twenty two here.
- 15:12Speaker 1: Wait. Yeah, because basic algebra says you can't solve a
- 15:14Speaker 1: complex equation if you have two entirely unknown variables at
- 15:18Speaker 1: the exact same time. We don't know matrix x and
- 15:20Speaker 1: we don't know matrix hy. So how does the algorithm
- 15:22Speaker 1: actually calculate this?
- 15:23Speaker 2: What's fascinating here is the alternating part of alternating le squares.
- 15:28Speaker 2: Since the algorithm can't solve for both x and y
- 15:30Speaker 2: at the same time, it simply fakes one of them.
- 15:33Speaker 1: Wait, it just fakes it.
- 15:34Speaker 2: Yeah, It initializes the artist matrix matrix y with completely random,
- 15:39Speaker 2: entirely made up numbers.
- 15:40Speaker 1: It just guesses wildly.
- 15:41Speaker 2: The guesses wildly. But here is the trick. Once you
- 15:44Speaker 2: pretend that matrix y is a known fixed value, the
- 15:47Speaker 2: unsolvable equations suddenly becomes solvable. It becomes trivial to use
- 15:51Speaker 2: basic linear algebra to perfectly solve for matrix X.
- 15:54Speaker 1: But X was just solved using a fake Y, so
- 15:57Speaker 1: X is completely wrong too.
- 15:59Speaker 2: It is wrong, but, and this is key, it is
- 16:01Speaker 2: slightly less wrong than the completely random numbers we started with.
- 16:05Speaker 2: So now the algorithm locks in that newly calculated, slightly
- 16:08Speaker 2: less wrong matrix X. It treats X as the fixed truth,
- 16:13Speaker 2: and it works backward to solve for brand new matrix y. Ah.
- 16:16Speaker 2: It alternates, It alternates back and forth millions of times. Yeah,
- 16:20Speaker 2: solve X using Y, then solve Y using X. With
- 16:23Speaker 2: each single alternation, the square differences between the predicted matrix
- 16:27Speaker 2: and the actual user data gets just a tiny bit smaller.
- 16:30Speaker 1: Which is the least squares part of the name exactly.
- 16:33Speaker 2: It methodically shrinks the air until it eventually converges on
- 16:36Speaker 2: a highly accurate approximation of the underlying reality. The latent
- 16:40Speaker 2: tastes emerge from the math, so.
- 16:41Speaker 1: The math turns, the matrices alternate, the errors shrink, and
- 16:45Speaker 1: eventually the algorithm spits out a list of recommended artists
- 16:48Speaker 1: for a user. But how do we know if it
- 16:51Speaker 1: actually worked? Like, how do we know if those alternating
- 16:53Speaker 1: guesses generated a genuinely good recommendation for the listener.
- 16:57Speaker 2: Evaluating a recommendation engine is notoriously difficult. Actually, it raises
- 17:01Speaker 2: this fascinating problem about subjective human judgment versus mathematical truth.
- 17:05Speaker 1: The authors dive into a specific test case from the
- 17:08Speaker 1: data set that I think illustrates us perfectly. They isolate
- 17:11Speaker 1: a single listener user twosero nine three, seven, six to zero.
- 17:15Speaker 2: Okay, let's look at them.
- 17:16Speaker 1: We look at their actual historical listening history, and it
- 17:19Speaker 1: includes artists like David Gray, Black Delicious, Jurassic five Exhibit,
- 17:23Speaker 1: and the Irish rock band the Saw Doctors. It is
- 17:26Speaker 1: this really specific, nuanced mix of mainstream pop, underground nineties
- 17:30Speaker 1: hip hop, and Irish rock.
- 17:32Speaker 2: Right, So the data scientist asks their firstly baked als
- 17:35Speaker 2: model to recommend five brand new artists for this user
- 17:38Speaker 2: based on those latent factors, and the algorithm recommends fifty
- 17:41Speaker 2: cent j Z, Kanye West, Tupac, and the Game.
- 17:45Speaker 1: So did the algorithm just completely fail? I mean, we've
- 17:48Speaker 1: fetted a nuanced history including Jurassic five and the Saw Doctors,
- 17:51Speaker 1: and it basically just handed us a generic list of
- 17:53Speaker 1: the most mainstream, commercially successful hip hop artists of two
- 17:56Speaker 1: thousand and five. At first glance. That looks like a terrible,
- 17:59Speaker 1: non personal life recommendation.
- 18:01Speaker 2: It certainly looks like a failure to a human observer
- 18:04Speaker 2: who might be looking for a clever indie rock recommendation.
- 18:08Speaker 2: But that is the problem with subjective judgment. How do
- 18:12Speaker 2: we objectively mathematically prove if the algorithm is doing a
- 18:15Speaker 2: good job across all one hundred and forty one thousand users.
- 18:18Speaker 1: Right, Because you can't have a human manually judge every
- 18:21Speaker 1: single output.
- 18:22Speaker 2: Exactly, and you can't just test the algorithm by asking
- 18:25Speaker 2: it to recommend music the user has already played.
- 18:27Speaker 1: Because a recommender's entire job is to find new things.
- 18:30Speaker 1: If it just tells me to listen to David Gray again,
- 18:33Speaker 1: it hasn't discovered a latent taste. It just memorize my
- 18:36Speaker 1: history bingo.
- 18:37Speaker 2: To solve this, the authors explain the proper evaluation technique.
- 18:41Speaker 2: You take a user's actual listening history, and you purposefully
- 18:45Speaker 2: hide a portion of their plays from the model. You
- 18:47Speaker 2: hold that data back, effectively blinding the algorithm to a
- 18:51Speaker 2: portion of reality.
- 18:52Speaker 1: Okay, so you train the model on say, eighty percent
- 18:55Speaker 1: of their history, and keep the other twenty percent locked
- 18:58Speaker 1: in a vault.
- 18:59Speaker 2: Then you ask the algorithm to rank all one point
- 19:02Speaker 2: six million artists in the entire database for that user,
- 19:05Speaker 2: from best fit to worst fit. If the algorithm is
- 19:08Speaker 2: truly working, it should naturally rank those hidden artists, the
- 19:12Speaker 2: ones in the vault, very near the top of that
- 19:14Speaker 2: one point six million list, even though it was never
- 19:17Speaker 2: explicitly told the user listened to them.
- 19:19Speaker 1: Oh that's brilliant.
- 19:20Speaker 2: That is how you objectively prove the latent factors are
- 19:24Speaker 2: actually capturing the shape of the user's taste.
- 19:27Speaker 1: So we step back and we look at this whole pipeline.
- 19:29Speaker 1: We've gone from the messy reality of data collection, the
- 19:32Speaker 1: challenge of linking records with probabilistic matching, the noise of
- 19:36Speaker 1: implicit feedback, all the way to alternating matrices to uncover
- 19:40Speaker 1: hidden preferences. And why does this matter to you, the listener,
- 19:43Speaker 1: Because this exact pipeline is running your life.
- 19:46Speaker 2: Oh it really is. Every single time you open Spotify, Netflix,
- 19:49Speaker 2: or Amazon, you are generating implicit.
- 19:52Speaker 1: Actions just by clicking around.
- 19:53Speaker 2: Yeah, lingering on a movie title for three seconds, skipping
- 19:57Speaker 2: a track halfway through, clicking a product and then hitting
- 19:59Speaker 2: the back button. All of those tiny, seemingly insignificant actions
- 20:04Speaker 2: are being ingested, cleaned, and fed into giant matrices to
- 20:10Speaker 2: uncover latent tastes you didn't even know you had.
- 20:12Speaker 1: So when you feel like Spotify just read your mind
- 20:14Speaker 1: with a perfect discovery playlist, it didn't. It just solved
- 20:17Speaker 1: matrix sex. It's that illusion of magic we talked about
- 20:20Speaker 1: at the top of the show. We think the machine
- 20:22Speaker 1: knows our soul. We think the tech is clean and brilliant.
- 20:26Speaker 2: But beneath the surface, it is a sausage factory exactly.
- 20:29Speaker 1: It's a sausage factory of noisy data, probabilistic guesses, and
- 20:33Speaker 1: millions of alternating calculations zeroing in on who we are
- 20:36Speaker 1: based on the faint, messy footprints we leave behind.
- 20:39Speaker 2: It is an elegant yet brutal mathematical approximation of human preference.
- 20:44Speaker 1: Which leaves us with a final thought, tom all over.
- 20:47Speaker 1: If these algorithms like alternating least squares rely entirely on
- 20:52Speaker 1: what you and millions of others have already done your
- 20:54Speaker 1: pass implicit behavior, are they actually discovering new, unique tastes
- 20:58Speaker 1: for you, or are they just mathematically trapping you in
- 21:01Speaker 1: an inescapable echo chamber, constantly reinforcing the person you used
- 21:05Speaker 1: to be.
- 21:05Speaker 2: A fascinating mathematical loop.
- 21:07Speaker 1: To end on, something to think about the next time
- 21:09Speaker 1: you're streaming up cues, up the exact song you expected.
- 21:12Speaker 1: Until next time, keep digging beneath the surface.