Showing posts with label mathematics. Show all posts
Showing posts with label mathematics. Show all posts

Tuesday, June 19, 2007

Machine Learning - Introduction

Machine Learning - Introduction

After my latest blog on "Why Robots are the way of the future" I realized I have not really written about one of my greater passions...Machine Learning/Artificial Intelligence.

Machine Learning and Artificial Intelligence are not quite the same thing. Usually Machine Learning falls under the category of Computational Science, Mathematics, Computer Science and Statistics. Artificial Intelligence usually belongs to the Computer Science, Cognitive Science, Psychology and perhaps Mathematical Philosophy departments.

Machine Learning is generally the field of study related to the question: How can we teach a machine to perform a certain task as well as it can be performed?

However, Artificial Intelligence is generally an answer to the question: How can we simulate (or reproduce) the cognitive functions of humans/animals/intelligent beings? A lot of Artificial Intelligence seeks to model the human mind, which doesn't always do things optimally.

Both fields of study are important for developing algorithms and systems that are able to interact, aid, and enhance our lives. For instance, Machine Learning was used to create software to control a refinery. Up until the 1980's most refineries and their myriad pipes, valves, and gauges were controlled by humans. Any potential catastrophes had to be averted by alert workers. However, ML systems were developed that could optimally monitor and control refineries...even better than humans can! Furthermore, as conditions in the refinery change over time the software adapts and retrains itself without having to be reprogrammed over and over.

Interestingly, many of the Machine Learning algorithms are fairly simple in their approach. For instance, a basic classification algorithm is as follows:

Given a set of descriptions x and their associated objects/predictions y which are part of a set of classification categories {y_1, y_2, ... , y_n},

Build a model (a brain)

- For each unique classification y:

-take mean(x) for all x associated with the classification categories y_n

Make Predictions

- take an unclassified description x and evaluate the distances to each of the category means

- the unclassified description x will be classified according to the closest mean

Enhance the model with new examples

-given additional information x and y, recalculate the mean(x)'s with the new information...the model is now enhanced.

For example: Bobby stands by the road and for every vehicle that passes by quickly measures the length of the vehicle. Bobby also writes down whether the vehicle was an "18-wheeler" or "other". Using the above algorithm he calculates the mean "18-wheeler" length to be 20.4 feet, and the mean "other" vehicle length to be 10.9 feet. A blind girl named Jane comes along and says that she has just measured a vehicle that is 16.9 feet long, but can't tell if it's an "18-wheeler" or not. Bobby says that since the unobserved vehicle is closer in length to an "18-wheeler" it must be one!

This may not seem like a very intelligent algorithm (and it's not) but it does demonstrate one key feature of an intelligent algorithm, the ability to form it's internal computing algorithm via external data.

In the next few articles on Machine Learning I'd like to discuss some other more intelligent algorithms such as Support Vector Machines, Neural Networks and Random Forests...all three of which are some of the coolest and most effective AI/ML algorithms. Until then, see if you can think up your own intelligent algorithm...or use for an algorithm. I'd love to hear about it!

Monday, April 16, 2007

The Mathematics of Free Energy

The Mathematics of Free Energy

Some would note that I am a bit idealist about getting off the grid and Green energy. Some might say it's impossible and rather impractical. However, I believe that the mathematics behind it really "adds up". Here's a look at the arithmetic behind it all.

First the energy usage of the world per year: from ecoworld.com we have the following estimated energy usage in 1995:

316,000,000,000,000,000 BTU = 92,614,302,461,899 KW hrs

The math: The sun pumps out 1.3 KW hrs/m^2 of energy in outer space. The actual sunlight hitting the earth's surface varies throughout the year but let's say it averages 40% of the outer space value (which is a little on the low end). The earth has a land area of about 148,939,100 km^2. If we can harness that energy at 50% efficiency (high for existing technologies), then the following tells us how much energy we can catch in one hour on average.

1.3 (kW hrs/m^2)*1000000 (m^2/km^2)*148,939,100 (km^2) * .50 (efficiency) * .4 (amount reaching earth) = 38,724,166,000,000 kW hrs

More simple math shows that in only 2 hours the earth receives enough energy to power it for the rest of the year.

However let's say that we wished to avoid covering the whole earth in solar panels (after all I do like the green grass and nice trees...the minimum land area that we would need to produce to catch the energy required in one year would be:

Lmin = 92,614,302,461,899 KW hrs/(1.3 (KW hrs/m^2)*1000000 (m^2/km^2)* .50 (efficiency) * .4 (amount reaching earth) *24 (hrs/day)*365 (days/year)) = 40663 km^2

Thus with only .02 % of the earth's available land (or presumably oceanic) surface we could generate enough energy to totally power the earth for a year. Even if you factor in an extra 50% energy usage growth since 1995 and another 50% for future usage we would still only need to cover less than .05% of the earth in solar panels.

To put this in perspective, covering the otherwise unused Sahara desert (86,000,000 km^2) with solar panels would generate enough power each year to power 211 earths.

The proof is in the numbers, there is absolutely no reason to keep paying for oil, nuclear or anything else. Let's put up some solar panels, or windmills or invent something even better!

Tuesday, April 3, 2007

A Random Walk Through the Stock Market

A Random Walk Through the Stock Market

Have you ever taken a random walk in the park? If you say yes, then chances are, you are incorrect. Nearly everything we do has purpose and direction to it...if only because our minds have trouble doing anything without it.

The Stock Market exhibits a mathematical phenomena we call a Random Walk. A truly random walk in the park would mean that one starts off in the middle (or somewhere else), spins a four sided dice and decides to take a step forward or backward, left or right, based on the dice roll. Now aside from the question about whether a dice roll is truly random we will say that the path taken by our dice rolling park-walker is random. It may even look like this...

So how does this relate to the Stock Market? If we look at the stock market as a random walk in a 1 dimensional park, or a tight rope, than the price is randomly walking from low to high....or at least it is very nearly randomly walking. Google has been marching upwards for a while, while Microsoft has been backpedaling for a while now. But for the most part we can look at a stock as a very indecisive tight rope walker, he flips a coin and takes a step forward, flips the coin again and takes another step forward, flips the coin a third time and goes back, etc. etc.

So how can we take advantage of a random walk? Let's say that you and a buddy go to see the random tight rope walker. Let's say that your friend likes to gamble. He says to you....I'll bet you $1 that every time the tight rope walker flips that coin, you can't predict whether he will go backwards and forwards. Unfortunately, your friend is unaware that you are an expert in coin flip pattern recognition, and you are able to predict heads or tails with 55% accuracy. As the hours wear on you begin to slowly increase your profit. In fact, if you plotted your profit, it may look something like this...

Thus, a random walk not only describes the movement of the price of a stock, but for a day trader, it describes the value of his bank account. Therefore, one can nearly always make money in the stock market, provided one can predict the next general movement of the market with only a slightly better than 50% accuracy level.

So the real question is....why spend time trying to predict whether my favorite stock will shoot up 20 points in the next month when all I need to focus on is predicting the up and down movements and letting the laws of probability and Random Walk work in my favor?