Sort yourself out

Categories: Journal, Machine Learning
Comments: No Comments
Published on: August 18, 2018

Achievement: HAL 8999 – 1/100

  • Set up virtualenv for HAL8999
  • Installed sklearn, pandas, numpy, matplotlib
  • Unable to install tensorflow since I’m on python 3.7 and the pip installs only work for 3.6 and earlier. I can sort that out later.
  • Read up through Example 1-1 in Hands-On Machine Learning
    • Author is a little fast and loose with the example code and imports

I ended up burning close to an hour figuring out why my plot and model didn’t match the author’s even though we were using the same data. The issue turns out that I’d left out the following line when massaging / mangling the data:

It’s not immediately clear to me why presorting the values would make any difference but the unsorted dataframe included values well outside the range used in the author’s jupyter notebook. My guess is that by using the unsorted data I was applying the wrong GDP values to the wrong countries and so some outlier data made it into the model. Clearly my pandas-fu is weak. Po would be sad.

Also, Visual Studio Code is oddly pickier about the import of sklearn.linear_model and refused to initialize the model unless I specified the whole sklearn.linear_model.LinearRegression() where Jupyter was fine with linear_model.LinearRegression().

HAL 8999

Categories: Journal, Machine Learning
Tags: No Tags
Comments: No Comments
Published on: August 18, 2018

Some druids apparently wandered by and cast Wall of Thorns in my yard so I spent a good sized chunk of the morning clearing blackberry brambles.  While my hands were busy being impaled by the thorns which unerringly find the weak points in my gloves I got to thinking about some of the things on my internal to do list as well as my achievement list which I’ve been falling down on.

Since I’m already learning machine learning on an informal basis anyway I may as well be like one of the cool kids and do that “100 days of machine learning challenges”. Since “100 days of machine learning” is a relatively uninspiring name and makes things sound like a slog, the HAL 8999 achievement was born. One hour of ML or ML related math per day, every day, for 100 days with an associated blog post to keep the record clear.

Displaying Markdown and Latex in Jupyter output cells

Categories: Journal
Tags: ,
Comments: No Comments
Published on: August 14, 2018

Just out of curiosity I started looking into how to get jupyter to display text and math formatted as markdown and latex in output cells. This got into my head when I was looking at symbolic integration and differentiation of functions and how to format the output in a more civilized manner. I don’t have the full solution to the question but formatting output as markdown turned out to be ridiculously easy since the heavy lifting had already been done.


Displaying markdown and Latex in jupyter output cells


  • And of course the new WordPress editor is helpfully mangling both the code highlighting and output. Trust me, it works. I’ll have to sort out how to get “Gutenberg” to do the right thing later.
  • Thrashing around a bit now get’s the code highlighted but now the crayon tag is visible. Still no love for the actual Latex.

So far this morning

Categories: Journal, Projects
Comments: No Comments
Published on: August 11, 2018

So far this morning I’ve

  • Gotten jupyter notebooks running natively on my workstation rather than using the linux subsystem as a workaround
  • Learned how to integrate functions in python using scipy
  • Got exporting of jupyter notebooks to html working properly
  • Built a scale model of the terrain around my home town in Unity
  • Gained three levels on my warlock

Now I’m going to put my pants on.

Integrating Functions

Quick example on integrating functions with jupyter, matplotlib, numpy, and scipy

Import the required libraries

Define your function

For this example we’ll be using \(f(x) = e^{-x}sin(3x)\) as our function.

Set the range for your plot and integration

To plot \(f(x)\) we get an array of linearly spaced values from numpy, pass that array and our function to the plot function, and show the plot.

Evalating the integral \(\int_{0}^{2\pi}e^{-x}sin(3x)\) simply requires passing our function and the range of the intgral to scipy’s quad function which will return a tuple of the integral and the estimated error.

Integral: 0.29943976718048754
Estimated error 5.05015300411582e-13


Categories: Journal
Comments: No Comments
Published on: August 6, 2018

There comes a point when it’s clear that you’re not the central figure in your kid’s life. It’s a good thing. You know it’s going to happen someday. You accept it as a natural part of growing up.

The problem is, that moment sneaks up on you when you least expect it and then punches you in the kidney without the slightest warning. Sure, they still want to do things with you but, the fact is, you’re no longer at the top of the priority list and, in fact, you’re further down that list than you’d like to admit.

God, it hurts.

But, it’s good. It’s necessary. And I’d be the worst kind of parent if I manipulated my kid into doing things that make me happy rather than the things that make her happy. So, here I sit, going through another block of python code while she talks and laughs with her friends in the next room rather than playing video games with me.

It’s the right thing but damn if it doesn’t suck ass.

Plugin testing

Categories: Journal
Tags: ,
Comments: Comments Off
Published on: August 5, 2018

One of the benefits of coming back to an existing wordpress blog rather than continuing to try to roll my own in is that I can easily piggyback on other people writing plugins to solve the same problems. So far, the Crayon and MathJax-Latex plugins seem to fit the bill.

Testing syntax highlighting


class HelloWorld():
“””An unnecessarily complex hello world”””
def __init__(self):
print(“Hello world”)

if __name__ == “__main__”:
hello = HelloWorld()

Testing Latex / Math

J(\theta) &= \frac{1}{m}\sum_{i=1}^{m}Cost(h_\theta(x)^{(i)},y^{(i)}) \\
Cost(h_\theta(x),y) &= -log(h_\theta(x))& y=1 \\
Cost(h_\theta(x),y) &= -log(1-h_\theta(x))& y=0

Three years of silence

Categories: Family, Journal, Social Media
Tags: No Tags
Comments: Comments Off
Published on: August 5, 2018

I’ve been disconnected from social media for two years now. I still occasionally shitpost on reddit but that’s a habit I’ve largely broken myself of. I find, however, that I do need to find someplace to write things down that is both isolated enough from the internet that I don’t get much traffic but public enough that it’s accessible to the people who matter so I’ve dusted off this old wordpress blog. I shuttered it about the time I withdrew from most social media engagement and put the house in AR up for sale for the move to OR; too much to do, too little time.

Going back through the posts and republishing what had been previously made private simply reaffirms that keeping some form of journal is a good idea. I’ve been reminded of things I’d forgotten and identified trends and behaviors that you don’t see in your day to day grind. The short notes about life with my wife and daughter are what took me most by surprise. The reminders of how my little girl has been growing up and how much I love my wife hit hard.

I don’t get the last three years of silence back. I don’t know what I’ve forgotten but the value of keeping some sort of journal, even if it’s just to jog my own memory, is clear.

First world problems

Categories: Life
Tags: No Tags
Comments: Comments Off
Published on: July 23, 2015

I don’t know when this phrase entered my vocabulary. The only recollection I have of it is a comment that I can’t remember by a person I can’t recall on a messages board I’m uncertain of: definitely a first world problem. That little phrase so accurately and powerfully put into perspective the minor irritation the poster was referring to that it immediately became a reflexive yardstick in my own mind.

The grocery store is out of the yogurt I like, definitely a first world problem. Someone is wrong in the internet, definitely a first world problem. I’m out of the artificial sweetener I like, definitely a first world problem. There is a login queue for the MMO I’m playing, absolutely a first world problem.

Looking it up in google it’s clear that this is a meme that has soaked into my mind through osmosis. Reddit has a firstworldproblems board and #tagdef has a definition for it.

It’s like coming across something in your house that you didn’t buy and didn’t borrow. You’re not entirely sure how and why it got to be there and yet it fits with the decor.

This is the beginning of the song

Categories: Journal
Tags: No Tags
Comments: Comments Off
Published on: July 23, 2015

Cultural identity pings

Bad Buddhist: I don’t like prostration

Categories: Journal
Tags: No Tags
Comments: Comments Off
Published on: July 23, 2015

I was looking at some photos taken at a recent festival at Bodghaya and one of them were of the boards used by people making multiple prostrations. I’ve meditated with people who similarly, although less frequently, prostrate themselves. I never prostrate myself.

I understand many of the reasons for prostration but it never feels like anything other than an ostentatious display when public and a meaningless gesture when private. I’m sure that’s part of my western upbringing. Looking at the common rationals for prostration, it isn’t surprising that I’m not inclined to bow my head and bend my back: accumulation of merit, veneration of the Buddha, cultivating humility / negating pride.

The accumulation of merit has always struck me as a very simplistic way to get people to do good things when they might not otherwise be disposed to it. The performance of good deeds in the hopes of a better reincarnation smacks of the belief in something that is actually reincarnated. This runs counter to my own belief that I’m simply a temporary confluence of flesh, mind, thought and experience; that what lives on after I die are simply the echos and ripples of my thoughts and actions, not me. Good deeds aren’t for me, they’re for other people and if that moves the needle on the cosmic balance enough that I benefit indirectly, that’s my better life. Not the next life, this one.

Venerating the Buddha is similarly not a strong motivation to bow. Bowing before someone or some thing to venerate it just isn’t a big part of my cultural experience. My view of Siddhartha Gautama is closer to how a basketball fan might view Michael Jordan. I recognize the accomplishment and feel the desire to emulate it but, just as most basketball fans don’t bow to effigies of Jordan. My veneration takes the form of reaffirming my commitment and taking refuge.

Finally, the real reason I don’t want to prostrate myself is that I don’t want to bow my head or bend my back for anyone. I’m not vain but I am prideful. I should bow for no other reason than to cultivate humility. The trap there is when does prostration stop being an exercise in humility and become a display.

«page 1 of 12
Welcome , today is Sunday, August 19, 2018