Friday, September 26, 2008

NetflixPrize. One milestone reached.

Netflix.com has a programming challenge to improve their movie recommendation system by atleast 10%. Their system (Cinematch) has an RMSE of 0.9514.

See details of the challenge on www.NetflixPrize.com.

I registered in 2006 Dec. My initial algorithm was mostly based on creating customer categories based on their rating habits, seasonal moods etc. But I couldn't do better than 0.98. The problem was the customers that had refused to fit in any pattern. Their standard deviation of ratings in any group was pretty high (1.2+).

I gave up.

Last week I came up with an idea to take care of these unpredictable customers by linking IMDB genre data. The idea is to categorize the customers based on what kind of movies they like.

And I beat the Netflix's Cinematch 0.03 points. My new RMSE is 0.9287.



Now I am stuck again. Not sure what else to try.

Monday, August 18, 2008

Must. See. This. Movie.



Mustache- check
Knife in each hand-check
'Bastard I will kill you' expression-check
Two lions regretting their decision to attack a true bad ass-check

Today I can safely say that I found the definition of 'Awesome'.

Tuesday, June 24, 2008

PXP. Stock Analysis.

Ticker : PXP
Current Price : $76.85
More info: Plains Exploration & Production Co
Company Type : Growth
Sector : Energy
Industry : Oil & Gas Operations
Market Cap : Mid Cap. 8.261 B.

Current Stock Trend: Long Uptrend

Important Ratios:

Ratio Company Average Industry RatioGood?
P/E22.92 15.00 false
PEG0.51 1.00 true

TL/E

(Total Liability/ Equity)

1.56 1.44 false

P/CF

(Price/Cash flow)

0.00 0.00 false

P/B

0.00 0.00 false

Fundamentals during last 5 Quarters:

Dbt/CF
(This ratio tells me how company is using the borrowed money)

17.742118.762074

Cash Flow

28430214412119.95

Debt

5,0516,3552,7102,5271,484

Net Income

16380322520

Income increase

104%143%29%23%

Fundamentals during last 5 years:

Dbt/CF

10.811.974.374.857.25

Cash Flow

588674463363118

Debt

6,3551,3322,0231,762858

Net Income

158597-2148.8459

Income increase

-73%100%-2,520%-85%

MSN Caps rating.

Going to significantly outperform the market With less than average risk

Pros
Relative price change and consistency is very high. Very positive
Earnings was much higher than forecast. Positive
P/S is significantly higher . Very positive
Cons
The PE is higer. Negative

Opinion Bars

First bar: Industry analysts bar opinion about this stock. (Hold and sell are counted as sell. Buy is not counted. Strong buy's are counted as buy)
Analysts : 13: Buy 3: Sell

Second Bar: Opinions from socialpicks.com website.
SocialPicks: 3 Buy 0 Sell

Third Bar : This bar tells me if the mutual funds and institutions are buying this stock.
Market Action : 15 Buy 6 Sell

General Market buzz

Insider Trading (% of stocks traded during last 1 year compared to what they had before)

Delimitros Tom H (Director) :-37%
Dees Jerry L (Director) :-18%
Flores James C (Controller) :-62%
Feeback Cynthia A (CAO) :-12%
Buckwalter Alan R Iii (Director) :-5%
Lollar John H (Director) :-2%
Gerry Robert L Iii (Director) :-17%
Wombwell John F (COO) :-35%
Arnold Isaac Jr (Director) :-5%
Talbert Winston M (VP) :-6%

Report created on Tue Jun/24/2008 03:14

Thursday, April 3, 2008

JQuery: The Good, the Bad and the Ugly

Like the rest of the world, we are using JQuery now. We have been doing browser based rich client applications over the last 7-8 years now.

All this experience has taught us to be very skeptical of these 'cool' libraries that spring up every 2 months. Most of these libraries look good only on demos. But using them with our existing framework or mixing multiple libraries can lead to not so pleasant experiences. These libraries interfere with each other or try to hijack the CSS styles of other widgets.

JQuery is definitely one of the lowest maintenance libraries that we have used so far. So far so good!

JQuery is based on the philosophy of consistent and limited API and compact codebase. John Resig, the creator of JQuery talks about this philosophy in this amazing Google video. http://video.google.com/videoplay?docid=-474821803269194441

With my limited experience, this is how JQuery looks to me:

1. GOOD methods.
2. Promotes BAD programming practices.
3. Code gets UGLY.

The Good:

$() Access function provides us flexibility of use. It's a great alternative to document.getElementById(). Also it provides consistency in accessing objects.

See following example:
var d = $("#MyDivId")

Above returns the JQuery object that represents the div tag that has an id="MyDivId".
Also I can do $(d) and I will get the same object back.

$
(document.getElementById("MyDivId")) will also returns me the same JQuery object.

The main advantage of the last method is that it allows us to integrate JQuery techniques into any existing AJAX codebase.

Also I love the .html() and .text(), .append() and .prepend() methods. They are simple. (I hate the .prependTo() and .appendTo() though. They don't make sense. Seems like an afterthought.).
Another pretty method is .css() on a JQuery object. css() method makes it very simple to do the CSS manipulations on the objects without worrying about cross browser compatibility issues.

The Bad
JQuery examples promote some bad programming practices.

Most of the code snippets about JQuery seem to consistently follow some very bad programming practices. Every example insists on creating JQuery objects for every call. I haven't seen many code samples that use variables. I think this practice originated from John Resig's promotion of enclosures and inline functions in JavaScript.

Let’s see the following example of supporting hover on a div object:

function fnPageLoaded(){
$("#MyDivId").hover(function(){
$(this).addClass("hover");
}, function(){
$(this).removeClass("hover");
});
}

$(document).bind("ready", fnPageLoaded);

The above code should be written as following:

function fnPageLoaded(){
var d = $("#MyDivId");
d.hover(function(){
d.addClass("hover");
}, function(){
d.removeClass("hover");
});
}//fnPageLoaded


Even better,

function fnPageLoaded(){

var d = $("#MyDivId");

function fnOver(){d.addClass("hover");}
function fnOut(){d.removeClass("hover");}

d.hover(fnOver, fnOut);

}//fnPageLoaded

Try to use local variables for function and JQuery access pointers.

These local variables do the following things:
1] Reduce unnecessary calls to the functions.
2] Make code more readable.
3] Good variable names self document the code flow.

The access method $() in JQuery has a significant amount of code in it. Calling it multiple times will slow down your code.

Chaining these JQuery calls reduces the number of variables we need in the local scope. But it makes the code ugly.
This brings me to my 'The Ugly' part of JQuery.


The Ugly

One of the basic principals of programming is writing simple code. Even comments don't help a complex code.

The side effect of writing a lot of anonymous functions is ugly code. At first glace, most of codebase using JQuery looks like random mix of '#', '()', '{}' and ';' operators. If you haven't written that piece of code, it becomes impossible to step into and understand. This reminds me of debugging regular expressions written by someone else. Your JQuery code can end up looking like reg-ex code. It is easier to rewrite regular expressions than understand them.

Conclusion

JQuery is good. But remember your 'Pragmatic programmer' and 'Code Complete' lessons. Write simple code. Clever or tricky code is bad.


Saturday, February 16, 2008

Best. Fight. Scene. Ever.

Few of my brain cells died watching this fight scene. I am looking for this movie on ebay. Enjoy!





Tuesday, January 22, 2008

Shorting China Market

I couldn't write my blog for last few weeks. We were in the middle of a product release. We alpha released first in our next generation of products.

And as always, during day I was scribbling on my white board and coding.
And during nights, I was dreaming about how I am gonna write code the next day.
Finally it's back to reasonable schedule now. ....After 10 years of doing the same thing, somehow it is still exciting.

This year has been very bad for stock market globally. Some are calling for global slowdown of the economy lead by USA.
China stock market has gone up more than 100% during last one year, many say that it is due for a big crash now.



This is a bad time for investing in the growth of the market. But how about investing in the crash of a market? People call it short selling or shorting a stock. This is against traditional wisdom, but might pay off big time.

There is an ETF which shorts the chinese market. It's called FXP (Proshares ULTRASHORT FTSE/XINHUA CHINA 25).

The FXP approximately moves two times against the ETF FXI (iShares FTSE/Xinhua China 25 Index).
  • When FXI goes up 100 points, FXP goes down 200 points.
  • When FXI goes down 100 points, FXP goes up 200 points.



This weekend I will spend some time to research FXP.

Sunday, January 20, 2008

What is Inflation?

I was talking to J about inflation yesterday. And today I found this very informative google video about inflation. If like me, you are trying to learn economics, this is a must see video.

If you can't see the embeded video, click this link : http://video.google.com/videoplay?docid=-7760821786905609611&q=inflation&total=3116&start=0&num=10&so=0&type=search&plindex=0