Saturday, December 17, 2011

I NEED to know!

Why does Forrest Gump sit next to the TV instead of facing it while "watching TV"?

Does anyone know?


Someone asked the same in the comments for this video.

Anyone?

Sunday, November 13, 2011

Losing it (How to find stuff you've lost)

I recently lost my passport with my US visa in it. I made a thorough search everywhere. Everywhere it could possibly be, according to me. I finally found it, and remembered how happiness feels.

While doing this search I even googled how to find stuff you lost, and it turned out that I had already tried most of the suggestions I found in places such a this one and this one.

Since this problem of mine is chronic, I decided to share my experience losing stuff, hoping it might help you find something you've lost. Here's what has been useful to me:
  • Occam's Razor. Don't insist on far-fetched possibilities like "Someone's trying to destroy you, broke into your house to get your wallet and is going to do illegal stuff using your identity and get away with it leaving you to pay for the mess". Although that's possible, a more likely possibility is "You left your wallet at the bank", so relax. Things might even turn out where they're supposed to be.
  • Stalk Yourself. Make a detailed reconstruction of all the things you've done and places you've visited since you last saw the missing item until you first noticed it's missing. Social networks have become extremely handy for me: Check your Tweets and Facebook messages. Things like "At the movies, then to the bar" or "I hate bringing my backpack to the mall" may contain very helpful clues. Even pictures of you with and without the item might help.
  • Don't stick to one conclusion. Even if you've made a list of places you visited, people you talked to and things you did on one particular day, there's a big chance you didn't lose the item that day.
  • With all this info, ask everywhere. You have to be pushy. You have to insist and describe the object at least twice. Last time I had to ask the guy "Are you really really sure?, because it looks just like that envelope over there", which was not my envelope, but the guy remembered my envelope after looking at the one I pointed to. So if I hadn't insisted, I would've ended up writing something very different here. Remember: You're interested, no one else is.
  • Give up looking in places you've already looked thoroughly. Don't search your office 14 times (Like I did last time). If your cellphone wasn't inside your desk drawer yesterday, it won't be there today. But make sure you've searched thoroughly! It might be under a sheet of paper you overlooked twice.
  • If you need it soon, start getting a replacement. There is a chance that you won't find what you've lost. In that case, searching won't ultimately get your item and the sooner you start getting a replacement, the better. Worst case: You'll manage with your replacement. Best case: You'll have two of those.

Here's some advice

If you have trouble losing stuff often, consider the following preventive heuristics:
  • Accept the fact that you have a problem and try to focus. People lose their stuff because they're absent minded. Try to make it a routine to always ALWAYS look at the table before you leave the restaurant, check your wallet after paying for something, etc. Just like an alcoholic should always watch out, you must remember that you have a tendency to leave your stuff behind.
  • Have a special place for important things. You might want to consider getting a safe. Always put your important stuff there.
  • Put a tag on your important stuff with your contact info. If you don't want to use your phone number, you can use an email address you seldom use.
  • Pay a visit to your lawyer and get a certified copy of all your important/irreplaceable documents. You'll thank yourself  later (very much).
  • Always have a copy of your car keys in a separate key chain. I use my spare keys like twice a year.

Some examples

I've lost several things on several occasions, which have worried me very much. Here's a little summary of the latest with the places they were found:
  • 2007: I lost a briefcase containing my passport and my BSEE diploma. It was at a house I used to live in.
  • 2010: I lost my passport (again) at the JW Marriot in Orlando at FTF (Freescale's technology event). It was inside the safe of the room I had already checked out from.
  • 2010: I lost my Guatemalan ID (which took about 8 years to get since I'm originally from Honduras). I dropped it on the street in front of a place I visited. A kid found it and gave it to the salesperson.
  • 2011: I lost my backpack with my ASUS laptop at San Antonio, TX airport. The police took it as part of their policy of unattended luggage. They called me :S
  • 2011: I lost a bag of Sparkfun gooddies I was going to give away at a technology event that was coming up (I'm not the only one to blame for this one... this isn't the toughest on the list either). It was in a storage room I searched at least twice.
  • 2011: I (not my wife) lost an invitation to a wedding we had no clue when or where was going to be. It was in my wife's nightstand, where we both had looked at least twice.
  • 2011: I lost an envelope containing my LIFE: My Guatemalan ID and my passport with my US visa. It was at the supermarket. Not the supermarket I suspected, but the other one.
  • Always: I leave my car keys inside. Once I had to Clothes-Hanger it, but only once. Then I got a copy of my car keys and carry it with me in a separate keychain always.
  • 2011: I forgot to handbrake my car. I found it in front of my house with a dent on the front bumper :( 

________________________________________________________________________________
I want to thank my wife for being so supportive. I haven't forgiven myself for this last one. She has :)

Friday, October 21, 2011

A 7-Segment Display Recognizing Neural Network

Among other things, I teach Robotics to ECE students at Galileo University, Guatemala. I got to teach this class after 3 years of learning so much as a teaching assistant since 2005. Back then, in order to learn about artificial neural networks, I made a project that was assigned to our students, because I wanted to be able to answer their questions.


OK, so I made this application in Borland C++ Builder 6 back in 2005. The specific type of neural networks implemented in this project are Feed Forward Neural Networks using the Back Propagation Method, the ones described in generation5.org. By the way, if you want to learn about ANNs, I highly recommend the tutorials by James Matthews and Samuel Hsiung, which can be found at generation5.org.

This is the topology for the Neural Networks implemented. The perceptrons use the sigmoid activation function.

So this application is a Neural Network trained to recognize all 10 digits in a 7 segment display. The user enters the pattern using 7 buttons. It's supposed to guess the meaning of a received pattern, as would be required by an intelligent system (say, a robot) observing a 7 segment display, which is a very cool computer vision application.

You may argue that hard-coding the 10 digits would do the trick. True, but the real value in a neural network is that by means of teaching the system how the numbers look, you are giving it the chance to make guesses for incomplete or weird patterns, which would be the case if the observed display has one or more damaged segments. This is a very reduced application of the same principle used in OCR.

I made 2 implementations to solve this problem:
  • Single-Output ANN: Outputs an integer (0-9) corresponding to the digit concluded by the ANN given the input.
  • 7-Output ANN: Outputs an array of 7 boolean variables that represent each segment. This also works as an "Auto Complete" feature. This implementation has the disadvantage of being able to come up with non-numeric patterns (A, -1, L, E and so on). 
 The single output version of the application

In both applications, the user sets the following parameters (please go to generation5.org if you're not familiar with the terms):
    • 3 or 4 layered Neural Network (1 or 2 hidden layers).
    • How many neurons to use per layer (first MUST be 7 and last MUST be 7 or 1).
    • Training Goal: Train until a specific error % is reached or Train a specific number of iterations.
    • Eta, the learning rate.
    • The Bias.
    • The Goal (Error or Iterations).
Go ahead and try it. Sorry, they're Windows apps. I HAVE to start writing online code :(
The source code of the library I made is included in case you want to fiddle with it.

Artificial Intelligence 
I like Artificial Intelligence very much. I teach some of it at my Robotics class, but I never received formal education on it.

I recently enrolled in the online version of Standford's CS221 AI class to learn more. So far, it's been OK: relatively easy to understand, not prohibitively time consuming, sometimes it's been challenging, but most importantly: it's been fun.

Again, for practical stuff and to learn lots about AI, go to generation5.org