Knowing When To Take A Break

I can easily get lost in a task. When I get into something, hours can pass without my noticing. This can be great sometimes – I can sit and grind away at a problem for hours if I find it interesting.

This often means that I can make a lot of progress all at once if things go smoothly. That’s not always the case, though. Bugs and other issues come up while I’m working. Most of the time I can just handle them and move on, but sometimes I’ll run into an issue that I just can’t figure out.

In many situations, being able to continue working on a stubborn problem until you find a solution is a good thing. At a certain point, it’s better to take a break and walk away from the problem for a while.

Photo by Elisa Ventur on Unsplash

It’s difficult to know when I’m at that point. I fall into the trap of thinking “I know I can figure this out if I just try one more thing.” For awhile, this isn’t a problem. Suddenly, I’ll find myself getting so frustrated that I feel physically ill. Even at that point, it’s hard to step away because, again, “I know I can figure this out if I just try one more thing.”

I know from experience that sometimes all it takes to solve a previously unsolvable problem is to take the dog for a walk and revisit the issue after a break. Sometimes the best option is to call it a day and come back to the problem with fresh eyes in the morning.

The current issue I’m dealing with (which prompted me to write this post)

Right now, I’m deciding to step away from the computer for the rest of the night. I’ve been trying to figure out why VSCode isn’t recognizing numpy anymore, even though it had been up until this afternoon. I’ve spent way too much time on this issue and I haven’t gotten anywhere. Tomorrow, I’ll start fresh.



Today, I wrote my first simple program using scikit-learn, a machine learning library for Python. During our kickoff meeting, our sponsor recommended that we familiarize ourselves with this library before getting started on our project. My teammate found a helpful tutorial and shared it with the rest of us.

“Machine Learning with Python” tutorial by Programming with Mosh

Of course, the first thing the tutorial had us do was write a Hello World program. Instead of using an IDE like PyCharm or Visual Studio Code, we used Jupyter. Jupyter is helpful when writing a program that interacts with data because it allows you to view the data just below any function calls you make.

Jupyter allows you to view data just below function calls. Here, Jupyter is showing the output of describe() and values() when working with the Video Game Sales dataset from Kaggle.

After getting familiar with Jupyter and its shortcuts, we begin working on a program that predicts a person’s musical preference based on their age and sex. We are using a simple dataset with only a few attributes and we are assuming that all males within a certain age range prefer the same type of music. The same is assumed to be true about females. At this point, the intimidation I was feeling about getting started faded away. Working with such a small set of data and having only 2 factors (age and sex) made it easy to grasp.

Our first step was to train our model to be able to predict a person’s musical preference. Since we only had one set of data, we learned how to split the data into input data for training, input data for testing, output data for training, and output data for testing. We were also able to obtain the accuracy of the model by comparing the testing output (musical preference) with the actual data. Then, we played around with using different ratios of training data to testing data and saw how drastically this changes the accuracy.

Once we got a model with a sufficiently high accuracy score, we learned how to make our model persistent so we don’t have to create a new model each time we edit our program. This isn’t exactly essential for this simple program as it deals with only a small amount of data, but it would absolutely be necessary when dealing with more complex programs and large amount of data.

We also learned how to create a .dot file, which shows us the decision tree that our model creates and uses. Below, you can see the line of code that creates this file, followed by the visual representation of the decision tree.

This exports a .dot file that shows the decision tree created and used by our model.
When opened in VSCode with a .dot viewer extension, we can see the decision tree created and used by our model.

This tutorial showed how accessible machine learning is – with this help of scikit-learn, anyone who is familiar with Python and has even a small amount of data can write a program that utilizes machine learning to make predictions when tested. This program uses a binary decision tree, but there are several other approaches (including neural network, which we will be using in our Capstone project). I’m excited to start working with other components from this library!


Fire Risk Prediction

I’ve been waiting to write this post in the hopes that we would get our project assignments before the first blog post is due. I’m very happy that I got my first choice, the fire risk prediction project! There were a few others that I would have enjoyed working on, but this one immediately stood out to me.

I’m a little nervous about this project, too. I’ve never done anything with machine learning or artificial intelligence, so I don’t know too much about it. The first thing that comes to mind when I think of AI is how many wonderful and disgusting cat names become possible when a computer is given basic training. The second thing I think of is the programmer who used Generative Adversarial Networks to create a generation of freakishly sort-of-believable Pok√©mon. Beyond that, I’m basically a layperson in this subject.

Luckily the project brief says that understanding the basics of machine learning and artificial intelligence is an objective, not a prerequisite. I expect that I’ll need to spend quite a bit more than 10 hours per week to get a good grasp on the subject and be an asset to my team. Thankfully, this is the only class I’m taking this term and my job will be somewhat less demanding after I finish my current project, so I should be able to devote plenty of time to this class.

Overall, I’m very excited to get started on this project! I know it will be challenging, but what better way to learn a new topic than to jump in with “code that could save lives”?