Teacher Daydreamer

View Original

Algorithms to Live By

Source: https://algorithmstoliveby.com/

I get it. Humans aren’t robots. Especially if you’re an educator.

Teachers work in an emotionally charged environment, no matter how much we try to think logically or stay rational. Just think about it—elementary teachers even focus on teaching social-emotional skills, also known as How to Be Human 101.

In today’s fast-paced world, computers can whip through tasks in no time, using algorithms to make everything more efficient, analyze tons of data, and make quick decisions.

It makes you wonder: what if we could take some cues from those algorithms to improve our own lives?

Inspired by the book Algorithms to Live By, we’ll dive deeper into these cool ideas, showing how the basic principles of computer logic can be practical tools for tackling everyday challenges.

Whether it’s managing our schedules or making big life decisions, I’m here to show how thinking like a computer can help us live more intentional and impactful lives as teachers.

Click on any links to get started, or just read on!

1. Optimal Stopping

2. Scheduling

3. Overfitting

4. Exponential Backoff

5. Game Theory


See this content in the original post
  1. Optimal Stopping

If you spend too much time thinking about a thing, you’ll never get it done.

- Bruce Lee

The 37% Rule

Imagine you’re an employer trying to hire someone for a job.

There are a few things to keep in mind:

  1. The goal is to find the best candidate for the job.

  2. You need to hire someone right away. If you let a candidate go, they might not be available later, so you can’t come back to them.

  3. You don’t have any information about the applicants ahead of time, so the only way to assess the “best” is by comparing them to the ones you’ve already interviewed.

This creates a challenge: How many applicants should you interview before making a decision?

If you stop too soon, you could miss out on the best person.

But if you wait too long, you risk losing a strong candidate and could end up hiring the last one you see, even if they're not great.

It's worth noting that just being the best on paper doesn’t guarantee they’ll get the job immediately.

For example, the first candidate you interview might seem like the best candidate so far, but since you have nothing to compare them to, you have to let them go. This way, you can weigh future candidates against them.

Let’s say we have three candidates:

  1. Morgan (mid candidate)

  2. Blake (best candidate)

  3. Willie (worst candidate)

In this scenario, you must reject Morgan first. Then, you can compare Blake to Morgan. Since Blake is clearly better, you can confidently offer Blake the job.


Now, picture a different order:

  1. Blake (best candidate)

  2. Morgan (mid candidate)

  3. Willie (worst candidate)

You’d have to let Blake go without realizing he’s the best candidate. You’d compare Morgan to Blake; since Morgan isn’t better, you’d also let Morgan go. That could leave you stuck with Willie, just by default, since he’s the last one standing.

If you think about it, there are six possible ways to arrange these three candidates, and you’d pick Blake about 50% of the time.

Now, what if you throw in a fourth candidate, Elliot (even worse candidate)?

With four candidates, there are 24 different arrangements. Following the same logic, you’d end up with the best candidate in about 11 out of 24 tries, or 46% of the time.

So, as the number of candidates grows, your chances of picking the best one get lower.

This is known as the “Secretary Problem” and made its first wide appearance in the 1960s.

It turns out there is a mathematical way to make the best decision: stop after looking at about 37% of all candidates. This is called the 37% Rule.

To break it down, this process can be divided into two phases: the "look" phase and the "leap" phase.

During the "look phase," take the time to interview a set number of candidates just to gather some info. You won’t make any decisions yet, but this helps you understand what to expect.

In the "leap phase," you hire the next candidate who shows they’re better than everyone you've seen so far.

For example, with 100 candidates, if you interview about 37 and don’t hire any of them, then pick the next candidate who is better than all the others you've checked out, you’d have a 37% chance of landing the best one.

This holds true even if you have a thousand or a million candidates—the chances still stay around 37%.

In some scenarios, it may make sense to initially look at about 37% of the options without deciding, then go for the next option that trumps the previous ones.

This idea can even be useful for teachers in their decision-making processes. How? I’m glad you asked.

Secrets of Lesson Planning: Embrace the 37% Rule

A common struggle I had was figuring out how much time to spend searching for inspiration without getting stuck trying to find the “perfect plan.”

If we're planning to spend an hour looking up lesson ideas, we can use the 37% rule—so we’d spend 22 minutes in the “look phase” searching for ideas.

The cool thing is, unlike the secretary problem, we can return to any lesson plans we've already found.

When time’s up, we can check out everything we've discovered and then dive into the “leap phase” to pick the lesson plan that stands out.

From there, we can tweak things to tailor them to our class needs.

But if you’re new to teaching or aren’t sure which strategies to try, the next section may be helpful.

Finding the Optimal Approach with Teaching Strategies

When planning a lesson, teachers might look into different teaching methods to try in their classrooms.

Using the 37% rule, teachers new to the field or who are interested in trying out new ideas, can try out and play around with a bunch of different strategies.

For instance, here are ten teaching strategies that you could be interested in trying out:

  1. Class discussions

  2. Think-Pair-Share

  3. Exit tickets

  4. Flipped classrooms

  5. Classroom competitions

  6. Point systems

  7. Project-based learning

  8. Think-aloud

  9. Peer assessments

  10. Jigsaw

Perhaps there’s not enough time to try out all these strategies by the time you read this.

Try out 37% of the strategies listed (in this case, three strategies), and whichever works for you, keep using that strategy for the rest of the year.

Perhaps there’s plenty of time to try out all these strategies by the time you read this.

Spend 37% of the school year—September to November—to experiment with them all. Once you find what works, commit to using those strategies for the remainder of the year.

A Balanced Approach to Grading Rubrics

Grading student work, especially creative writing or projects, can be tricky because it's often subjective.

Using the 37% rule, teachers can look at 37% of the submissions to create a good sense of how students perform overall, which helps set clear criteria and standards.

Once you have a feel for the work, you can create a rubric that matches the class level and fairly evaluates everyone's efforts. This way, it supports students in their growth and helps them improve.

Choosing the “Right” Degree for You

This is for my former students who are thinking about college or are already there but still figuring out their major.

Choosing what to study can feel like a lot of pressure. You might ask yourself which classes to take and how to know if you're picking the right path.

What if we use the 37% rule here?

A typical bachelor’s degree needs around 120 credit hours, so 37% is about 45 credit hours, or around 15 courses if each class is 3 credits.

To make things easier, think about choosing classes that also work for different majors. That way, when you finally decide on a major, you’ll already have a good number of credits under your belt.

Remember, this might take more time and money, but it’s a solid way to explore your options.


See this content in the original post

2. Scheduling

How we spend our days is, of course, how we spend our lives.

- Annie Dillard

Some teachers really know how to manage their tasks, while others find themselves scrambling. This section is all about getting things done efficiently to help with time management.

I bring this up because I think time management is an important skill teachers must master.

Everything can get crazy quickly, with all the deadlines for grades, assignments, meetings, and lesson plans just piling up. On top of that, there are those unexpected tasks, interactions with students, and emergencies that pop up. All the while, your name is getting called every ten seconds.

So, how can algorithms come to our rescue? Let’s find out.

Earliest Due Date (EDD)

In the book, the Earliest Due Date (EDD) is the first algorithm discussed.

It’s pretty simple: tackle the tasks that are due the soonest first and work your way to the ones that are due later. It’s like serving customers in a restaurant based on who walked in first—easy and straightforward.

The strategy is fairly intuitive.

This strategy works well if our main goal is to “reduce lateness” and complete tasks with the shortest deadlines. It’s so effective that computer scientists often consider it an optimal strategy in most cases.

There are certainly reasons why a teacher would use the EDD:

  • Ensures deadlines are met (obviously)

    • Ex: Getting class attendance submitted before jumping into the first lesson of the day.

  • Cuts down on late work

    • Ex: Keeps tasks like grades, lesson plans, and reports on track without falling behind.

  • Encourages habit of staying ahead of the game

    • Ex: Constantly preparing for upcoming tasks and events

But there are some downsides to this approach, like:

  • Doesn't consider how complex tasks are

    • Ex: Differentiating a 30-minute reading lesson plan vs. printing out science fair flyers

  • Misses the importance of some tasks

    • Ex: Social studies classes happen every Monday afternoon, but Tuesday is the first day of the math standardized test.

  • Assumes that tasks won’t change

    • Ex: Trying to conduct a scavenger hunt outside for science when a student lockdown drill went off

  • Not helpful for deadlines that overlap

    • Ex: Planning for next week’s classroom observation math lesson, but also putting together an anchor chart for writing

In teaching, time is always tight, so the Earliest Due Date scheduling method works great for getting things done. However, Christian and Griffiths also discuss another approach worth considering.

Shortest Processing Time (SPT)

Have you felt completely overwhelmed by the amount of stuff on your plate for the day?

Sometimes, deadlines aren’t really your concern, so you might want to try the Shortest Processing Time (SPT) approach.

It’s all about tackling the quickest tasks first.

It reminds me of the “snowball effect.” You knock out the smallest task first, and that little win motivates you to tackle the bigger ones next.

Here are some strengths of the SPT:

  • Gets things done efficiently

    • Ex: Printing out tomorrow’s worksheets today can lighten your load for the rest of the day

  • Great for low-pressure tasks

    • Ex: Sorting out classroom materials before jumping into lesson planning

  • Builds momentum

    • Ex: Grading short quizzes can help you tackle those longer essays more easily

  • Perfect for routine tasks

    • Ex: Spending a few minutes daily tidying up your desk can boost your sense of control

Unfortunately, here are some weaknesses of the SPT:

  • Ignores deadlines

    • Ex: Grading a bunch of short quizzes that only take about 30 minutes, while putting off a pile of essays that are due tomorrow simply because they take longer to get through

  • Penalizes long tasks

    • Ex: Creating tomorrow’s detailed lesson plan may be constantly postponed, while quicker but less impactful tasks, such as updating the classroom bulletin board and cleaning out students’ desks

  • Overlooks long-term goals

    • Ex: Getting caught up with daily tasks without discussing the grading rubric for a project due a month out or sending out field trip permission slips ahead of time


If deadlines aren't a big deal, teachers might want to go with the Shortest Processing Time algorithm. It’s a good option when you’ve got a bunch of stuff on your to-do list for the day.

This leads to our final question.

EDD VS. SPT Verdict?

Both strategies are optimal strategies.

Actually, it is a mixture of both strategies with slight modifications.

If meeting deadlines is your top priority, consider using the Earliest Due Date method. On the other hand, if you want to tackle the quickest tasks first, the Shortest Processing Time algorithm might be your best bet.

That said, blending elements from both approaches can often yield the most effective results.

But there’s also a catch to both approaches that computer scientists have had to deal with: the ability to pause one task in the middle and switch to another.

This is called “preemption,” which just means temporarily stopping one task to tackle another, with the plan to go back to the first one later.

Since we never know what’s coming at us, we must be ready to compare new tasks with what we’re already working on and be okay with hitting pause to switch gears.

As Christian and Griffiths say, it might be impossible to find the perfect schedule, even if we know everything we need to do ahead of time. The best we can do is stay flexible and react as new jobs pop up.


See this content in the original post

3. Overfitting

Excellence does not require perfection.

- Henry James

It usually helps to have more data when we talk about generalizing information.

As people, we naturally do this—our experiences shape our opinions and beliefs the more we learn about a topic. Sometimes, this leads to well-thought-out viewpoints but can also create ignorant biases.

In machine learning, data is crucial for training models, which learn to make predictions based on patterns they see. Machine learning is a part of AI that uses algorithms to learn from data.

When it comes to training models, it's important to know how many data points are needed for them to start generalizing well. I like to think of this as finding lines or curves that show correlations, kind of like the graphs below.

Source: https://medium.com/greyatom/what-is-underfitting-and-overfitting-in-machine-learning-and-how-to-deal-with-it-6803a989c76

Look at the first chart on the left, which demonstrates that the linear generalization of these data points appears “underfitted.” The model may have generalized a correlation between 2-3 data points.

The “good fit,” as seen in the middle, curves more naturally with the data. It’s generalizing an average of data points as it moves along the x-axis.

Now, let’s focus on the chart on the right, which illustrates “overfitting”—something we, as educators, should avoid. This model tries to fit every single data point to perfect the correlation. While that might sound good, bringing in new data points can be a problem. The machine might think the old pattern is exactly how the new info should look, which isn’t ideal.

In their book, Christian and Griffiths explain that fencing was popular for training individuals in sword combat.

However, the dynamics changed with the introduction of the electrical scoring system in the early 1900s. Instead of engaging in direct attacks—a strategy effective in real combat—fencers began to rely on “flicking” their wrists just enough to signal a hit on the scoring device. This shift in technique ultimately left modern-day fencers ill-prepared for actual fighting scenarios.

So, how does this concept of overfitting translate to the teaching profession?

“Teaching to the Test”

Standardized tests play a big role in today's schools, whether you love them or hate them.

Just like fencing has its complex history, the reasons behind standardized testing are pretty layered. Some of these include:

  • Establishing a nationwide benchmark

  • Demonstrating student progress

  • Identifying areas of improvement

  • Impose accountability on schools and teachers

That said, there’s a lot of debate about how well these tests accomplish those goals, and that’s not what we’re diving into right now.

Instead, let’s talk about how the push for better test scores has strayed from what schools are designed to do.

Sure, education has a lot of different facets, and it’s pretty subjective, but it’s odd to think we’re basing everything on annual tests.

Like in modern fencing, teachers adjusted their lessons solely to boost test results. This practice, commonly called “teaching to the test,” has led many educators to lose sight of what schools were originally meant to be and why they wanted to teach in the first place.

So, how does the idea of overfitting connect to teachers?

Think about it this way: if we assume a good teacher should naturally get high test scores, then a bad teacher would naturally have low ones. So, how can that struggling teacher improve?

They could pick up some effective teaching strategies or ask for feedback by having their lessons observed more often.

Or, if those standardized test scores show they’re not performing well overall, they might start shaping their lessons to fit the score-driven model better.

This is how teachers have used—and may still use—overfitting in schools.

Testing the Tests with Cross-Validation

Teachers often use “teaching to the test” strategies to improve their annual class test results. These can be achieved by framing class questions to resemble the format of standardized tests or even by taking practice standardized tests.

A way to prevent overfitting in machine learning is through “cross-validation,” which assesses a model's ability to generalize by testing it on withheld data.

In education, relying solely on test scores can be unfair, as some students are just better at taking tests than others.

To gauge true understanding, we can also offer alternative evaluations, like oral exams, to a small sample of students.

If we notice that practice test scores are going up but oral exam scores aren't changing, it suggests that teachers have overfit their teaching to help students perform on the standardized tests.

Conversely, if both scores improve, the student has truly mastered the content.

If test scores decline while alternative scores rise, it may reveal the student struggles with test-taking, potentially misrepresenting their mastery to school districts.

Teachers really need to take a moment to check in on how they're teaching.

This way, they can figure out if they want to stick with “teaching to the test” or switch things up quickly.


See this content in the original post

4. Exponential Backoff

If at first you don’t succeed, / Try, try again.

- T. H. Palmer

Has this ever happened to you? You're chatting with some friends, and there’s a little pause in the conversation.

Suddenly, you and a friend speak at the same time, and now you’re talking over each other.

If you’re like most people, one of you will probably stop and let the other continue.

But if you and your friend are weirdos or robots, you might keep talking at the same time, completely ignoring that the other person is even speaking.

Exponential Backoff: The Unsung Hero Saves ALOHAnet

In the late '60s and '70s, Norman Abramson at the University of Hawaii had a groundbreaking idea to connect the university’s seven campuses across four islands using a network of transmitters and receivers for radio signals, known as ALOHAnet.

ALOHAnet operated on two radio frequencies: one for sending information from the mainframe to the island stations, and another for receiving messages back. The mainframe would confirm receipt with an acknowledgment.

However, when two stations tried to send data at the same time, their signals would clash, leading to corrupted data. If a station didn’t get an acknowledgment, it would keep resending the message, which could create a frustrating loop of failed attempts, especially if more stations tried to send messages simultaneously.

To fix this, ALOHAnet used a technique called Exponential Backoff. Instead of repeatedly retrying and adding to the chaos, each station would wait longer between attempts—doubling the delay each time.

For example:

  • First attempt: Fails; retry after 1 second.

  • Second attempt: Fails; retry after 2 seconds.

  • Third attempt: Fails; retry after 4 seconds.

  • Fourth attempt: Fails; retry after 8 seconds.

This approach would continue until the message went through or a retry limit was reached.

Pretty cool, right? But how can teachers use this?

Behavior Not-So-Micro-Management

Teachers can use the Exponential Backoff strategy to give students longer breaks to self-correct or think about their actions.

When dealing with disruptive behavior, try this approach:

1. First Instance: Give a gentle reminder right away.

2. Second Instance: Wait 30 seconds before saying anything.

3. Third Instance: Wait 1 minute to let the student figure things out.

4. Fourth Instance: Give it 2 minutes while you quietly keep an eye on them.

Keep this up until the student either makes a change or the behavior gets worse, which may need you to step in further.

Using this method will ease your stress, boost student independence, and cut down on constant micromanagement. Win, win, and win.

Empowering Student Problem-Solving

Teachers can use Exponential Backoff to help students tackle challenges by gradually giving them more time or resources before jumping in with the answers.

When a student is stuck on a math problem, here’s how it could go:

  1. First instance: Give them an immediate hint.

  2. Second instance: Wait 30 seconds before offering another clue.

  3. Third instance: Wait 1 minute before providing additional scaffolding.

  4. Fourth instance: Wait 2 minutes before stepping in again.

Keep stretching those wait times until the student figures it out or it becomes clear they can’t solve it because it’s too challenging for them.

It’s important for educators to be patient and encourage students to work through their problems on their own instead of always handing them the answers. This is a perfect way to do that.


See this content in the original post

5. Game Theory

The best for the group comes when everyone in the group does what’s best for himself and the group.

- John Nash

“Woop-woop, that’s the sound of the police!”

Imagine that you and your best buddy just robbed a bank (I don’t condone crime, but stay with me).

After the heist, you and your friend got arrested and are now in separate jail cells.

You face a crucial decision: choose to “cooperate” or “defect.”

Here are your options:

  1. If both of you cooperate, remain silent, and admit nothing, you will each receive a 1-year prison sentence.

  2. If both of you defect and testify against each other, you will each receive a 10-year prison sentence.

  3. If one of you defects while the other cooperates and remains silent, the defector will be released immediately, while the cooperator will receive a 20-year prison sentence.

Source: https://www.vecteezy.com/vector-art/44032653-the-prisoner-dilemma-is-a-game-theory-thought-experiment-that-involves-two-rational-agents-each-of-whom-can-cooperate-for-mutual-benefit-or-betray-their-partner-for-individual-reward

So what would you do?

This scenario is called the Prisoner’s Dilemma,” and it’s a well-known example of how “game theory” works.

Game theory is all about how people or groups, called "players," make decisions when they interact with one another. The results for each player depend not just on what they choose to do but also on what others decide. It looks at situations where players have to pick strategies to get the best outcomes for themselves, keeping in mind how others might act or react.

Take the classic Prisoner's Dilemma—it’s a scenario where it seems smart to look out for yourself. If you cooperate while your buddy defects, you could end up with a long sentence while they go free. So, most of the time, it feels like the better move is to defect.

If you think they’ll cooperate, you could be tempted to defect to save your own skin. But then you might wonder if they’re thinking the same way. This can turn into a cycle of "What if they know I know they'll cooperate?"

This whole back-and-forth, or recursion, can take a while until you finally make a decision.

The good news is you don’t have to keep worrying about your next move because there’s a straightforward strategy called the "dominant strategy." In this case, defecting is the way to go.

But even with a dominant strategy, it doesn’t guarantee the best outcome. Often, both players still end up serving 10 years. 

But enough about prisoners, game theory, recursion, and dominant strategies. What does this have to do with teaching?

Good Students Are Dead. Evil Kids, Rise Up!

“Oh no… what the heck is happening?!”

We’ve all had those students who really test our patience.

Group punishments, where the whole class suffers for the actions of just a couple of kids, might seem like a good idea, but they usually backfire.

Let’s break down a common situation: Everyone loses recess if a student acts up during class.

Here’s how game theory comes into play:

  • If all the students decide to “play nice,” the whole class gets recess.

  • But if just one person decides to “mess around,” everyone gets punished and misses out on that break.

So, each student has to choose between “playing nice” or “acting out,” cooperating or defecting.


Let’s dig deeper.

If most students think that Bart Simpson or Draco Malfoy in your class will bail anyway, what's stopping the others from doing the same?

We know that if even one student bails, the whole class gets in trouble. But honestly, it's the same if every student jumps ship.

So, it makes sense for everyone to defect, especially when they know someone will. Why even bother trying to cooperate?

This brings up another thing to consider. Group punishments probably aren't the best move for teachers. There are all sorts of things that could go wrong like students getting bullied or ostracized.

I’ve been guilty of this myself in my first year of teaching, and I observed something that made me realize I never wanted to do it again.

If the students are making quality choices in their behaviors but still get punished for the choices of other students, then why should they continue making “good choices?”

That’s exactly what I observed one time. The students who I trusted to make wise decisions started to show little forms of hostility toward me. When I was the one who trusted a majority of the class, I was also the one who ended up breaking that trust.

Pretty soon, it was a class mutiny.

There is one slight problem with the Prisoner’s Dilemma. You may have noticed that the situation forces one to always defect as the dominant strategy, even though it is a “bad strategy.”

So, how can we force cooperation as the dominant strategy?

Easy. Just change the game.

Change the Game

Mechanism design, or “reverse game theory,” works oppositely. It’s all about setting up situations that make cooperation the best choice.

Let’s return to the Prisoner’s Dilemma but with a twist: the Godfather.

Picture this:

You and your buddy are now part of a crime crew, and the Godfather has made it clear that if anyone snitches, they will wish they hadn’t.

Suddenly, defecting doesn’t seem like such a great option. No matter what your buddy thinks, the smartest move is to cooperate and remain silent.

Now, think about how this might work in a classroom.

If students get “caught” helping each other, they could earn extra perks, like a lunch bunch or whatever reward you choose.

I preferred to jot down my observations as positive reinforcement on sticky notes and place it on the students’ desks.

I “post-it” the link here if you want to check it out.

Anyway, the key here is that there are no penalties, which shifts the focus away from defecting. Setting up a reward system that highlights and celebrates cooperation encourages everyone to work together.

Plus, you won’t break students' trust by unfairly punishing them for the acts of others.

No class mutiny, no problem.


Conclusion

Turns out, there's a lot we can learn from computers, especially when it comes to teaching.

We’ve discussed how educators can use the following lessons in their classrooms:

  1. Optimal stopping

  2. Scheduling

  3. Overfitting

  4. Exponential Backoff

  5. Game Theory

Even though the teacher’s life is chaotic, sporadic, and full of randomness, using these computer science lessons can help bring some order to the mix. These are just a few simple strategies to keep in mind.

If you want to dive deeper, here’s the link to the original book that inspired it all.

And if you have thoughts to share or want to connect, feel free to reach out!