How To Use Gradient Descent To Optimize Your Life

How far can you go? Probably very far. You can probably achieve almost anything you want. Imagine then, how important your value system is. Before putting yourself on a path to reach your goals and values, should you not evaluate these same goals and values? Putting them through scrutiny, much in the same way as you might do to your methods of getting there, should be a sensible thing to do.

Let me use a machine learning analogy to make the point. In machine learning you can use gradient descent to optimize the output of a loss function. The utility of gradient descent is to optimize all the gradients (inputs) into the loss function so that the loss (or inverse benefit) is as low as possible. To improve you need to find the correct loss function, i.e. what are you optimizing for? And secondly, find the optimal way to structure the gradients.

Without the right loss function, you are aiming at the wrong target. That is, loss function comes first. Not until you’ve defined the loss function should you optimize the inputs. Anything else would be like throwing darts blind folded after being spun 5 rotations at the spot. You might hit the target, but it’s equally likely that you’ll do damage.

Finding the right target takes time. And you will probably never find the perfect loss function for you. However you might find a better loss function today than what you woke up with this morning. And tomorrow you might find an even better one. Let’s assume then that the loss function cannot be perfect, but it can be improved and you will benefit from revisiting it as you learn new things.

When you’ve arrived at a loss function that is acceptable to you, let’s optimize the inputs. The inputs are how you spend your limited time. You have 24 hours every day, and 168 hours every week, and there are practically unlimited ways to spend them. What they all have in common is that they do have a gradient impact (or zero being no impact) on your loss function. In this case the gradient tells us in what direction the value of your loss function will move if you spend one more unit of time on this specific activity. If you want to look at this for a bigger scale use case, let’s say for an organization, you can replace time below with resources (both time and capital.)

Let’s say that an example person we call Tim has the loss function of his healthspan (how long he will live a healthy life) * wealth. Examples of inputs can be doing sports, reading, working, hanging out with friends, reading email, sleeping and cleaning.

Let’s randomize the initial values:

{  
  'sports':        2,
  'reading':       3,
  'working':       2,
  'friends':       3,
  'reading_email': 4,
  'sleeping':      9,
  'cleaning':      1
}

Tim is lucky. He gets 9 hours of sleep per day. However there is probably room for optimization here. Let’s estimate what impact a 30 minute (rough gradient steps) increase in any of these can have on his loss function. That is, we’ll estimate the gradient of each activity:

Sports: 2 hours of sports per day is probably healthy. But I doubt putting another 30 minutes on it will have any positive impact on neither health nor wealth (unless he can become a professional athlete, but let’s assume he won’t in this universe.) Probably the impact is “slightly negative”.

Reading: 3 hours. Increasing it to 3.5 hours can make him smarter and healthier, and also increase his chances for wealth due to this. “slightly positive”.

Working: 2 hours. The impact both on his health and wealth of working more is “strongly positive”.

Friends: 3 hours. Probably a “slightly negative”.

Reading email: 4 hours. Probably “slightly negative”. Can’t have much more email to read.

Sleeping: 9 hours. Probably “slightly negative”. Adding more wouldn’t help much or could even be bad for his health while removing some wouldn’t hurt much.

Cleaning: 1 hour. Probably “neutral”. Cleaning more can’t do much good for either health or wealth.

Now when we’ve evaluated the gradients of each activity, let’s make changes to the time allocation. Since we have a limited budget input we’ll use the update by taking 30 minutes from the negative ones and distributing it among the positive ones.

Negatives: sports, friends, email, sleeping.

Positives: working, reading. We’ll move 1 hour to each of them:

{
  'sports':        1.5,
  'reading':       4,
  'working':       3,
  'friends':       2.5,
  'reading_email': 3.5,
  'sleeping':      8.5,
  'cleaning':      1
}

After the first iteration this is our output. We want to continue doing this activity for a number of iterations until it stabilizes. to make this stabilize closer to truth, you may want to reduce the step size gradually to 15 minutes, 10 minutes, 5 minutes, etc., until you see that each iteration does not provide any material benefit in terms of output of the loss function. Another thing we can do is to add new activities to the list like “planning”, “meditating”, “cooking”, etc. Anything you can spend time on that has a positive impact on your loss function or something that you already spend time on.

If you analyzed your loss function, did you find anything that you can improve about it? Did this give you any new perspectives on how you are spending your time, or how you can spend your time better?

One response to “How To Use Gradient Descent To Optimize Your Life”

  1. […] I wanted to answer two questions in doing this; how do I currently spend my time? And is there anything I can remove or cut down on to leave room for other things that I find more valuable? […]

Leave a Reply

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