Deserialized Cognition

Part Of: [Deserialized Cognition] sequence
Followup To: [Why Serialization?]

You’ve heard the phrase “pre-conceived notion” before. Ever wonder what it means? Let’s figure it out!

Cognitive Style: Conceptiation

Your mind is capable of generating concepts. Let us name this active process conceptiation.

How does this process work in practice? There are only two ways concepts are created: from oneself (inference conceptiation), or from others (social conceptiation):

Deserialization- Conceptiation

Inference Conceptiation attempts to get at self-motivated, non-social cognition. You process information, you form a conclusion (a result), you save this result to memory, and then you pass it along to other cognitive process. Examples:

  • A scientist trying to make progress in string theory
  • An artist teaching herself to speak Spanish

Social Conceptiation summarizes the thought process of someone immersed in a more social setting. Examples:

  • An engineer picking up an proverb (e.g., “no analogy is perfect”) from Facebook, without thinking about it much.
  • A socialite half-listening to some guy at a dinner party describing nuanced work tasks.

During both types of conceptiation, concepts are saved to your long-term memory. Call this serialization.

Cognitive Style: Deserialization

You are a lazy thinker.  Don’t take it personally, though – so is everyone else. How can we explain our inner cognitive miser? It turns out that there are at least two biological reasons for this failing:

  • Brains are slow because they rely on chemical synapses; they run at 100Hz (vs the 2 billion Hz of computers)
  • Brains are metabolically expensive, burning 800% more energy than other organs (20% of total organismic load)

Serialization techniques (discussed previously) allow our brains to be lazy. Not all concepts need to be created from scratch; if, at some point in the past, you have acquired the requisite mindware, you can always resurrect it from long-term memory, in virtue of your built-in deserialization mechanism:

Deserialization- Deserialization

Two Inputs

As mentioned, deserialization (loading) only works if the requisite concepts have been serialized (saved) at some point in the past. Since serialization comes in two flavors, we can now refer to two different kinds of deserialization:

Deserialization- Deserialization Modes (1)

Call the former inference deserialization, and the latter social deserialization.

Application: “I Love You”

Imagine you were raised to believe in the importance of regular expressions of affection to your significant other (SO). So, you say “I love you” to him/her every day. At first, you are eager to tell them the reasons behind your feelings, but after a while, novelty becomes increasingly effortful. Eventually, you settle into a simple “I love you” before falling asleep. Fast forward two years, and your SO says “I don’t feel like you are being affectionate enough”. How can we explain this?

We are now equipped to describe the “I love you” pattern as an instance of deserialized cognition, no? This form of cognition (more specifically, a behavioral pattern) was established previously, and no longer requires active conceptiation to perform. Why should your SO wish for you to employ active processing, especially if such processing yields content very similar to your habituated behavior?

Why would your SO wish you reject serialized cognition? Here’s one path an explanation may take: such an override goes against the instinct of the cognitive miser. Costly signaling is a staple concept in ethology: effort filters between those who truly hold the recipient in high regard and those who only wish to appear that way.

Speaking more generally, it seems to me that our itch for originality come from precisely this will to demonstrate rejection of deserialized cognition.

Takeaways

In this post, we explored how the brain uses concepts via two distinct mechanisms:

  1. In conceptiation, the brain actively constructs & uses novel concepts.
  2. In deserialization, the brain simply reuses pre-existing concepts.

The brain also employs two different ways to create concepts:

  1. Some concepts are constructed by one’s own mind.
  2. Concepts constructed in a social setting are constructed externally, but are (optionally) evaluated by the self.

Putting these together, we are now equipped to refer to four different types of cognition.

Deserialization- Cognition Taxonomy (2)

This new vocabulary opens many doors to explanation, including the question “why do people value originality?”

Credit: Some of the ideas of this post come from previous speculations about cached thoughts. However, compared to deserialization, caching has a weaker analogy strength: concept reuse has precious little to do with enforcing consistency within a memory hierarchy.

Until next time!

Why Serialization?

Part Of: [Deserialized Cognition] sequence

Introduction

Nietzsche once said:

My time has not yet come; some men are born posthumously.

Well, this post is “born posthumously” too: its purpose will become apparent by its successor. Today, we will be taking a rather brisk stroll through computer science, to introduce serialization. We will be guided by the following concept graph:

Concept Map To Serialization

On a personal note, I’m trying to make these posts shorter, based on feedback I’ve received recently. 🙂

Let’s begin.

Object-Oriented Programming (OOP)

In the long long ago, most software was cleanly divided between data structures and the code that manipulated them. Nowadays, software tends to bundle these two computational elements into smaller packages called objects. This new practice is typically labelled object-oriented programming (OOP).

OOP- Comparison to imperative style (1)

The new style, OOP, has three basic principles:

  1. Encapsulation. Functions and data that pertain to the same logical unit should be kept together.
  2. Inheritance. Objects may be arranged hierarchically; they may inherit information in more basic objects.
  3. Polymorphism. The same inter-object interface can be satisfied by more than one object.

Of these three principles, the first is most paradigmatic: programming is now conceived as a conversation between multiple actors. The other two simply elaborate the rules of this new playground.

None of this is particularly novel to software engineers. In fact, the ability to conjure up conversational ecosystems – e.g., the taxi company OOP system above – is a skill expected in practically all software engineering interviews.

CogSci Connection: Some argue that conversational ecosystems is not an arbitrary invention, but necessary to mitigate complexity.

State Transitions

Definition: Let state represent a complete description of the current situation. If I were to give you full knowledge of the state of an object, you could (in principle) reconstitute it.

During a program’s lifecycle, the state of an object may change over time. Suppose you are submitting data to the taxi software from the above illustration. When you give your address to the billing system, that object updates its state. Object state transitions, then, look something like this:

OOP- Object State Transitions

Memory Hierarchy

Ultimately, of course, both code and data are 1s and 0s. And information has to be physically embedded somewhere. You can do this in switches, gears, vacuum tubes, DNA, and entangled quantum particles: there is nothing sacred about the medium. Computer engineers tend to favor magnetic disks and silicon chips, for economic reasons. Now, regardless of the medium, what properties do we want out of an information vehicle? Here’s a tentative list:

  • Error resistant.
  • Inexpensive.
  • Non-volatile (preserve state even if power is lost).
  • Fast.

Engineers, never with a deficit of creativity, have invented dozens of such information vehicle technologies. Let’s evaluate four separate candidates, courtesy of Tableau. 🙂

memory technology comparison

Are any of these technologies dominant (superior to all other candidates, in every dimension)?

No. We are forced to make tradeoffs. Which technology do you choose? Or, to put it more realistically, what would you predict computer manufacturers have built, guided by our collective preferences?

The universe called. It says my question is misleading. Economic pressures have caused manufacturers to choose… several different vehicles. And no, I don’t mean embedding different programs into different mediums. Rather, we embed our programs into multiple vehicles at the same time. The memory hierarchy is a case study in redundancy.

CogSci Connection: I cannot answer why economics has gravitated towards this highly counter-intuitive solution? But, it is important to realize that the brain does the same thing! It houses a hierarchy of trace memory, working memory, and long-term memory. Why is duplication required here, as well? So many unanswered questions…

Serialization

It is time to combine OOP and the memory hierarchy. We now imagine multiple programs, duplicated across several vehicles, living in your computer:

OOP- Memory Hierarchy

In the above illustration, we have two programs being duplicated in two different information vehicles (main memory and hard drive). The main memory is faster, so state transitions (changes made by the user, etc) land there first. This is represented by the mutating color within the objects of main memory. But what happens if someone trips on your power cord, unplugging your CPU before main memory can be copied to the hard drive? All changes to the objects are lost! How do we fix this?

One solution is serialization (known in some circles as marshalling). If we simply write down the entire state of an object, we would be able to re-create it later. Many serialization formats (competing techniques for how best to record state) exist. Here is an example in the JavaScript Object Notation (.json) format:

{“menu”: {
“id”: “file”,
“value”: “File”,
“popup”: {
“menuitem”: [
{“value”: “New”, “onclick”: “CreateNewDoc()”},
{“value”: “Open”, “onclick”: “OpenDoc()”},
{“value”: “Close”, “onclick”: “CloseDoc()”}
]
}
}}

Applications

So far, we’ve motivated serialization by appealing to a computer losing power. Why else would we use this technique?

Let’s return to our taxi software example. If the software becomes very popular, perhaps too many people will want to use it at the same time. In such a scenario, it is typical for engineers to load balance: distribute the same software on multiple different CPUs. How could you copy the same objects across different computers? By serialization!

CogSci Connection: Let’s pretend for a moment that computers are people, and objects are concepts. … Notice anything similar to interpersonal communication? 🙂

Conclusion

In this post, we’ve been introduced to object-oriented programming, and how it changed software to becoming more like a conversation between agents. We also learned the surprising fact about memory: that duplicate hierarchies are economically superior to single solutions. Finally, we connected these ideas in our model of serialization: how the entire state of an object can be transcribed to enable future “resurrections”.

Along the way, we noted three parallels between computer science and psychology:

  1. It is possible that object-oriented programming was first discovered by natural selection, as it invented nervous systems.
  2. For mysterious reasons, your brain also implements a duplication-heavy memory hierarchy.
  3. Inter-process serialization closely resembles inter-personal communication.

Policy Proposal: Metrication

Table Of Contents

  • Back To Basics
  • Meet The English System
  • A Cognition-Friendly Design
  • Global Trends
  • Policy Proposal
  • What Use Are Policy Proposals?
  • Bonus Proposal!

Hm. So, I enjoy discussing this topic. Maybe if I write about it, my Will To Rant will weaken! (Family & friends will be thanking me in no time. 😉 )

Back To Basics

Do you remember how long one meter is? Extend your arms to approximate its length. Now say “meter” about eighteen times, until you achieve semantic satiation. Okay good, I’ve confused you. Your familiarity high was stunting your ability to learn.

Why must a meter be that long? What forbids it from being defined differently?

Nothing. All measurement conventions are arbitrary. Thus, it is possible for every person to use different measurement rules.

But that isn’t how society operates. Why? How do we explain measurement convergence?

It is a cultural technology: it moves attention away from the communicative vehicle and to its content.

Does the above remind you of anything? It should. If I swap out the nouns, I’d be talking about language. The analogy strength is considerable. (Have you yet figured out the mechanism that underwrites analogy strength?)

The funny thing about language is that globalization is murdering it. Of the 6500 languages alive today, fewer than half will survive to 2100 ACE. If you combine this fact to our analogy, you are mentally equipped to forge a prediction:

  • We expect the number of measurement systems to be decreasing.

Meet The English System

In fact, only two comprehensive measurement systems remain. Here is a snapshot of one of them, the English system:

english_system

 

Chances are that you live in the US, and chances are you’ve wrestled with the question “how many ounces in a quart” once in your life.

Let’s be explicit about why we don’t like the above:

  • There is no discernible pattern between the equivalency values (e.g., 2, 1760, 2240, 43,560…) or words (e.g., “cup”, “pint”, “quart”, “gallon”)

Do you agree? Is this is the reason why you winced at the above table?

Even if we agree, we aren’t done. We still need to explain where our complaint comes from. And that explanation is, of course, cognitive:

  • Patterns facilitate memorization, improving performance of long-term memory.
  • Patterns allow for compression, reducing the load on working memory.

A Cognition-Friendly Design

If you were to design a solution to the above problems from scratch, how would you do it?

I doubt I would have been able to invent this technology independently: it is intimidatingly brilliant. Time to meet the quantitative prefix. The basic idea is: why don’t we link equivalency values to the grammar, and infuse mathematical meaning into our prefixes?

The metric prefix is a kind of quantitative prefix. It encodes scale, in increments of 10^3 (i.e., 1000), by the following:

metric_prefixes

 

You can allow your sense of familiarity back in the room. You have, of course, used quantitative prefixes all your life. Do you recognize the words “milli-meter”, “kilo-gram”, “giga-byte”? Well, now you have another tool under your belt: you can now precisely understand words you’ve become accustomed to, and rapidly absorb the meaning of new combinations. Two examples:

  1. If someone were to ask you “what does a micro-gram mean?” you could answer “a millionth of a gram!”
  2. If someone were to ask you “how many bytes in 4 gigabytes?” you could answer “4,000,000,000”! *

(* Unless the person who said gigabyte ACTUALLY meant 4 gibibytes, which is NOT the same thing, and a totally separate rant. 🙂 )

metric_system

Notice that, with this technology, we have the same root word, and only need to modify the prefix to expand our vocabulary. More pleasant, no?

Global Trends

Recall our prediction, that the number of measurement systems would decrease over time. And it has. All countries marked in green use the Metric system:

Global Metrication Status

Notice any outliers? 🙂

It’s not like the United States hasn’t tried. In 1975, Congress passed the Metric Conversion Act… but its efforts were largely disbanded in 1982. You can read more here if you like.

Policy Proposal

  • Proposal: The United States should pursue metrication.

Some drawbacks: Such legislation will cost money, and be inconvenient in the short term.

Some benefits: Improved international relations, promotion of less fuzzy thinking, working memory generally freed up for other tasks.

To me, I’m more worried about the possibility of systemic failure: perhaps any political action that incur short-term-cost in exchange for long-term gain are generally considered hazardous. Perhaps, for example, we could introduce a legislation timers so that the fallout from “eat your vegetables” bills don’t fall on their signatories.

Yes, I’m aware the above example is completely broken. But it is meant to signal the kind of thinking we need: infrastructure refactoring.

What Use Are Policy Proposals?

A large amount of ink has been spilled on the metric system. Many of these contributions dive to a depth greater than mine. I do not expect my career to involve the comprehensive analysis of policy ramifications, the meticulous construction of actionable proposals. I am a voice in the wind. Why do I bother?

I will be collecting policy proposals on this blog for several reasons. Beyond my philosophy of politics, I write because it may bring value to the world, and it helps organize my mental life. I also would like to ultimately find collaborators, like-minded individuals interested in researching with me. But I also write because I hope my unconventional emphases will someday unlock relatively-novel ideas that are of good quality. Here’s an example of an idea that may come from my cognitive emphasis above (no promises on quality though :P):

The above solution of quantitative prefix was ultimately a marriage of mathematical reasoning and grammatical systems. I am unable to technically specify the full cognitive algorithm for why this combination works (yet, darn it!). But it opens the door to brainstorming: how else could we leverage language to crystallize and augment our rational capacities? And then you start casting around for ideas.

Bonus Proposal!

A stream-of-consciousness illustration of the kind of transhumanist creativity I am encouraging.

For me, I recall reading speculations that perhaps one reason Chinese kids tend to score highly in math is because the digits are easier to pronounce. I then search for “chinese digits pronunciation” and find this paper. An excerpt:

These data offer support for the hypothesis that differences in digit memory between Chinese and English speakers are derived, in part, from differences in the time required to pronounce number words in the two languages.

I then wonder if a numeric system could be engineered to supplant our “one”, “two”, “three”, etc with a system more like Chinese, to enhance students’ cognitive capacities. But not exactly Chinese numerals – that phonetic system carries other disadvantages. I envision a new numerical phonetics that, engineered with state-of-the-art computational models of working memory, brings empirically-demonstrable cognitive advantages over its “natural” competitors.

See you next time.

A Secret In The Ark

Part Of: History sequence
Content Summary: 1500 words, 15min read

Context

Today, I want to try something unusual: I want to analyze the story of Noah from a literary perspective. Some surprises lurk beneath the surface.

A Fresh Take On Noah

Try your utmost to read the following with fresh eyes. There will be a quiz after! (Okay, so you can review its four question above, and there is no grade. :P)

Ready to begin? Okay. See you soon!

Examining The Text

Q1. How many animals?

You are to bring into the ark two of all living creatures, male and female, to keep them alive with you. Two of every kind of bird, of every kind of animal and of every kind of creature that moves along the ground will come to you to be kept alive.

Take with you seven pairs of every kind of clean animal, a male and its mate, and one pair of every kind of unclean animal, a male and its mate, and also seven pairs of every kind of bird, male and female

Now, the above seems contradictory.  The difference seems to be:

  • { “clean”:”1 pair” ; “unclean: “1 pair”}     vs    
  • { “clean”:”7 pairs” ; “unclean: “1 pair”}

Is this apparent contradiction a real one? Can it be resolved? Such questions are irrelevant to the argument. The simple point is: there is tension in the narrative.

Q2. How long did the flood last?

Another hard question. Take your best guess.

As you re-read the story, you are probably struck with the fact that there is A LOT of temporal information in this story. The task of constructing a coherent answer is hard. Especially when you compare quotes like these:

For forty days the flood kept coming on the earth

The waters flooded the earth for a hundred and fifty days.

Again, the point here is about tension. Notice your confusion.

Q3. How was the narrative flow?

Yes, the narrative had structure. Yes, its plot holds together. But was it a pleasure to read?

Well, I didn’t think so.

To most modern readers, perhaps, the level of detail is painful, the amount of repetition tiresome. What are we to make of this? Are we to judge the story’s author as less enlightened regarding narrative structure?

A typical counter-argument appeals to chronological snobbery. Writing styles change, and over the millennia they plausibly change a lot.

But this response misses the point. For it turns out that these Israelite authors were better at constructing prose than the text might suggest at first glance.

Q4. What is the point-of-view of the author?

Could you create a compelling answer to this question, dear reader? I’m not sure if I could. My answer would be vague, and would lean heavily on the contents of story itself.

A New Hypothesis

Okay, so we’ve identified a few points of discomfort within the story.  If we modify our beliefs about how it was constructed, can we better explain our confusion?

Consider what happens if we view this text as the work of two different authors. We’d then need to get out two highlighters, and guess which passages come from the first, and which come from the second. Let consider one such guess now. I’d like you to just briefly skim through the following:

Notice anything cool?

As an aside: I want you thinking about how we could automate this “highlighter procedure”. Could we teach a computer how to reconstruct multiple authorship, if and only if such blending had occurred? How would we make it learn the process? How could we test it?

Okay, time to name the authors.

  • The author of the orange text we shall call J: the Jahwist source (because he likes to use the YHWH title).
  • The author of the pink text we shall call P: the Priestly source (for reasons I’ll explain in my next article).

Refining Our Hypothesis

Imagine for a moment I have written a novel. Do you think you would be able to carve my novel into two pieces, and preserve the structure and coherence of both halves?  I suspect not.

Let us name our hypotheses:

  • Let H1 represent the original, one-author hypothesis.
  • Let H2 represent the new, two-author hypothesis.

H2 can be visualized as follows:

Compilation of Noah (2)

I’ve already shown you the right hand side (the previous excerpt). Now, I’ll introduce you to the (more exciting) left hand side: the original narratives.

Evaluating The Evidence

Like good little Bayesians, we have H1 (one author) and H2 (two author) floating around in our mental apparatus.  Which hypothesis best explains this document?

To find out, let’s revisit the evidence.

Q1: How many animals were brought onto the ark?

  • The Jahwist narrative has the rule: 7 pairs for clean animals, 1 pair for unclean animals.
  • The Priestly narrative has the rule: 1 pair of all living creatures.

The tension dissolves.

Notice that the burnt offering only occurs in the Jahwist tale, and he is careful to describe the sacrifice of only clean animals (which in his version, has 7 pairs). No more need to worry about burnt offerings causing extinctions! 🙂

Q2: How long did the flood last?

  • The Jahwist narrative has the flood lasting for 40 days.
  • The Priestly narrative has the flood lasting for 150 days.

The tension dissolves.

Q3: How would you rate the narrative flow?

… it’s a lot better!

Q4: How well can you make out the author’s point-of-view?

Recall that, before, we didn’t have much of an answer: we just mumbled something about the story. But now, look:

  • P only uses the more universal term God (16 times). J uses the more personal YHWH exclusively (10 times).
  • P is interested in details such as ark dimensions, and lineages (only he names the sons of Noah). J is more oriented around the events.
  • P uses very precise dates, reminiscent of a calendar. J uses the numeric theme of 7 and 40.
  • Stylistically, P reads like the work of a scribe. J reads like an epic saga, like the Epic of Gilgamesh.

Epistemic Status

I am not a philologist. I did not make this argument. What do the experts think?

The multiple authorship solution to the story of Noah (H2)  is the consensus of modern academia. It is not a contentious issue.

That this consensus is not public knowledge to those who would like to know is a rather interesting cultural failure mode.

Parting Thoughts

I hope that learning about the two authors of Noah elicited an “aha moment” from you. A few parting thoughts:

  • The debates surrounding apparent contradictions in the Bible would be more useful if they incorporated source criticism results like these.
  • It seems long overdue for resources like BibleGateway to offer different versions of authorship highlighting, just as they do for translation options.
  • Which narrative did the Noah movie borrow from the most, and will the OTHER STORY also land a blockbuster hit? 😉

Next time, I will be immersing this example of multiple authorship inference within the context of the Documentary Hypothesis and the modern atmosphere of Biblical studies. See you then!

References

During the construction of this article, I drew from this textbook and this UPenn resource.

The Original Noachian Narratives

[Parent Article]

The Jahwist Version

YHWH saw how great the wickedness of the human race had become on the earth, and that every inclination of the thoughts of the human heart was only evil all the time. YHWH regretted that he had made human beings on the earth, and his heart was deeply troubled. So YHWH said, “I will wipe from the face of the earth the human race I have created—and with them the animals, the birds and the creatures that move along the ground—for I regret that I have made them.” But Noah found favor in the eyes of YHWH.

YHWH then said to Noah, “Go into the ark, you and your whole family,because I have found you righteous in this generation. Take with you seven pairs of every kind of clean animal, a male and its mate, and one pair of every kind of unclean animal, a male and its mate, and also seven pairs of every kind of bird, male and female, to keep their various kinds alive throughout the earth. Seven days from now I will send rain on the earth for forty days and forty nights, and I will wipe from the face of the earth every living creature I have made.”

And Noah did all that YHWH commanded him. And Noah and his sons and his wife and his sons’ wives entered the ark to escape the waters of the flood.  And after the seven days the floodwaters came on the earth. And rain fell on the earth forty days and forty nights. Then YHWH shut him in.

For forty days the flood kept coming on the earth, and as the waters increased they lifted the ark high above the earth. The waters rose and increased greatly on the earth, and the ark floated on the surface of the water. They rose greatly on the earth, and all the high mountains under the entire heavens were covered. The waters rose and covered the mountains to a depth of more than fifteen cubits.

Everything on dry land that had the breath of life in its nostrils died. Every living thing on the face of the earth was wiped out; people and animals and the creatures that move along the ground and the birds were wiped from the earth. Only Noah was left, and those with him in the ark. 

And the rain had stopped falling from the sky.The water receded steadily from the earth. After forty days Noah opened a window he had made in the ark. Then he sent out a dove to see if the water had receded from the surface of the ground. But the dove could find nowhere to perch because there was water over all the surface of the earth; so it returned to Noah in the ark. He reached out his hand and took the dove and brought it back to himself in the ark. He waited seven more days and again sent out the dove from the ark. When the dove returned to him in the evening, there in its beak was a freshly plucked olive leaf! Then Noah knew that the water had receded from the earth. He waited seven more days and sent the dove out again, but this time it did not return to him.

Then Noah built an altar to YHWH and, taking some of all the clean animals and clean birds, he sacrificed burnt offerings on it. YHWH smelled the pleasing aroma and said in his heart: “Never again will I curse the ground because of humans, even though every inclination of the human heart is evil from childhood. And never again will I destroy all living creatures, as I have done.

As long as the earth endures,
seedtime and harvest,
cold and heat,
summer and winter,
day and night
will never cease.

The Priestly Version

Noah was a righteous man, blameless among the people of his time, and he walked faithfully with God. Noah had three sons: Shem, Ham and Japheth.

Now the earth was corrupt in God’s sight and was full of violence. God saw how corrupt the earth had become, for all the people on earth had corrupted their ways. So God said to Noah, “I am going to put an end to all people, for the earth is filled with violence because of them. I am surely going to destroy both them and the earth. So make yourself an ark of cypress wood; make rooms in it and coat it with pitch inside and out.This is how you are to build it: The ark is to be three hundred cubits long, fifty cubits wide and thirty cubits high. Make a roof for it, leaving below the roof an opening one cubit high all around. Put a door in the side of the ark and make lower, middle and upper decks. I am going to bring floodwaters on the earth to destroy all life under the heavens, every creature that has the breath of life in it. Everything on earth will perish.But I will establish my covenant with you, and you will enter the ark—you and your sons and your wife and your sons’ wives with you. You are to bring into the ark two of all living creatures, male and female, to keep them alive with you. Two of every kind of bird, of every kind of animal and of every kind of creature that moves along the ground will come to you to be kept alive. You are to take every kind of food that is to be eaten and store it away as food for you and for them.”

Noah did everything just as God commanded him.

Pairs of clean and unclean animals, of birds and of all creatures that move along the ground, male and female, came to Noah and entered the ark, as God had commanded Noah.

In the six hundredth year of Noah’s life, on the seventeenth day of the second month—on that day all the springs of the great deep burst forth, and the floodgates of the heavens were opened.

On that very day Noah and his sons, Shem, Ham and Japheth, together with his wife and the wives of his three sons, entered the ark. They had with them every wild animal according to its kind, all livestock according to their kinds, every creature that moves along the ground according to its kind and every bird according to its kind, everything with wings. Pairs of all creatures that have the breath of life in them came to Noah and entered the ark. The animals going in were male and female of every living thing, as God had commanded Noah.

Every living thing that moved on land perished—birds, livestock, wild animals, all the creatures that swarm over the earth, and all mankind. The waters flooded the earth for a hundred and fifty days.

But God remembered Noah and all the wild animals and the livestock that were with him in the ark, and he sent a wind over the earth, and the waters receded. Now the springs of the deep and the floodgates of the heavens had been closed. At the end of the hundred and fifty days the water had gone down, and on the seventeenth day of the seventh month the ark came to rest on the mountains of Ararat. The waters continued to recede until the tenth month, and on the first day of the tenth month the tops of the mountains became visible.

And he sent out a raven, and it kept flying back and forth until the water had dried up from the earth. By the first day of the first month of Noah’s six hundred and first year, the water had dried up from the earth. Noah then removed the covering from the ark and saw that the surface of the ground was dry. By the twenty-seventh day of the second month the earth was completely dry.

Then God said to Noah, “Come out of the ark, you and your wife and your sons and their wives. Bring out every kind of living creature that is with you—the birds, the animals, and all the creatures that move along the ground—so they can multiply on the earth and be fruitful and increase in number on it.”

So Noah came out, together with his sons and his wife and his sons’ wives. All the animals and all the creatures that move along the ground and all the birds—everything that moves on land—came out of the ark, one kind after another.

Then God blessed Noah and his sons, saying to them, “Be fruitful and increase in number and fill the earth. The fear and dread of you will fall on all the beasts of the earth, and on all the birds in the sky, on every creature that moves along the ground, and on all the fish in the sea; they are given into your hands. Everything that lives and moves about will be food for you. Just as I gave you the green plants, I now give you everything.

“But you must not eat meat that has its lifeblood still in it. And for your lifeblood I will surely demand an accounting. I will demand an accounting from every animal. And from each human being, too, I will demand an accounting for the life of another human being.

Whoever sheds human blood,
by humans shall their blood be shed;
for in the image of God
has God made mankind.
As for you, be fruitful and increase in number; multiply on the earth and increase upon it.

Then God said to Noah and to his sons with him: “I now establish my covenant with you and with your descendants after you and with every living creature that was with you—the birds, the livestock and all the wild animals, all those that came out of the ark with you—every living creature on earth. I establish my covenant with you: Never again will all life be destroyed by the waters of a flood; never again will there be a flood to destroy the earth.”

And God said, “This is the sign of the covenant I am making between me and you and every living creature with you, a covenant for all generations to come: I have set my rainbow in the clouds, and it will be the sign of the covenant between me and the earth. Whenever I bring clouds over the earth and the rainbow appears in the clouds, I will remember my covenant between me and you and all living creatures of every kind. Never again will the waters become a flood to destroy all life. Whenever the rainbow appears in the clouds, I will see it and remember the everlasting covenant between God and all living creatures of every kind on the earth.”

So God said to Noah, “This is the sign of the covenant I have established between me and all life on the earth.”

The Story Of Noah, With Sources Revealed

[Parent Article]

Genesis 6:5 – 9:17

YHWH saw how great the wickedness of the human race had become on the earth, and that every inclination of the thoughts of the human heart was only evil all the time. YHWH regretted that he had made human beings on the earth, and his heart was deeply troubled. So YHWH said, “I will wipe from the face of the earth the human race I have created—and with them the animals, the birds and the creatures that move along the ground—for I regret that I have made them.” But Noah found favor in the eyes of YHWH.

This is the account of Noah and his family.

Noah was a righteous man, blameless among the people of his time, and he walked faithfully with God. Noah had three sons: Shem, Ham and Japheth.

Now the earth was corrupt in God’s sight and was full of violence. God saw how corrupt the earth had become, for all the people on earth had corrupted their ways. So God said to Noah, “I am going to put an end to all people, for the earth is filled with violence because of them. I am surely going to destroy both them and the earth. So make yourself an ark of cypress wood; make rooms in it and coat it with pitch inside and out.This is how you are to build it: The ark is to be three hundred cubits long, fifty cubits wide and thirty cubits high. Make a roof for it, leaving below the roof an opening one cubit high all around. Put a door in the side of the ark and make lower, middle and upper decks. I am going to bring floodwaters on the earth to destroy all life under the heavens, every creature that has the breath of life in it. Everything on earth will perish.But I will establish my covenant with you, and you will enter the ark—you and your sons and your wife and your sons’ wives with you. You are to bring into the ark two of all living creatures, male and female, to keep them alive with you. Two of every kind of bird, of every kind of animal and of every kind of creature that moves along the ground will come to you to be kept alive. You are to take every kind of food that is to be eaten and store it away as food for you and for them.”

Noah did everything just as God commanded him.

YHWH then said to Noah, “Go into the ark, you and your whole family,because I have found you righteous in this generation. Take with you seven pairs of every kind of clean animal, a male and its mate, and one pair of every kind of unclean animal, a male and its mate, and also seven pairs of every kind of bird, male and female, to keep their various kinds alive throughout the earth. Seven days from now I will send rain on the earth for forty days and forty nights, and I will wipe from the face of the earth every living creature I have made.”

And Noah did all that YHWH commanded him.

Noah was six hundred years old when the floodwaters came on the earth. And Noah and his sons and his wife and his sons’ wives entered the ark to escape the waters of the flood. Pairs of clean and unclean animals, of birds and of all creatures that move along the ground, male and female, came to Noah and entered the ark, as God had commanded Noah. And after the seven days the floodwaters came on the earth.

In the six hundredth year of Noah’s life, on the seventeenth day of the second month—on that day all the springs of the great deep burst forth, and the floodgates of the heavens were opened. And rain fell on the earth forty days and forty nights.

On that very day Noah and his sons, Shem, Ham and Japheth, together with his wife and the wives of his three sons, entered the ark. They had with them every wild animal according to its kind, all livestock according to their kinds, every creature that moves along the ground according to its kind and every bird according to its kind, everything with wings. Pairs of all creatures that have the breath of life in them came to Noah and entered the ark. The animals going in were male and female of every living thing, as God had commanded Noah. Then YHWH shut him in.

For forty days the flood kept coming on the earth, and as the waters increased they lifted the ark high above the earth. The waters rose and increased greatly on the earth, and the ark floated on the surface of the water. They rose greatly on the earth, and all the high mountains under the entire heavens were covered. The waters rose and covered the mountains to a depth of more than fifteen cubits. Every living thing that moved on land perished—birds, livestock, wild animals, all the creatures that swarm over the earth, and all mankind. Everything on dry land that had the breath of life in its nostrils died. Every living thing on the face of the earth was wiped out; people and animals and the creatures that move along the ground and the birds were wiped from the earth. Only Noah was left, and those with him in the ark.

The waters flooded the earth for a hundred and fifty days.

But God remembered Noah and all the wild animals and the livestock that were with him in the ark, and he sent a wind over the earth, and the waters receded. Now the springs of the deep and the floodgates of the heavens had been closed, and the rain had stopped falling from the sky.The water receded steadily from the earth. At the end of the hundred and fifty days the water had gone down, and on the seventeenth day of the seventh month the ark came to rest on the mountains of Ararat. The waters continued to recede until the tenth month, and on the first day of the tenth month the tops of the mountains became visible.

After forty days Noah opened a window he had made in the ark and he sent out a raven, and it kept flying back and forth until the water had dried up from the earth. Then he sent out a dove to see if the water had receded from the surface of the ground. But the dove could find nowhere to perch because there was water over all the surface of the earth; so it returned to Noah in the ark. He reached out his hand and took the dove and brought it back to himself in the ark. He waited seven more days and again sent out the dove from the ark. When the dove returned to him in the evening, there in its beak was a freshly plucked olive leaf! Then Noah knew that the water had receded from the earth. He waited seven more days and sent the dove out again, but this time it did not return to him.

By the first day of the first month of Noah’s six hundred and first year, the water had dried up from the earth. Noah then removed the covering from the ark and saw that the surface of the ground was dry. By the twenty-seventh day of the second month the earth was completely dry.

Then God said to Noah, “Come out of the ark, you and your wife and your sons and their wives. Bring out every kind of living creature that is with you—the birds, the animals, and all the creatures that move along the ground—so they can multiply on the earth and be fruitful and increase in number on it.”

So Noah came out, together with his sons and his wife and his sons’ wives. All the animals and all the creatures that move along the ground and all the birds—everything that moves on land—came out of the ark, one kind after another.

Then Noah built an altar to YHWH and, taking some of all the clean animals and clean birds, he sacrificed burnt offerings on it. YHWH smelled the pleasing aroma and said in his heart: “Never again will I curse the ground because of humans, even though every inclination of the human heart is evil from childhood. And never again will I destroy all living creatures, as I have done.

As long as the earth endures,
seedtime and harvest,
cold and heat,
summer and winter,
day and night
will never cease.

Then God blessed Noah and his sons, saying to them, “Be fruitful and increase in number and fill the earth. The fear and dread of you will fall on all the beasts of the earth, and on all the birds in the sky, on every creature that moves along the ground, and on all the fish in the sea; they are given into your hands. Everything that lives and moves about will be food for you. Just as I gave you the green plants, I now give you everything.

“But you must not eat meat that has its lifeblood still in it. And for your lifeblood I will surely demand an accounting. I will demand an accounting from every animal. And from each human being, too, I will demand an accounting for the life of another human being.

Whoever sheds human blood,
by humans shall their blood be shed;
for in the image of God
has God made mankind.
As for you, be fruitful and increase in number; multiply on the earth and increase upon it.

Then God said to Noah and to his sons with him: “I now establish my covenant with you and with your descendants after you and with every living creature that was with you—the birds, the livestock and all the wild animals, all those that came out of the ark with you—every living creature on earth. I establish my covenant with you: Never again will all life be destroyed by the waters of a flood; never again will there be a flood to destroy the earth.”

And God said, “This is the sign of the covenant I am making between me and you and every living creature with you, a covenant for all generations to come: I have set my rainbow in the clouds, and it will be the sign of the covenant between me and the earth. Whenever I bring clouds over the earth and the rainbow appears in the clouds, I will remember my covenant between me and you and all living creatures of every kind. Never again will the waters become a flood to destroy all life. Whenever the rainbow appears in the clouds, I will see it and remember the everlasting covenant between God and all living creatures of every kind on the earth.”

So God said to Noah, “This is the sign of the covenant I have established between me and all life on the earth.”

The Story Of Noah

[Parent Article]

Genesis 6:5 – 9:17

YHWH saw how great the wickedness of the human race had become on the earth, and that every inclination of the thoughts of the human heart was only evil all the time. YHWH regretted that he had made human beings on the earth, and his heart was deeply troubled. So YHWH said, “I will wipe from the face of the earth the human race I have created—and with them the animals, the birds and the creatures that move along the ground—for I regret that I have made them.” But Noah found favor in the eyes of YHWH.

This is the account of Noah and his family.

Noah was a righteous man, blameless among the people of his time, and he walked faithfully with God. Noah had three sons: Shem, Ham and Japheth.

Now the earth was corrupt in God’s sight and was full of violence. God saw how corrupt the earth had become, for all the people on earth had corrupted their ways. So God said to Noah, “I am going to put an end to all people, for the earth is filled with violence because of them. I am surely going to destroy both them and the earth. So make yourself an ark of cypress wood; make rooms in it and coat it with pitch inside and out.This is how you are to build it: The ark is to be three hundred cubits long, fifty cubits wide and thirty cubits high. Make a roof for it, leaving below the roof an opening one cubit high all around. Put a door in the side of the ark and make lower, middle and upper decks. I am going to bring floodwaters on the earth to destroy all life under the heavens, every creature that has the breath of life in it. Everything on earth will perish.But I will establish my covenant with you, and you will enter the ark—you and your sons and your wife and your sons’ wives with you. You are to bring into the ark two of all living creatures, male and female, to keep them alive with you. Two of every kind of bird, of every kind of animal and of every kind of creature that moves along the ground will come to you to be kept alive. You are to take every kind of food that is to be eaten and store it away as food for you and for them.”

Noah did everything just as God commanded him.

YHWH then said to Noah, “Go into the ark, you and your whole family,because I have found you righteous in this generation. Take with you seven pairs of every kind of clean animal, a male and its mate, and one pair of every kind of unclean animal, a male and its mate, and also seven pairs of every kind of bird, male and female, to keep their various kinds alive throughout the earth. Seven days from now I will send rain on the earth for forty days and forty nights, and I will wipe from the face of the earth every living creature I have made.”

And Noah did all that YHWH commanded him.

Noah was six hundred years old when the floodwaters came on the earth. And Noah and his sons and his wife and his sons’ wives entered the ark to escape the waters of the flood. Pairs of clean and unclean animals, of birds and of all creatures that move along the ground, male and female, came to Noah and entered the ark, as God had commanded Noah. And after the seven days the floodwaters came on the earth.

In the six hundredth year of Noah’s life, on the seventeenth day of the second month—on that day all the springs of the great deep burst forth, and the floodgates of the heavens were opened. And rain fell on the earth forty days and forty nights.

On that very day Noah and his sons, Shem, Ham and Japheth, together with his wife and the wives of his three sons, entered the ark. They had with them every wild animal according to its kind, all livestock according to their kinds, every creature that moves along the ground according to its kind and every bird according to its kind, everything with wings. Pairs of all creatures that have the breath of life in them came to Noah and entered the ark. The animals going in were male and female of every living thing, as God had commanded Noah. Then YHWH shut him in.

For forty days the flood kept coming on the earth, and as the waters increased they lifted the ark high above the earth. The waters rose and increased greatly on the earth, and the ark floated on the surface of the water. They rose greatly on the earth, and all the high mountains under the entire heavens were covered. The waters rose and covered the mountains to a depth of more than fifteen cubits. Every living thing that moved on land perished—birds, livestock, wild animals, all the creatures that swarm over the earth, and all mankind. Everything on dry land that had the breath of life in its nostrils died. Every living thing on the face of the earth was wiped out; people and animals and the creatures that move along the ground and the birds were wiped from the earth. Only Noah was left, and those with him in the ark.

The waters flooded the earth for a hundred and fifty days.

But God remembered Noah and all the wild animals and the livestock that were with him in the ark, and he sent a wind over the earth, and the waters receded. Now the springs of the deep and the floodgates of the heavens had been closed, and the rain had stopped falling from the sky.The water receded steadily from the earth. At the end of the hundred and fifty days the water had gone down, and on the seventeenth day of the seventh month the ark came to rest on the mountains of Ararat. The waters continued to recede until the tenth month, and on the first day of the tenth month the tops of the mountains became visible.

After forty days Noah opened a window he had made in the ark and sent out a raven, and it kept flying back and forth until the water had dried up from the earth. Then he sent out a dove to see if the water had receded from the surface of the ground. But the dove could find nowhere to perch because there was water over all the surface of the earth; so it returned to Noah in the ark. He reached out his hand and took the dove and brought it back to himself in the ark. He waited seven more days and again sent out the dove from the ark. When the dove returned to him in the evening, there in its beak was a freshly plucked olive leaf! Then Noah knew that the water had receded from the earth. He waited seven more days and sent the dove out again, but this time it did not return to him.

By the first day of the first month of Noah’s six hundred and first year, the water had dried up from the earth. Noah then removed the covering from the ark and saw that the surface of the ground was dry. By the twenty-seventh day of the second month the earth was completely dry.
Then God said to Noah, “Come out of the ark, you and your wife and your sons and their wives. Bring out every kind of living creature that is with you—the birds, the animals, and all the creatures that move along the ground—so they can multiply on the earth and be fruitful and increase in number on it.”

So Noah came out, together with his sons and his wife and his sons’ wives. All the animals and all the creatures that move along the ground and all the birds—everything that moves on land—came out of the ark, one kind after another.

Then Noah built an altar to YHWH and, taking some of all the clean animals and clean birds, he sacrificed burnt offerings on it. YHWH smelled the pleasing aroma and said in his heart: “Never again will I curse the ground because of humans, even though every inclination of the human heart is evil from childhood. And never again will I destroy all living creatures, as I have done.

As long as the earth endures,
seedtime and harvest,
cold and heat,
summer and winter,
day and night
will never cease.

Then God blessed Noah and his sons, saying to them, “Be fruitful and increase in number and fill the earth. The fear and dread of you will fall on all the beasts of the earth, and on all the birds in the sky, on every creature that moves along the ground, and on all the fish in the sea; they are given into your hands. Everything that lives and moves about will be food for you. Just as I gave you the green plants, I now give you everything.

“But you must not eat meat that has its lifeblood still in it. And for your lifeblood I will surely demand an accounting. I will demand an accounting from every animal. And from each human being, too, I will demand an accounting for the life of another human being.

Whoever sheds human blood,
by humans shall their blood be shed;
for in the image of God
has God made mankind.
As for you, be fruitful and increase in number; multiply on the earth and increase upon it.

Then God said to Noah and to his sons with him: “I now establish my covenant with you and with your descendants after you and with every living creature that was with you—the birds, the livestock and all the wild animals, all those that came out of the ark with you—every living creature on earth. I establish my covenant with you: Never again will all life be destroyed by the waters of a flood; never again will there be a flood to destroy the earth.”

And God said, “This is the sign of the covenant I am making between me and you and every living creature with you, a covenant for all generations to come: I have set my rainbow in the clouds, and it will be the sign of the covenant between me and the earth. Whenever I bring clouds over the earth and the rainbow appears in the clouds, I will remember my covenant between me and you and all living creatures of every kind. Never again will the waters become a flood to destroy all life. Whenever the rainbow appears in the clouds, I will see it and remember the everlasting covenant between God and all living creatures of every kind on the earth.”

So God said to Noah, “This is the sign of the covenant I have established between me and all life on the earth.”

An Introduction To Bayesian Inference

bayes

Motivations

Bayesianism is a big deal. Here’s what the Stanford Encyclopedia had to say about it:

In the past decade, Bayesian confirmation theory has firmly established itself as the dominant view on confirmation; currently one cannot very well discuss a confirmation-theoretic issue without making clear whether, and if so why, one’s position on that issue deviates from standard Bayesian thinking.

What’s more, Bayesianism is everywhere:

In this post, I’ll introduce you to how it works in practice.

Probability Space

Humans are funny things. Even though we can’t produce randomness, we can understand it. We can even attempt to summarize that understanding, in 300 words or less. Ready? Go!

A probability space has three components:

  1. Sample Space: A set of all possible outcomes, that could possibly occur. (Think: the ingredients)
  2. σ-Algebra. A set of events, each of which contain at least one outcome. (Think: the menu)
  3. Probability Measure Function. A set of probabilities, which convert events into numbers ranging from 0% to 100% (Think: the chef).

To illustrate, let’s carve out the probability space of two fair dice:

Bayes- Probability Space of Two Dice (1)

You remember algebra, and how annoying it was to use symbols that merely represented numbers? Statisticians get their jollies by terrorizing people with a similar toy, the random variable. The set of all possible values for a given variable is its domain.

Let’s define a discrete random variable called Happy.  We are now in a position to evaluate expressions like:

P(Happy=true)

Such an explicit notation will get tedious quickly. Please remember the following abbreviations:

P(Happy=true) \rightarrow P(happy)

P(Happy=false) \rightarrow P(\neg{happy})

Okay, so let’s say we define the probability function that maps each manifestation of Happy’s domain to a number. What about when you take other information into account? Is your P(happy) going to be unaffected by learning, say, the outcome of the 2016 US Presidential Election? Not likely, and we’d like a tool to express this contextual knowledge. In statistics jargon, we would like to condition on this information. This information will be put on the RHS of the probability function, after a new symbol: |

Suppose I define a new variable, ElectionOutcome = { republican, democrat, green } Now, I can finally make intelligible statements about:

P(happy | ElectionOutcome=green)

A helpful subvocalization of the above:

The probability of happiness GIVEN THAT the Green Party won the election.

Bayescraft

When I told you about conditioning, were you outraged that I didn’t mention outcome trees? No? Then go watch this (5min). I’ll wait.

Now you understand why outcome trees are useful. Here, then, is the complete method to calculate joint probability (“what are the chances X and Y will occur?”):

Bayes- Conditional Probability

The above tree can be condensed into the following formula (where X and Y represent any value in these variables’ domain):

P(X, Y) = P(X|Y)*P(Y)

Variable names are arbitrary, so we can just as easily write:

P(Y, X) = P(Y|X)*P(X)

But the joint operator (“and”) is commutative: P(X,Y) = P(Y,X). So we can glue the above equations together.

P(X, Y) = P(Y|X)*P(X)

Since both of the equations above are equal to P(X, Y), we can glue them together:

P(X|Y)*P(Y) = P(Y|X)*P(X)

Dividing both sides by P(Y) gives us Bayes Theorem:

P(X|Y) = \frac{P(Y|X) * P(X)}{P(Y)}

“Okay…”, you may be thinking, “Why should I care about this short, bland-looking equation?”

Look closer! Here, let me rename X and Y:

P(Hypothesis|Evidence) = \frac{P(Evidence|Hypothesis) * P(Hypothesis)}{P(Evidence)}

Let’s cast this back into English.

  • P(Hypothesis) answers the question: how likely is it that my hypothesis is true?
  • P(Hypothesis|Evidence) answers the question: how likely is my hypothesis, given this new evidence?
  • P(Evidence) answers the question: how likely is my evidence? It is a measure of surprise.
  • P(Evidence|Hypothesis) answers the question: if my hypothesis is true, how likely am I to see this evidence? It is a measure of prediction.

Shuffling around the above terms, we get:

P(Hypothesis|Evidence) = P(Hypothesis) * \frac{P(Evidence|Hypothesis)}{P(Evidence)}

We can see now that we are shifting, by some factor, from P(Hypothesis) to P(Hypothesis|Evidence). Our beginning hypothesis is now updated with new evidence. Here’s a graphical representation of this Bayesian updating:

Bayes- Updating Theory

DIY Inference

A Dream

Once upon a time, you are fast asleep. In your dream an angel appears, and presents you with a riddle:

“Back in the real world, right now, an email just arrived in your inbox. Is it spam?”

You smirk a little.

“This question bores me! You haven’t given me enough information!”
“Ye of little faith! Behold, I bequeath you information, for I have counted all emails in your inbox.”
“Revelation 1: For every 100 emails you receive, 78 are spam.”
“What is your opinion now? Is this new message spam?”
“Probably… sure. I think it’s spam.”

The angel glares at you, for reasons you do not understand.

“So, let me tell you more about this email. It contains the word ‘plans’.”
“… And how does that help me?”
“Revelation 2: The likelihood of ‘plans’ being in a spam message is 3%.”
“Revelation 3: The likelihood of it appearing in a normal message is 11%”
“Human! Has your opinion changed? Do you now think you have received the brainchild of some marketing intern?”

A fog of confusion and fear washes over you.

“… Can I phone a friend?”

You wake up. But you don’t stop thinking about your dream. What is the right way to answer?

Without any knowledge of its contents, we viewed the email as 78% likely to be spam. What changed? The word “plans” appears, and that word is more than three times as likely to occur in non-spam messages! Therefore, should we expect 78% to increase or decrease? Decrease, of course! But how much?

Math Goggles, Engage!

If you’ve solved a word problem once in your life, you know what comes next. Math!

Time to replace these squirmy words with pretty symbols! We shall build our house as follows:

  • Let “Spam” represent a random variable. Its domain is { true, false }.
  • Let “Plans” represent a random variable. Its domain is { true, false }

How might we cast the angel’s Revelations, and Query, to maths?

Word Soup Math Diamonds
“R1: For every 100 emails you receive, 78 are spam.” P(spam) = 0.78
“R2: The likelihood of ‘plans’ being in a spam message is 3%.” P(plans|spam) = 0.03
“R3: The likelihood of it appearing in a normal message is 11%” P(plans|¬spam) = 0.11
“Q: Is this message spam?” P(spam|plans) = ?

Solving The Riddle

Of course, it is not enough to state a problem rigorously. It must be solved. With Bayes Theorem, we find that:

P(spam|plans) = \frac{P(plans|spam)P(spam)}{P(plans)}

Do we know all of the terms on the right-hand side? No: we have not been given P(plans). How do we compute it? By a trick outside the scope of this post: marginalization. If we marginalize over Plans (i.e., sum over all instances of its domain), we spawn the ability able to compute P(E). In Mathese, we have:

P(spam|plans) = \frac{P(plans|spam)P(spam)}{P(plans,spam)+ P(plans,\neg{spam})}

P(plans,spam) and P(plans, ¬spam) represent joint probabilities that we can expand. Applying the Laws of Conditional Probability (given earlier), we have:

P(spam|plans) = \frac{P(plans|spam)P(spam)}{P(plans|spam)P(spam) + P(plans|\neg{spam})P(\neg{spam})}

Notice we know the values of all the above variables except P(¬spam). We can use an axiom of probability theory to find it:

Word Soup Math Diamonds
“Every variable had 100% chance of being something.” P(X) + P(¬X) = 1.0.

Since the P(spam) is 0.78, we can infer that P(¬spam) is 0.22.

Now the fun part – plug in the numbers!

P(spam|plans) = \frac{0.03 * 0.78}{(0.03*0.78) + (0.11*0.22)} = 0.49159

Take a deep breath. Stare at your result. Blink three times. Okay.

This new figure, 0.49, interacts with your previous intuitions in two ways.

  1. It corroborates them: “plans” is evidence against spam, and 0.49 is indeed smaller than 0.78.
  2. It sharpens them: we used to be unable to quantify how much the word “plans” would weaken our spam hypothesis.

The mathematical machinery we just walked through, then, accomplished the following:

Bayes- Updating Example

Technical Rationality

We are finally ready to sketch a rather technical theory of knowledge.

In the above example, learning occured precisely once: on receipt of new evidence. But in real life we collect evidence across time. The Bayes learning mechanism, then, looks something like this:

Bayes- Updating Over Time

Let’s apply this to reading people at a party. Let H represent the hypothesis that some person you just met, call him Sam, is an introvert.

Suppose that 48% of men are introverts. Such a number represents a good beginning degree-of-confidence in your hypothesis. Your H0, therefore, is 48%.

Next, a good Bayesian would go about collecting evidence for her hypothesis. Suppose, after 40 minutes of discretely observing Sam, we see him retreat to a corner of the room, and adopt a “thousand yard stare’. Call this evidence E1, and our updated introversion hypothesis (H1) increases dramatically, say to 92%.

Next, we go over and engage Sam in a long conversation about his background. We notice that, as the conversation progresses, Sam becomes more animated and personable, not less. This new evidence E2 “speaks against” E1, and our hypothesis regresses (H2 becomes 69%).

After these pleasantries, Sam appears to be more comfortable with you. He leans forward and discloses that he just got out of a fight with his wife, and is battling a major headache. He also mentions regretting being such a bore at this party. With these explanatory data now available, your introversion hypothesis wanes. Sure, Sam could be lying, but the likelihood of that happening, in such a context, is lower than truth-telling. Perhaps later we will encounter evidence that induces an update towards a (lying) introvert hypothesis. But given the information we currently possess, our H3 rests at 37%.

Wrapping Up

Resources

In this post, I’ve taken a largely symbolic approach to Bayes’ Theorem. Given the extraordinary influence of the result, many other teaching strategies are available. If you’d like to get more comfortable with the above, I would recommend the following:

Takeaways

I have, by now, installed a strange image in your head. You can perceive within yourself a sea of hypotheses, each with their own probability bar, adjusting with every new experience. Sure, you may miscalculate – your brain is made of meat, after all. But you have a sense now that there is a Right Way to do reason, a normative bar that maximizes inferential power.

Hold onto that image. Next time, we’ll cast this inferential technique to its own epistemology (theory of knowledge), and explore the implications.

[Sequence] Decision Making In Chess

grandmaster_tournament

Designed for people who know little more than how the chess pieces move, this series introduces the game, and scans its results for lessons we can apply to how we understand life more generally.

  1. An Introduction To Chess.  Surveys chess culture and illustrates chess evaluation, bringing attention to the often-subconscious nature of the latter.
  2. Decision Trees In Chess. Explores how the decision trees and the minimax algorithm can capture the entirety of chess gameplay.
  3. The Chess SuperTree. Having exploring single-move decisions, this post zooms out to consider the game of chess as a whole – its complete game tree.
  4. The Psychology Of Chess. Compares these computer science & game theoretic approaches to chess with hints on how the brain uses somatic markers & heuristics to decide more efficiently.

An Introduction To Chess

 

kasparov

Content advisory: if you know how chess pieces move, this article should be accessible to you.

Table Of Contents

  • Introduction
    • Why Does This Article Exist?
    • Notation & Scoring
    • Ratings & Phases
    • How Chess Games Are Won
  • How To Understand A Chess Position
    • Introducing My Starting Position
    • Towards Board Analysis
    • Why Are Goals Important In Chess?
    • Finding A Goal
    • Anticipating The Other Player
    • How Does Chess Become Less Mysterious?
  • How To Evaluate A Chess Decision
    • Introducing My Solution
    • Analyzing Decision Outcome
    • Towards Judgment
  • Conclusion
    • Takeaways

Introduction

Why Does This Article Exist?

I have played chess professionally since I was a teenager. Today, I want to share with you this private world. I will use a correspondence game (multiple days per move, instead of seconds per move) to do this. We will together walk through several decisions made by myself and my opponent.

My reasons for exploring chess are not contained to sharing an interesting piece of my life. I hope to use this material to explore certain themes useful in attempts to integrate artificial intelligence and cognitive psychology. But that’s for later. For now, if you leave this article with a better idea of how chess players make decisions, I will be content.

In a former life, I taught chess to hundreds of six-year-olds. While clearly my readership here will need more guidance, I will do my best to accomodate. 😉

Notation & Scoring

The 64 squares of the chessboard have names. Rows (also called ranks) are 1-8, columns (also called files) are a-h.

square_names

Piece symbols are:

  • King: K
  • Queen: Q
  • Rook: R
  • Bishop: B
  • Knight: N
  • Pawn: [blank]

Algebraic notation allows us to communicate chess moves. To do this, we simply combine the two symbols discussed above. There exist a few caveats regarding captures (x means capture) and when more than one piece can land on a particular square (originating rank or file is appended). Examples:

  • Ne4 would represent a Knight that moved to the e4 square.
  • gxf5 would represent a pawn on g4 that captures something on the f5 square.
  • Rec8 would represent a Rook on e8 moving to c8, if another Rook could have moved to the same location.

Chess players like to keep track of how large their army is, compared to their opponent.  However, it is not enough to count pieces: a queen is certainly worth more than a pawn. The following scoring system was instead invented, to facilitate comparison between different combinations of pieces:

  • King: [infinite points]
  • Queen: 9 points
  • Rook: 5 points
  • Bishop: 3 points
  • Knight: 3 points
  • Pawn: 1 point

Ratings & Phases

The chess community tracks playing strength with a fairly complex rating scheme: ELO ratings. Absolute beginners tend to perform around a 400 rating, those who play regularly-yet-casually trend towards 900, and world champions hover around 2800. The relationship between effort and rating is non-linear: almost all chess players will tell you that more time is required to rise from 1900 to 2100, than from 1200 to 1900. (My rating is currently 1903.)

The game of chess is traditionally divided into three separate phases: the opening, the middlegame, and the endgame. Since all games start from the same position, chess players have gradually accumulated common wisdom in the form of opening lines. Professional chess players will often memorize the first 5-15 moves of nearly every possible (interesting) game: to fail to memorize these lines is to risk independently trying to reconstruct them, failing to compute the optimal sequence, and finding yourself at a disadvantage (for this reason, tournament preparation can be quite competitive, and taxing). Similarly, endgames typically feature very few pieces, its complexity becomes tractable, and memorization returns to the fore as an extremely important tool.

It is a very normal sight to see grandmaster chess players play their first opening moves quickly, consume hours lost in thought during the middlegame, and as soon the endgame result is clear either resign or offer a draw – the end result being nearly inevitable. Arguably, the middlegame retains the most interest in the face of such professionalism. Why? Because our best minds have failed to tame its complexities.

How Chess Games Are Won

Chess games are won by checkmate: i.e., attacking the enemy King in a way it cannot escape. But checkmating is not an unpredictable “happening”. After your tenth chess game or so, you will start to notice that the cumulative strength of one’s army is predictive of the final outcome. This is why the scoring system above was developed: to allow for the prediction of victory.

Most absolute beginners have little difficulty accepting the scoring system.  The next realization, however, takes significantly longer to arrive. You see, for most players in chess, material advantages come about by accident. An understanding of attack and defense, the eyesight needed to anticipate “tricks”: these take a long time to mature (such mistakes feel like dropping a negative sign in a long algebra problem).

It takes a long time for the average human to transcend mistake-avoidance in chess. If you keep at it, your idea of how material advantages come about will slowly evolve. The key moment comes when both players are mature enough to avoid material-shedding mistakes. Despite this newfound sophistication, you are not guaranteed to avoid losing material. Why? Well… every so often, your opponent will make a series of attacking threats, and you will find yourself simply unable to generate an adequate defense response. Here come the critical question: how can one player be able to outpace his opponent in this way?

The answer lies in positional advantages, a concept much more subtle than material advantages. There are very many ways for a player to possess a positional advantage. These positional features include:

  • Pawn structure. Some pawn configurations are more stable and defensible than others.
  • Space. Some pawn configurations allow a player relatively more room to maneuver.
  • King safety. How many defensive resources does a player have near his King?
  • Piece development. At what rate has one managed to bring pieces into the fight?
  • Piece cohesion. Are one’s pieces working together well?
  • Initiative. Who is making more threats, and dictating the course of the game?

The above discussion can, perhaps, be represented with the following (rather crude) diagram:

Chess Advantages

How To Understand A Chess Position

Introducing My Starting Position

With these preliminaries out of the way, I can now to introduce you to real gameplay!

Consider the following. Each player have played 19 moves, I am playing as White, and it is my turn.

posA

Towards Board Analysis

Taking what we learned about How Chess Games Are Won, let us now conduct a material analysis and a positional analysis.

Black and White possess an equal number of pawns, knights, bishops, rooks, queen. Materially, then, the game is even. This equality is likely to persist: White shouldn’t play Bxe7 because Black can recapture Rxe7, and Black comes out ahead 2 pts. Similarly, if Black were to capture Bxc3, this isn’t necessarily wrong, but after Qxc3 material remains even (both players have lost 3 pts).

But chess is not just about the size of your army, it is how the army is being used. Let us scan through our positional features using a -5 to 5 scale (-5 is a strong Black advantage, 5 is a strong White advantage, 0 is equality):

  • Pawn structure: +0.2. (Both sides pawn’s coordinate well, and are not particularly vulnerable to attack.)
  • Space. +2.0. (My pawns have advanced, on average, 1 or 2 steps further.)
  • King safety. -1.8. (My King doesn’t have a guardian Bishop, and my pawns are further advanced.)
  • Piece development. +0.2. (No pieces are “stuck at home” anymore.)
  • Piece cohesion. +0.8 (Black’s Bb7 and Rc8 aren’t particularly useful, White’s Rooks and Bishops are better coordinated.)
  • Initiative. +0.0 (Neither player has significant control over the pace of the game.)

I want to emphasize here that the above numbers are subjective: I made them up. But, as we shall see later, quantifying my “gut feelings” turns out to be extremely useful.

Let us also notice that most pieces, on both sides, are not attacking the pieces of the other player. There are simply too many pawns in the way. It turns out that, in clogged positions such as these, play tends toward aggressive pawn moves that serve to clear a path for one’s pieces. Such “jailbreaking” often happens after subtle maneuvering, where each player tries to get her pieces better positioned to capitalize on their coming freedom.

Why Are Goals Important In Chess?

Why should play tend to gravitate towards aggressive pawn moves? Consider what happens if one player contents himself with moving his pieces behind his wall of pawns. His opponent could then dictate when and where to bring the fight to the other player.

This kind of argument illustrates a central theme in chess: successful players tend to think in terms of goals. Once a goal is selected, a plan must then be constructed, to move the current situation towards the desired one. Let’s now turn to my starting position to see what this means, concretely.

Finding A Goal

White desires to find a goal from his current position. We’ve already agreed that aggressive pawn moves represent useful goals. But where?

Is White best advised to locate a Queenside strategy? Can White aggressively advance his a- or b- pawn on the Queenside? Not immediately: such moves (a5 and b4) would lose material. What if White were to, say, play Na2 – thus making possible a later b4 pawn advance (since both Queen and Knight can now recapture). This plan does not seem especially promising: after a future b4 cxb4, Black’s Queen and a Rook will suddenly be attacking our pawn on c4!

How about a Kingside strategy, with White advancing his g and/or h pawns? Too risky: White’s King is already rather exposed.  White’s biggest space advantage is in the center of the board, so let’s now restrict our attention there. The two candidates are: e5 and f5.

center_strategies

Can White afford to advance his pawn to e5 (left image)? Do the math! 20. e5 dxe5 21. fxe5 Nxe5 22. Rxe5 Bxe5. Black comes out way ahead (if you didn’t do the math, take my word for it :P).

So 20. e5 is no good. How 20. f5 (right image)? This is safe: gxf5 is met by exf5 – equality. But such a move allows Black’s Knight to land in the e5 square (Ne5), previously impossible when the f4 pawn could capture such a daring Knight. So, White seems in a quandary: he would like to increase his space advantage… but both pawn moves that could accomplish this seem deficient.

We know that White should be playing in the center. Perhaps White’s goal should be: arrange his pieces so that e5 does not lose material.

Anticipating The Other Player

What goals should Black try to pursue? Can we anticipate counterplay?

On the Queenside, b5 qualifies as a pawn break. For now, it loses material. Let us imagine a future position where it does not lose material. Is such a goal worthy of Black’s time? Perhaps: it will take a while to get his pieces ready, but it would give Black an attack.

On the Kingside, Black will hesitate to advance his pawns, due to safety concerns for his King.

In the Center, f5 will ultimately weaken Black’s pawn structure. But what should happen if Black plays e6? White may hesitate to capture: dxe6 fxe6 gives up White’s space advantage. So, Black will have the opportunity to capture exd5, after which White will face a choice. The following image imagines this choice (after 20. Bc2 e6 21. Kh1 exd5):

center_counterplay

Recapturing cxd5 (left image) preserves his central dominance, but now White must fear a very powerful Queenside attack: Black may now play c4 and Nc5. This threat is sufficiently scary: White will probably recapture exd5 (right image).

This possibility adds some urgency to White’s plan: if Black is given opportunity to play e6, he will bring the game closer to equality by relieving spatial pressure by trading pawns and Rooks. Worse still, such a trade would prevent White from meeting his goal to play e5!

How Does Chess Become Less Mysterious?

Pause for a minute, and take stock of how you feel.  You probably feel lost, a bit like you’ve wandered into a foreign land.  It turns out that almost everyone encountering this material has a similar experience. But this feeling of confusion is important, so let’s try to understand it.

Perhaps the strangeness comes from unfamiliarity. Or, perhaps my arguments lack specificity! Would you become able to confidently teach this new understanding of chess to a friend, dear reader, if I had only made it more lengthy, more precise?

I doubt it. Such an “improvement” feels funny once you consider how chess is learned. Playing strength does not improve once playing strength by argumentation (conscious reasoning) alone: experience must play a role.  Let us name this observation, that language can express chess knowledge more easily than it can teach it, representational language asymmetry.

I have watched literally hundreds of games play out from this exact pawn structure, and I have developed a very sharp intuition for what kinds of strategies matter in this type of position. In this four-pawns-Benoni, of course White must not find a goal on the Queenside. Likewise, the solution I employ below seems shocking at first… but it is a highly stylized pattern that I have, again, evaluated in the context of dozens of other games.

I have noticed representational language asymmetry before, while teaching ESL last year.  In my view, learning chess is a lot like learning a language: personal practice and learning from the example of others is the most efficient way forward.

How To Evaluate A Chess Decision

Dear reader, where have we landed? We now know that White would like to break through in the center. We also know that White is in crisis: he would like to act before Black plays e6, but all available pawn breaks lose material. What should White do?

Rather than motivate how I addressed this challenge, let me simply show you. 🙂

Introducing My Solution

20. e5 dxe5
21. f5

posA123

Analyzing Position Outcome

Material analysis:

  • I have lost one pawn (but no more: 21 …gxf5 22. Rxf5 is simply a trade).

Positional analysis:

  • Pawn structure: -0.5 (Black’s e5 pawn is now unopposed by any White pawn, but the e7 pawn is no discouraged from moving)
  • Space. +3.5. (My pawn on f5 really cramps his style! )
  • King safety. +0.5. (My pawn on f5 is looking to remove one of Black’s King’s protective pawns)
  • Piece development. +0.0. (No real changes in this feature.)
  • Piece cohesion. +4.5 (My Rooks are now active, my Knight and Bishops are now well-positioned, his Bishop is now blocked).
  • Initiative. +2.0 (White has started to dictate which aspects of the game are worthy of attention.)

Towards Judgment

We can now directly compare before and after!  Copying the two sets of numbers I produced above:

Starting Score End Score Difference
Material: Points +0.0 -1.0 -1.0
Position: Pawn structure +0.0 -0.5 -0.5
Position: Space +2.0 +3.5 +1.5
Position: King safety -1.5 +0.5 +2.0
Position: Piece development +0.0 +0.0 +0.0
Position: Piece cohesion +1.0 +4.5 +3.5
Position: Initiative +0.0 +2.0 +2.0

We see that I have accepted losses in material and pawn structure, in exchange for gains in space, King safety, piece cohesion, and initiative. But how are we to know whether such a complex tradeoff is a decision worth making?

Recall our vocabulary words: positional advantage, material advantage. Now is the time to admit cumulative advantage into our corpus. If we wish to speak intelligibly about chess decisions, we simply must compress our analysis features into a single number (there is no room for incommensurability in chess!).  Here’s how I view the cumulative effect of my decision:

Starting Score End Score Difference
Estimated Total +0.4 +0.6 +0.2

Dear reader, how am I to convince you that such a total score is correct? Will I provide you with cute mathematics? A weighted average over the above features?

I cannot provide such a thing, because I do not possess it. The truth is, I don’t consciously use mathematical reasoning while playing chess! Rather, all of my valuations are written in the currency of intuitions, of emotional valence. And that is a deep and mysterious thing.

Conclusion

Takeaways

Congratulations! You survived to the end of this article. We have covered a lot of ground. 🙂

I’ll close by recapping the points I most want you to remember:

  • Positional advantages cause material advantages, which in turn lead to checkmate.
  • Positional advantages are composed of many different features, such as pawn structure or piece cohesion.
  • Goals are vital to success.
  • Evaluating a chess position is a largely subconscious experience, one that requires experience.

Enjoy the +100 bump in chess rating I just gave you! 😉