Monday, March 23, 2009

Oops...

That's what I get for being lazy with writing. I was beaten to the punch by this guy: http://scobleizer.com/2009/03/21/why-facebook-has-never-listened-and-why-it-definitely-wont-start-now/


And I'm sure by many others...Oh well :)

On Optimization...application

This is Part Two of my optimization posts: the application.


A lot of people have been complaining about the Facebook redesign. In fact, there are so many complaints coming in (one "study" claims 90%, but the group was self-selected, so the numbers are useless) that some internet folk have stated their astonishment that Facebook would do such a radical re-design without even considering their users' tastes through A/B testing (like Amazon uses).

I must say, I find this chatter quite silly. Admittedly, I have no idea what's going on in Facebook HQ, but I do know that they make an amazing product*, and I'm confident that they know exactly what they're doing, whether they think that directly pleases the users or not. Wait, what?

*(This asterisk style comes from JoePo. What can I say? He's a genius. I think I'll be using it, because it makes my sentences less confusing- I can expound on a topic later, but not too-far-end-of-the-page later.) I don't spend a lot of time on Facebook, but every time I go exploring around the site, I find another feature implemented really, really well. Those guys are good.


There, I said it. Doing what the users want does not translate to ultimate success. To connect this to Optimization, sites that do exactly what the users want right this minute are finding the local maximum of their site's success. They look directly to the right, and they see the graph peaks. They look left, and the site hits a valley. So they go right, and they're at the highest point as far as the eye can see, and everyone is happy. But...they're not at the global max, and they are thus not as successful as they could be.

Sites like Facebook determine what is best for the site, not solely based on user polling, and they implement it. Sure, they take back some mistakes (certain News Feed and privacy issues come to mind) quickly based on user reaction, but the overall direction of the site stays the same. Veterans of Facebook will tell you, this is hardly the first time that "everyone" using Facebook hated the redesign, and yet, the site continues to grow.

The site continues to grow because Facebook is seeking the global maximum of social networking sites. Through opening the site to the general public (the jury's still out on that one, in my opinion), and through emphasis on presenting fresh content every visit with the News Feed (this is a huge win for them), Facebook is going where they feel will lead to the most success possible.

Of course, this does not always work out. Like Apple, if Facebook's strategy of defining boldly what the consumer gets is to work, the theory behind their moves must be sound. So far, it's working out pretty well, but that doesn't mean it always will.

But imagine this: if, 5 years ago, MySpace polled their users endlessly about what features they wanted, and implemented everything they wanted, do you think the site would've ended up like Facebook (in the end, a much more successful site)? No way. MySpace would've found their local maximum (they probably did that a while ago...), and continued to serve their users the way they thought best. Meanwhile, getting back to the math post, just beyond their detail level, an enticing, new, global maximum was lurking, and they never achieved it.


In short, I think Facebook really does know what they're doing. I'm still not 100% convinced on their money-making schemes (I don't think advertising is working as well as they thought), but I think that, in the end, this new design will end up driving more traffic (and thus, more profit) to them. Just like the other re-designs, there will be lots of critiscm, followed by more and more people addicted to Facebook ;).

On Optimization...

This is part one of two on mathematical optimization. Part two will cover an interesting application of this stuff. You may want to skip to part two ;)

I'm in a math class called Optimization this semester. Essentially, we study what methods the computer (in our case, Mathematica) uses to solve optimization problems.

An optimization problem can be as simple as deciding which gas station to go to, with variables of distance and price, or as complex as the math behind Obama's economic policy. At first glance, these problems seem very simple to solve, and indeed, for problems like the gas station choice, they can be solved with naive methods. As always, though, this math topic is more complicated than it seems.

Imagine if you were a particularly mathematically inclined high school senior deciding which college to go to. After your initial college visits, you've taken detailed notes on each college, ranging from the food services (Bowdoin is consistently in the top 2 nationwide) and dorm life to grad school acceptance rates and student:faculty ratio. Further imagine that all of these factors (some quite subjective) can be assigned numerical values. Then to decide which college is best for you, you write an optimization problem that assigns weights (modeled by constraints such as food >= 8.0) to each variable, according to your personal taste.

By the time you're done, there may be 10, 15, 20 variables! And to think, this problem is downright tame compared to most optimization problems (which can have thousands of variables!). While a normal high school student surely runs a version of this very same optimization problem in their heads while choosing a college, you will settle for nothing less than the exact correct college. But how? Can't we just play around with the variables until we get the right answer? Technically, yes, but this is not as easy as approximating distance and price of gas stations. With this sort of complex optimization problem, changing one variable may have an influence on the others, and before you know it, your head is aching from all the possible combinations of variables. (Mathematica to the rescue!!)

But seriously, Mathematica is a great tool for solving optimization problems, but how does it work? That, dear reader, is far too much detail for this already lengthy post. The point I'm getting at here is that some problems can't be solved by tinkering with variables one at a time, because once you have a complicated problem to solve, changing one variable can change the entire nature of the problem. In addition, with multiple variables, there are just too many things to tinker with. For a one variable problem, I could simply graph the function and find the low spot, right? Sure! The formal way to solve this (this is an important distinction from just "using the picture") is to find all the places where the derivative (and thus, slope) equals zero. If my minimizer isn't one of these points, then the slope at my minimizer has some value, like 1, which means I can continue along my function and find a lower point...thus, I didn't really find a minimizer.

For a two variable problem, I can still draw a graph, but I have to do it in 3D. For a three variable problem...uh oh. In fact, even two variable problems can be hard, if the function is ugly enough.

So, for the college optimization problem, we start to see why we needed to move away from simply following the graph to the low point in the example above. I can not draw a graph in 20 dimensions (hey, I'm not a visual arts major!), but even if I could, how exactly would I trace the function along and find the low point? This is a problem even in a 2 variable problem (represented as a 3D graph). I can poke around the graph, zoom in, and perhaps find a spot where the function is minimized locally. But how can I be sure that that is the global minimizer? I really can't, unless I check every part of the graph! Not only is this tedious, it's quite impossible- functions have infinite resolution by definition, so you can't just zoom in enough that the function stops changing. If the function is complex enough, there can be all sorts of crazy behavior lying just below your current detail level.

Thus, we need a symbolic way of solving this problem, akin to solving the derivative function in the one variable example. That way, no matter how crazy the function is, we don't have to go zooming in and panning around forever- we just get the answers. Unfortunately, the methods for higher order (meaning more variables) functions are not as easy.


If this post made very little sense or seems to have no connection to life, go ahead and read part two, where I will attempt to connect these topics to internet companies.

Wednesday, November 26, 2008

A Program

After seeing this post by Kottke, I decided that a logical way to spend my time in the middle of studying for midterms would be to create the program requested!

Of course, the author had already found people to code it for him, but I thought it would be an easy way to play with some python.

Here's the code. Feel free to use it for whatever, just let me know if you do.

Depending on my time and effort (what doesn't?), I may modify this program to be more sentient. We'll see.

Happy Thanksgiving!

Friday, October 31, 2008

Deal or No Deal?

Don't worry, I haven't yet sold out to The Man, so this isn't an advertisement for this awful show (read up if you haven't heard about it). Rather, I wanted to share this video, which is currently making the rounds on the internets.

I'll save you the time of reading the comments on this video from digg, reddit, etc...they basically sum to "OMG that guy is such a fool!!"

Of course, I have to agree. However, I feel that this situation opens up an interesting psychological question. My parents watch Deal or No Deal on occasion, and they always complain of "stupid" people who get "too greedy". I always laugh at this, because due to the nature of the game, you're really being greedy as soon as you eliminate a briefcase. (In fact, this judgment has been passed on many others, e.g., the characters in the movie 21. Some say when viewing the movie, "why didn't they just quit while they were ahead?!?!?")

Allow me to explain: Deal or No Deal is a game of 100% luck. There is absolutely no strategy involved in picking which case you want to be eliminated, nor is there a way to "outsmart" the bank. Interestingly, in my one quick viewing of the show, I thought that the bank offer was a straight average of the remaining cases.
As it turns out, the average is weighted, and as the game progresses, the average approaches the straight average. In other words, the bank will offer a "bad" deal in the beginning of the game, and a relatively "good" deal at the end.

Anyway, back to the story. I always find it funny when people judge the decisions of people on the show, saying something like "I can't believe it! Just take the deal and walk away! You have (insert amount here) already!"

Of course, this is not sound logic. At what point is it silly to not take the deal? Since each deal is worse than a straight average of the remaining cases, is it ever really silly? Of course, the deal is worse because it is a balanced alternative to risk. But I digress- imagine this:

play while cases > 0:
------>if logicalToDeal then return
------>eliminate case x with $y in it. //This raises/lowers my overall average, and thus, my bank deal.

At what point does logicalToDeal become true?
If you imagine playing a game, what determines the value of logicalToDeal?

Probably the only way to play the game is similar to generic smart money strategies: set a limit and stick to it. I will determine a money value X, where X is enough to make the game worthwhile. If I ever get a bank deal >= X, then I will stop playing.

Two things:
1) What is X?
2) What if you never reach X?

#1 is interesting in this case because you cannot lose money in this game. Unlike setting a limit for yourself at a casino, where you really have to set both an upper and lower bound, in Deal or No Deal, the worst that can happen is you walk away with the briefcase with the least amount of money. For sure, that would be a disappointment relative to what you could've won, but nothing truly bad will happen if you play too risky.
(This goes back to the kids in 21- at what point should they just have walked away?)

My overall point is that it is meaningless to simply state that one is a fool for not making a deal, walking away, etc. There is no set point where one path becomes more logical than the other in games like these, so the point where one should give up is mostly arbitrary and personal.

PS: wouldn't it be nice to be a contestant on this show? You don't have to have any intelligence, because there is no possible way to strategize, and you always win money. Sounds awesome!

Monday, October 27, 2008

Illusion of Security

Bank of America's SiteKey is vulnerable to a very simple man-in-the-middle attack. Who would've thought? By the way, this is similar to the most elegant way to defeat Captchas (via CodingHorror).

Man-in-the-middle attacks are a simple and powerful concept. The basic concept as it applies to the two cases mentioned above is to present the user with the image needing cracking under false authority. For Bank of America, it would be a phishing website posting your SiteKey, and for Captchas, it would be some sort of incentive website requiring a Captcha solve to view the content requested.

Pretend that I want to hack into your credit card account. In the good old days, I would send you an email claiming that I, the President of Bank of America, require you to change your password using this link: http://bank0famerica.com. Then I would grab your password out of my website, and use it to log into the REAL http://bankofamerica.com, and I would be rich. Hurray!

Then, Bank of America instituted a SiteKey, which is an image and a title that you pick to recognize when you try to login to their site. The idea is that my bank0famerica wouldn't know your SiteKey and thus you would immediately unplug your computer to protect yourself from the nasties. (Ignore the fact that most people probably glaze over their SiteKey...these are, after all, the people who have already clicked on a link from an email to do something important, failed to notice the wrong website domain...etc)

Unfortunately, if I'm going to go through the trouble of setting up bank0fAmerica, I think I'd figure out in short order how to defeat the SiteKey. Namely, I ask you to enter your online-ID, just as BankOfAmerica does, and then send that ID to the real website. When I get the SiteKey back from the real website, I feed it to the fake website presented to you. Then you think it's really BankOfAmerica and proceed.

In fact, the SiteKey is so easily defeated, it may actually be worse for security! I could be convinced that it provides a false security blanket, such that Joe SixPack's one last vestige of alertness was assuaged when the impenetrable SiteKey verified my site as legit.

So, what's the better option? Well, unfortunately, it's a tough balance to strike between user effort and security. Here's a good place to start if you're looking for more on security. I'll be thinking about an easy way to really secure BankOfAmerica, and if genius strikes, I'll be back to post!

The Misapplication of Technology

Believe it or not, there are some things in life that don't need touch screens.

I simply cannot fathom the point of using a touch screen voting system. I'm all for eliminating paper ballots, but this is just so poorly done, it's almost amusing.

You all know about the security compromises in these machines, and the corruption of the company itself, but added to all of that, the machines don't even work properly?

Looking at the interface in the CNN video (I vote absentee so I haven't used one of these yet, thankfully), it's frightening how poorly designed it is. As anyone with an iPhone knows, when you have two small selections bordering each other, your intent can really go either way. Now imagine a less accurate touch screen, mis-calibrated, and you're not used to the specific quirks. Now imagine you're a senior citizen who doesn't even own a computer. Geeeez.

I'm waiting for a good argument FOR touch screens in voting machines. Even if a properly secured system were designed by an impartial company and proven to be zero-defect (an amusing, if inaccurate, list of complaints), what's wrong with putting a few physical buttons on the machine? I just cannot fathom how touch screens are better in any aspect.

The absolute least effort you could do is have a Democrat and Republican button. Use nice, big labels for the elderly, and it's cheaper and more effective! Too easy for the government, I guess. And don't get me started on making November 4th a national holiday...