Graph of time-lines: A data structure for representing human behavior

Steve Hazel
7 min readFeb 22, 2016

--

You’re probably not a data structure nerd. I’m certainly not. Until an adaptive k-d tree helps me pay my bills it can fuck right off.

The key to data structures is what they help us accomplish. While most of us don’t care about cars - we’re mostly not car nerds - we do care about reaching our destination quickly and comfortably. The high-level data structure I’m introducing can help each of us get to new places. Everyone can care about this one or, more likely, care about how it benefits them.

Combining graph with time-line

A graph structure is like a friend network or a road system. Directed? Acyclic? Don’t care yet. It’s a graph. The timeline is a series of points over time, much like the ones you were forced to make in history class.

The graph and the timeline combine this way:

So the graph provides information about the timelines and links them together. That’s too general to care about though. We need a layer of meaning.

Narrowing the scope

First, it’s important to note that both a graph and a time-line begin with a single point. They are each constructed one point at a time; neither of them spring into existence fully formed.

The first node in the graph is special in that it’s the root that all later nodes are linked to.

The graph is initially grown as a tree-like hierarchy; a rose (or multi-way) tree to be more specific. As a tree, the nodes on the graph link upward to their ancestor and downward to their descendants, but not across to other nodes. Because the base structure is a graph and not a strict tree, the flexibility of a graph remains available for future needs.

As for the timelines, they are unique when at the edge of the graph (the leaves of the tree) but otherwise are aggregates of their descendant timelines. That is the interior timelines are stacks of other timelines. Many timelines superimposed.

Making it look like this:

As you can see, the timeline at the root is a stack of its descendant timelines, as are the two interior nodes.

Why this structure?

Why? Because this graph of time-lines is capable of cleanly representing the observed behavior of any person to any degree of detail, beginning any time during their life. As a well-structured historical record of past behavior, it enables the modeling and prediction of future behavior.

Predictive models based on observed behavior aren’t new. The big advertising networks and marketing firms have been tracking your behavior and building predictive models for years, so clearly they already have the relevant data structures. You might prefer the direction I’m taking this one.

The exception is when we observe our own behavior, since we have a front row seat to our own life. Our motivations and interests are clear to us and the information we have is of high quality. We see the whole show in all of its gory detail.

With high-quality information about our own behavior we can better recognize problems and predict undesirable outcomes based on our behavior patterns. Then we can change course to avoid those outcomes. We can also better recognize that we are on track toward our goals and ambitions and predict where we’ll see challenges. Then we can shore up our weaknesses and renew our efforts.

Yet we have trouble breaking down our behavior into workable chunks; self-reflection and self-quantification are beneficial but difficult to find the time and energy for. Mostly we are simply “us”. We do what we do, focused primarily on getting from Here to There repeatedly throughout the day, at whatever pace we operate.

Behavior as a series of contextual actions

Anyone’s behavior can be viewed as a series of actions throughout the day. Get up, sit down, eat take-out sushi, watch TV, call Mom, run for 30 minutes, push a button, drive to the mall, and so on, into as much detail as we care to go. Each action is essentially a choice (conscious or not) based on the perceived best of (hopefully) several options.

Despite seeming like a continuous stream of “shit to do”, our behavior has a structure. That structure looks exactly like a graph of time-lines:

The key is that each graph node is a type of activity (or context) and each point in its timeline is an action of that type. A type of activity may be general like “yard work”, specific like “mow the lawn”, or anywhere between. Specific activities end up at the outside of the graph while the more general activities are near the root.

Each type of activity is effectively a context we enter. Most types of activity we engage in are separate from others in time, space, and frame of mind. The task-switching cost contributes this separation.

We don’t usually mow the lawn while making dinner. Dinner is part of the evening routine or the food context, while mowing the lawn part of the yard work context. We’d normally complete and then exit the dinner context before getting into the yard-work context (and vice versa). Same with housework: we often kick it off, tackle a bunch of related tasks, and exit after we’re satisfied (or finally interrupted). Same with most other types of activity.

Flexible growth

It’s important to note that a type of activity (or context) is never final, whether in reality or in this data structure. A type of activity may always be either broken down into greater detail or abstracted into a more general type of activity. Exactly when or where this happens depends on the interests and priorities of the observer.

Flexibility of this type enables a person to begin recording their observations at any point in their life and grow outward from there. It may be most comfortable to begin generally: did housework, made a sales call, replied to an email. Or perhaps a super-specific activity feels right: scrubbed the large saucepan. Then, from that single arbitrary initial point, both any level of detail and any other type of activity may be reached.

Predictions from good information are easy

Making useful predictions from a mass of poorly structured and partial information is quite difficult, requiring advanced statistical and machine learning techniques. For most people this is far out of reach, kept safely within the domain of large organizations.

However, when we observe and record our own behavior into a graph of time-lines, the information we collect is as complete, contextual, and accurate as we choose it to be. There is less need to fill in the gaps with statistics or machine learning.

The simplicity of the timelines leads to accurate predictions from relatively simple techniques. Our daily behavior is quite predictable: 93% of it, apparently. Once our various types of activity are separated into their own timelines and can be viewed independently, simply extrapolating “when is the next action” has significant value. The predictions can only improve from there.

Why should anyone care?

Predictive models of other people are inherently powerful; predictive models of the physical world are critically useful. Accurate predictions enable effective manipulation (physical or social) and competitive advantage. If we had a predictive model of ourself? We might solve all of our problems.

When we throw a football, we have to throw it hard enough and at a high enough angle to counter the forces of inertia, air resistance, and gravity. These are easy predictions because they are mostly constant. But when our target is moving, we also need to predict where it will be after the time it takes for the ball to travel. Complicated stuff, but done every day with no thought to the matter.

Animal predators succeed by predicting the behavior of their prey. Smell the prey? They’re probably nearby, so be stealthy. If the prey sees or smells the predator? It will probably bolt or hide. If the predator has to chase? May lose the race, may get hurt, may frighten the other options; best to minimize those risks. If the prey looks like it’s likely to fight back? Move on or wait for the perfect ambush. The whole process is based on information and prediction, and the predator gets its dinner only when it gathers good information, emits no useful information, predicts well, and acts accordingly. Whatever its predictive abilities, they must be enough to surprise its prey.

All in the same boat

The thing is, you and everyone you know also depend on and benefit from your predictive ability. The rules are the same for everyone; it’s an everyday, all the time, everywhere phenomenon whether you’re conscious of it or not.

The world is competitive and there’s no sense denying it. You are competing in one way or another for limited opportunities and resources, while at the same time avoiding ambushes by frighteningly capable high-level predators. Everything you hope to gain, achieve, or avoid depends on your relative predictive ability. When your predictive ability is dwarfed, you’ll find yourself in a compromising position soon enough. When it does the dwarfing, you’ll find your prospects greatly improved.

So if your life is not going as smoothly as you’d hoped, it would seem that you are afflicted by a relative shortage of predictive ability. You might appreciate a tool that solves that problem for you, a tool built upon a graph of timelines.

Check out part 2 which covers the contextual prediction algorithm.

--

--