Wednesday, May 31, 2017

Machine Learning and Lots of Data

At the beginning of the month I wrote about artificial intelligence and how it is not going to take over the world any time soon. I have continued to play with it and have been working on a branch called supervised learning. My basic example or use case is to feed my simple program a bunch of training sentences that are categorized as questions or statements. Then I have a test group of sentences to see how well my program has learned.

I started with a very small set of training sentences thinking that a person would be able to distinguish between a question and a statement fairly easily using just these examples. My training set began with only 30 sentences and my test set had 20. After training, my program correctly identified 16 of the test set. That sounds pretty good at 80% but I really need to get closer to 100%. So I added more training data. I found a list of 800 random questions and added them as well as several pages of text from two popular books I found online: Uncle Tom's Cabin and The Old Man and the Sea. That brought me closer with 18 sentences correctly identified as statements or questions.

The statement, "I like to ski," was wrongly classified as a question while "Who is your favorite actor?" got classified as a statement. So I added more training data until I got 100% correct classification. My original training data started with 30 sentences and is now close to 1000. That seems like a lot of extra work.

Now it is time to tune my algorithm. There are some things I can do to get better results with less data. However if you plan to embark on your own supervised learning project, be prepared to collect a lot of training data. You will need it.

Friday, May 26, 2017

Learning from the Internet

The Internet is full of wonderful information and can be a great source of learning. It can also be full of lies and misdirection so you need to be careful with the information you find.

Today I am working on machine learning where I classify types of sentences. There are plenty of examples already created and so I am trying to leverage them instead of trying to recreate something. One of my Internet searches brought me to an interesting article that has nothing to do with machine learning or even sentence classification. It is an article about 5 writing tips that C. S. Lewis sent to a young aspiring author back in 1954.

I wrote a book back in 2001 called "Programming with Oracle Developer." Now I consider it a cure for insomnia but I am still proud that I managed to devote enough time to write a book that got published. During the process I would submit a chapter to the publisher who had several editors review it. One focused on the technical correctness while another fixed the grammar and wording. That process taught me that my writing needs a lot of fixing. So if you are like me and interested in learning about how to be a better writer, take a look at the link above.

Wednesday, May 24, 2017

The Official Start of Summer

This weekend signals the official start of summer as Memorial day is on Monday. In addition to the warmer weather, the days are also longer. This has me rethinking my nightly activities when I am in the Bay Area. While I could continue playing video games each night, the longer days have me thinking that there might be some better things to do with my time. Don't worry, I still plan to play video games, I just don't need to play as long.

One option is to spend more time on my kayak. While it might be fun to take my sailboat out every evening, that involves a lot of work stowing all of the electronics on the boat. It is much easier to take the kayak out and explore the local coastline. That also gives me some much-needed evening exercise.

Another option is to spend more time at the office. I ride my bike from the office to the boat each evening and the longer days mean I can spend more time working. While that may not sound like fun for most jobs, there are a lot of fun things to do in the evening at an office in the video game industry. We have a lot of "toys" to play with and I could use the extra time to experiment with new technologies. This is time I don't have during regular working hours.

I can also use this time to visit my son and his wife who live in San Jose. Of course this requires that I have a car because riding the 30 miles each way on my bike might not be possible even with the longer daylight hours. Getting a car in the Bay Area is an easy problem to solve and I can even bring one out on Monday as I have the whole day to drive it out.

More than likely I will come up with a mixture of the options mentioned above. Hopefully you also recognize the change in daylight hours and modify your schedule to use them to your advantage. Several years ago I would not have changed my daily routine as the seasons changed because every night involved watching TV. Now I realize there is more to do and it has opened a number of possibilities.

Tuesday, May 23, 2017

Waiting in a World of Instant Gratification

This morning I got a text from my wife commenting about how it is tough for one of our children to wait in today's society of instant gratification. My oldest daughter put her car for sale on a popular website in Utah. She has started commuting more and wants to switch out her perfect snow car for something that gets a bit better gas mileage. My daughter listed the car last night and is frustrated that it hasn't sold yet after only a few hours. I had to laugh that she had such high hopes for selling her car so quickly. In order to do that, you have to price it well below what it is worth.

My daughter's experience highlights a trend in society today. We are so used to getting things almost instantly that we forget that certain things take time. If you want to watch a movie, there is no need to go anywhere like we used to have to. Simply log into your favorite streaming service and you can watch it on any number of devices. Want to send someone a quick note, text them and you will usually get an instant response. Most people are more likely to respond to your text message than they are to answer your call.

Contrast those immediate things with those that take time. When you are creating a masterpiece, you make sure everything is perfect. If you want to get the most money for the car you are selling, wait until the weekend when people have the time to look for new cars. Remember that some things are not instant and take time.


Thursday, May 18, 2017

Increasing Blog Traffic

My oldest son recently did a review for a pair of ski bindings from Tyrolia. Naturally he provided them with a favorable review and then provided a link to it on their Facebook page which they immediately made available to all of their followers/visitors. His blog page received a lot of traffic and that made him happy.

I have been wondering how to increase the traffic to my own blog and my son's experience provided one example of how to do so. I had never thought about submitting a product review to the manufacturer based on one of my own postings. It is a brilliant idea. If you have a blog and want to increase your traffic, do a review in one of your postings and let the company know about it. Now I just need to find a product worthy of a review.

Thursday, May 4, 2017

AI is Still Pretty Stupid

This past week I have been doing some research on artificial intelligence and it has been a lot of fun. I created one program to tell knock-knock jokes. Then I created another to play something similar to the old text-based game called Adventure. Both of those programs I create with the help of AIML and they each only took a few hours.

Next I looked at doing something a bit more advanced and utilized scikit-learn in Python with some machine learning. This time I played with creating a program to converse with me. I downloaded a number of training files that are used to train the program in the English language. The training took less than an hour and soon I could start interacting with my program. I typed in my first statement and it thought about it for a while. After several minutes, it spit out something in English that didn't match my initial comment. I figured my program needed a bit more training and so I taught it a few facts like "2 + 2 = 4". It responded with the correct answer when I asked what "two plus two" was. Then I asked about 2 plus 3 and it returned "2 + 2 = 4".

I played around a bit more and came to the conclusion that simple AI programs with an hour of training are really stupid. So how to do you spend more time teaching an AI program? Microsoft created Tay and let it loose on the Internet. In less than a day, it became incredibly racist. Naturally they quickly stopped the program. Think about it, would you really want your child to learn all its knowledge from the Internet? Of course not and so allowing your AI program to roam free on the Internet is probably not a good idea. The reason we send kids to school is that we want them to learn from a trusted source and for certain knowledge we don't even trust ourselves.