Wednesday, November 27, 2013

Play fantasy football: In progress

 Happy Waiver Wednesday!

While a common Thanksgiving tradition is to have football on in the background while prepping for the massive feast, my family didn't partake in such traditions. In fact, excluding the occasional Super Bowl (for social purposes only) I had never watched a full football game until this season. A few months ago, on a whim, I agreed to participate in a fantasy football league. I figured I would learn a bit here and there (my first goal was to learn what wide receivers and running backs are), casually set my line-up once a week on Sunday mornings, catch a game every once in a while... real chillax stuff. It would take, what, an hour a week? But then... numbers.

Some background for the folks who are unfamiliar with fantasy football... 

Before the beginning of the football season, you get together with some friends and create a fantasy football league. A draft takes place, in which everyone takes turns picking football players for his/her fantasy football team. Each week, your team is pitted against the team of another friend in the league in a head-to-head match-up. You score points based on how well the individuals on your team performed in their real games. For example, you get a fraction of points for every yard that your player ran, and you get points for every touchdown he scores. You compare the total points of each team to determine the winner of that week's match-up. Eventually, you build up a record of wins and losses (as well as a gaggle of arch enemies) and establish a rank in your league. Towards the end of the regular NFL season, the highest-ranked teams face each other in the single elimination playoffs. The last team remaining is crowned the winner and gets to prance around in a field full of rainbows and unicorns.

So... back to numbers... 

Football is full of stats, and I found myself perusing weekly projections and "expert" rankings and weather reports and injury reports and depth charts and red zone targets and on and on and on... Naturally, I started looking for my own questions that could be answered within football stats.

Here is what I wanted to explore: How often do league-specific settings change the outcome of a head-to-head match-up, in comparison to standard settings?

More background for the folks who are unfamiliar with fantasy football... 

There are standard, default point settings for every fantasy football provider (e.g. Yahoo, ESPN, NFL, CBS), but each individual league can adjust its own point settings. For example, in standard scoring, a quarterback would be credited 4 points for every touchdown he throws. In our league, however, our league commissioner set it so that the quarterback would receive 6 points instead.

In a more extreme example, our league awards 5 bonus points for each of 40+ yard completions, 40+ yard passing touchdowns, 40+ yard rushing attempts, 40+ yard rushing touchdowns, 40+ yard receptions, and 40+ yard reception touchdowns. This means that if Aaron Rodgers throws to Jordy Nelson for a 50- yard touchdown, Jordy will get points for his yards (50*0.1),
plus 6 points for getting the touchdown,
plus 5 points for the 40+ yard reception,
plus 5 points for the 40+ yard receiving touchdown, or a total of 21 points.

Considering that nearly all of the top 20 wide receivers average between 10 and 20 points per week (and the next top 40 wide receivers average 8 to 10 points), the bonus points can cause huge fluctuations in scoring. How often would scoring adjustments affect the outcome of a match-up? Would these changes in head-to-head outcomes affect who gets a playoff berth?

Let's find out!

Coming from academia, this paragraph is the obligatory Methods section. I downloaded 12 weeks worth of league rosters and player statistics from Yahoo fantasy sports using the Yahoo query language (thanks for the tip, LN!). I parsed the XML data and did all subsequent data munging in Python. Finally, I imported the data into Tableau Public.

After some finagling (which, I believe, is the technical term for what I did), I ended up with this visualization of all our league's games thus far. Also, here are our league settings compared to standard settings. Differences are highlighted in blue.

Out of 60 games analyzed, there were 4 instances in which using standard scoring would have changed the outcome of a match-up. Team #8 (TR) seemed to be most affected by this, so in the visualization, I set the default view to her team. Note that league scoring is always in blue, and standard scoring is always in orange. In weeks 10 and 11, the dark blue bar (Team #8's score) is lower than the light blue bar (her opponent's score) whereas the dark orange bar is higher than the light orange bar. This means that she lost her league match-ups even though she would have won those match-ups had we used standard scoring.

Team #8 had 2 games (weeks 10 and 11) that were affected by our league-specific scoring system.
2 of her recorded losses would have been counted as wins had we been using standard scoring.

A breakdown of team rosters for week 11 in the lower half of the visualization window gives a better idea of what happened:

  • For Team #8 (TR): LeSean McCoy, Harry Douglas, and the formidable Cincinnati defense profited from our league settings. However, her quarterbacks, Christian Ponder and Eli Manning, were heavily docked for their sacks, fumbles, and interceptions.
  • For Team #5 (OF): While the quarterbacks, Big Ben and RG3, also struggled with sacks, fumbles, and interceptions, they combined for 7 40+ yard bonuses, which converted into 35 additional points.
On Team #8, Christian Ponder and Eli Manning were continually penalized for their multiple sacks, fumbles, and interceptions.
On Team #5, despite also having sacks, fumbles, and interceptions, Ben Roethlisberger and Robert Griffin III heavily benefited from the 40+ yard bonuses.

It seems as though sacks and the 40+ yard bonuses make the most difference in the outcome of the head-to-head match-ups. I thought that the defensive teams' "Tackle for Loss" statistics would make more of a difference because they greatly increase a defensive team's total points. However, it seems to affect all defenses in the same way, so it's pretty much a wash. On the other hand, certain quarterbacks are more prone to being sacked, while elite quarterbacks throw 40+ yard passes at least every other week.

Ultimately, does it make a difference? 

There have been 60 match-ups in our league so far, with 4 changes in outcome. Here is how it would affect our standings:

Our league happens to only send the top 4 teams to the playoffs at the end of the season, so as it stands, the same teams would be in the playoffs. However, given that we still have 3 regular season match-ups left (in our particular league), and that other leagues might send the top 8 teams to the playoffs, the scoring settings can indeed change the course of a team and its chances of an appearance in the playoffs. It might be worthwhile to deviate from standard rankings, and target players that are more likely to benefit from league-specific bonuses and devalue players that are more prone to league-specific penalties. Just some food for thought.

Speaking of food... I might just end up participating in the football-on-Thanksgiving tradition this year for the first time. Happy Thanksgiving everybody!

P.S. I'm team #3 if you want to do some fantasy football roster stalking and evaluate my waiver wire pick-ups or make recommendations (unless it's to suggest that I drop Roddy White, which I finally did this morning after much deliberation).

P.P.S. Special thanks to JM and SS for watching games with me and fielding all my newbie football questions.

P.P.P.S. To Aaron Rodgers: Please be healthy soon, OK?



Our regular, 15-week-long season ended this past weekend so playoff berths are locked in! While Teams #9 (CL) and #3 (me!) had already clinched 2 of the 4 playoff spots, it came down to the last exciting week of match-ups to determine the last 2 teams for the 3rd and 4th spots. Ultimately, Team #6 (JS) held on to 3rd seed, and Team #4 (BK) secured 4th seed.
We go back to the original question of this post, which is whether league scoring settings altered the destiny of any teams, and it turns out that it makes an incredible difference:

Notice the 4 teams with the same 8-7 record hovering around the playoffs cut-off! A win or a loss for any of those teams would have changed the outcome of the standings. Both Teams #6 (JS) and #4 (BK) would have dropped a full 3 spots and out of the league championship running had we been using standard scoring.

What I believe to be the clutch match-up was week 13, when Team #4 (BK) edged out Team #2 (CB--the same CB from my mittens post!), as seen in the blue bars on the left. However, had our league used standard scoring, Team #4 would have lost. Once again, the discrepancies came down to quarterback woots and woes, as seen on the right side of the figure.
The result is that the dream was kept alive for Team #4 (BK), while Team #2 (CB) struggled and eventually had to settle for 6th place.
In any case, I'm heading into the league playoffs, where anything can happen. Keeping my fingers crossed for an epic Aaron Rodgers return!

Tuesday, May 7, 2013

Win a Lifehacker MacGyver Challenge: Boom. Done!

Well, my work here is done.

I submitted a project from an earlier post to Lifehacker's MacGyver Challenge: Hack Something With LEDs. Lo and behold...
I won!

As a longtime Lifehacker reader (as evidenced by half of my sporadic blog posts) and a lifetime MacGyver fan (as evidenced by continual wearing of this t-shirt despite my attempts to purge my closet of t-shirts), winning a Lifehacker MacGyver Challenge is an incredibly high honor in my book and will probably be the apex of my hacking career.
And probably the apex of my blog traffic
Thanks Lifehacker!

Thursday, July 12, 2012

Read a book: Done! (Part 1 of 2)

During college and almost all of grad school (a total of more than 10 years), I finished exactly two books: Freakonomics and Walter Cronkite's autobiography. (And then he died a week later at the age of 92.) 
It's not that I'm anti-reading... I generally read magazines cover-to-cover (including letters to the editor and the yearly sidebar that tells you the magazine's readership), and I keep up with a lot of blogs. There were a few books I started reading, but never finished, including Stephen Fry's autobiography. Based on my most previous experience with completing an autobiography, maybe it's a good thing for Stephen Fry's health that I never finished his book. For some reason, I used to find it hard to commit to reading a full-length book. Even if I did try to read, I felt that only non-fiction, where I might learn facts that are potentially useful for trivia night, was worthy of my time.

I kept up this avoidance of books all throughout grad school, until the very end. My lease was up, and I only needed two more months to finish my thesis, so instead of renewing my lease for another year, JM kindly let me crash at her apartment. It's important to note that aside from being a biology major in college, JM was also an English major, so she had hundreds of books along her shelves.
As everyone knows, when you have to do something that you don't want to do, you'll find anything else to do to procrastinate. (For example: The internet is an excellent vehicle for procrastination, but unfortunately, JM didn't have internet at her apartment. And her TV has no channels. And her apartment was clean enough. And her cat sleeps all day. I spent one afternoon arranging the plastic containers in her cupboard to make sure they all had matching lids. (But you can really only do that once.) I spent another afternoon organizing her receipts, bills, and letters from her grandfather. (And once they're in their separate boxes, you just keep following that system.) But I digress....

At one point, I was so bored of working that I picked up a short fictional book ("Eat When You Feel Sad") that one of JM's friends had lent her, and starting reading. The story and the style of writing was so strange that I kept reading just to get to the ending. I didn't like the book, but I finished it. When JM got home from lab, she was obviously disappointed that I didn't make progress with my writing, but at the same time a bit incredulous that I voluntarily finished an entire book.
From that day on, I would pull books from JM's shelf that seemed interesting:
You might notice that these are all non-fiction books. Shortly after finishing my thesis (which I did eventually finish despite discovering this new time-consuming hobby), I decided to give fiction a try and chose to start with the Harry Potter series. Enough of my friends were fans (Pottheads?) of the books and the movies, and they all seemed to be in the loop about Muggles, and the rules of Quidditch, and who killed Dumbledore. (Incidentally, I was of no help to my trivia team when we encountered a round based solely on Harry Potter.) My understanding of the stories was something like this.  My friend MU had all the books, so as I finished one book, he would supply the next. 
Before finishing off Harry Potter, I took a short hiatus to read the Hunger Games trilogy, provided by CB. I realized that this was the first time I read a book before the movie came out. (But I still cried like a baby when that girl died in the movie.)

About two months ago, I bought myself a Kindle, on which I've read five books:
So in the span of less than a year, I've essentially converted from a non-reader to a legitimate Kindle toter. For all the readers and especially non-readers out there, ES shared this wonderful reading-related song with me several years ago. The language is NSFW, but it contains a lot of important life lessons. R-E-A-D a B-O-Ohhhkayyy!

Read a book: Done! (Part 2 of 2)

The early Harry Potter books were only a couple hundred pages each, so I was able to stick them in my bag and read them while I waited for the shuttle. However, the later books were insanely thick, and I could no longer easily transport them. Eventually, I decided to get a Kindle.
Obviously, every Kindle needs its own case. I visited the Salvation Army and bought two books that might be able to fit the Kindle inside. Eric Carle's "My Very First Book of Words" would be the ironic option, and the Harry Potter book would have significance in that it got me into reading fiction. 

Based on my experience in cutting secret compartments into books (this would be my third), I ultimately decided on the Eric Carle book because it was a board book and would hold its structure more easily. I was in a bit of a rush at the time, so I used clear tape to temporarily hold it all together. I have since replaced all the visible tape with double-sided tape (which everyone should have... it's magical!). I also stuck magnets on each side of the case (right below the surface pages) to keep the book from drifting open.

Because the Kindle uses E-ink instead of an LCD screen, it minimizes glare, but is useless in the dark. I wanted to see if I could make a simple gadget to supply a light source. After a bit of finagling with basic supplies I had lying around, I came up with a design that uses a small binder clip, a medium binder clip, 2 LEDs, 1 cell battery, and a small strip of paper. The medium binder clip is used to attach the contraption to the custom Kindle case.

Surprisingly, binder clips conduct electricity decently well. I used one of the arms of the binder clip to be the on/off switch. In the first picture below, the arm pointing off to the left side of the picture leaves the circuit open, so the LEDs stay off. In the picture on the right, I have flipped the arm so that it rests on the battery, thus completing the circuit and turning the LEDs on.

Here is what it looks like in the dark.

Some people have asked what the point of all this is. Yes, I know there are all sorts of cases and lights made for the Kindle, but by ThaiBinh standards, that would just be too easy. There wouldn't be anything to blog about and share with all 1 of my followers.

Wednesday, March 28, 2012

Donate (a full bag of) blood: Done!

Over the past 10 years, I have tried to donate blood 3 times, but failed each time.

  • In high school, I never got past the initial eligibility questionnaire.
  • In college, I got to the point where I had a needle in my arm and the blood was flowing into the bag... until it was about a third full. The person collecting my blood noticed that my blood flow was slowing down. They have a tool that looks like a dull pair of scissors that they clamp and glide over the tubing to clear away blood inside the tubing to determine how fast the blood is flowing. After a swift glide with those "scissors", it was apparent that my blood was moving at 0 mph. A supervisor was called over. Then a number of other phlebotomists took turns nudging and wiggling the needle in my arm, to no avail. So that was failure #2.  
  • In grad school, there was a Yale vs. Harvard blood drive, and I was determined to do better. I drank loads of water for days in advance. (I will spare you details of how awesomely clear my bodily fluids were.) I was excited and pumped up. My friend PS came to donate too. I was thinking, "Ima forreal donate blood this time, and we're going to beat Harvard in this competition!"
    This time, I got to the point where they stuck a needle was in my arm.
    And that was as far as I got. Again, a supervisor was called over. Then a number of other phlebotomists took turns nudging and wiggling the needle in my arm, to no avail. No blood ever even passed through the needle. The dull scissor thingy was never necessary, because the tubing was as clear and see-through as my bodily fluids. I felt really bad that I wasted an entire blood bag kit. So that was failure #3.
    But that's not the end of that story... A couple weeks later, I got an email:

    Hi Thaibinh,
    Thanks for donating blood at the Harvard-Yale Challenge! Just wanted to let you know that you've won an iPod shuffle!

    Apparently by signing up to donate blood, I was entered into a contest for an iPod shuffle. My friend PS (who had legitimately donated a full pint of blood) was not amused.

At this point, I had pretty much given up on ever donating blood and saving lives. However, an opportunity came up a few weeks ago when ES (a regular donor) was about to call the Red Cross to make an appointment for his bi-monthly donation. I happened to be there and decided on a whim to give it one last try.
In preparation, I again drank bottles and bottles of water like a boss. The eligibility questionnaire went without a hitch, and soon my arm was being cleaned with an iodine swab. A slight pinch later, my blood was flowing into a bag. I checked with my phlebotomist every couple minutes to make sure blood was still flowing, because I was still skeptical about my ability to fill an entire bag. In the meantime, ES had finished donating his pint and took a picture of me in action:
Thumbs up everybody!

Eventually, I passed the threshold and became an official (full bag of) blood donor!!

Afterwards, while eating snacks and drinking apple juice, ES and I had a conversation with one of the organizers of the blood drive. I was really surprised to learn that our blood would most likely be used within 3-4 days; I had donated late afternoon on a Monday, and by Tuesday morning, my blood would already be tested, and registered in the blood bank. By Thursday or Friday, it would be used up. I guess I should take this opportunity to encourage everybody (who is able) to donate blood. You can't possibly fail more times than I did.
When I returned home later that day, I found out that despite all my failed attempts at donating blood, I have an online account with the American Red Cross. Although I have supposedly donated 3 times (not counting my most recent success), I still don't know my blood type:

I've been told to expect my donor card in the mail in the next several weeks, and I'm excited to finally find out what blood type I am! I'll update this once I find out!

[Edit:] I'm O+!

Wednesday, February 15, 2012

Make mittens: Done!

I had a nice red sweater, but there was a hole on the side that kept growing every time I wore it, and unless I decided to follow a drastic calorie-reducing diet, there was no realistic way I would ever fit into this sweater again. Luckily, I found this article online, and making mittens seemed like a perfect project for a sweater I didn't want to throw out.
The video tutorial suggested using fleece as the inner lining, but around the same time that I started planning this project, my flannel pajama pants ripped. Naturally, I decided to substitute my torn PJ pants for the fleece to line my mittens. (People have asked whether I grew up during the Depression, considering the amount of scrap materials I am so hesitant to throw out.)

The "before" picture.

The first step was to cut out the pattern. I realized that I didn't have any pins to hold the pattern in place. But... within arms reach, I had some LEDs from another project that I'm working on.

Then I realized that it's even easier to just use double-sided tape to hold the pattern in place:

Here are the all the pieces that I cut out:

I had just enough sweater material to make two sets of mittens. Here are the leftover scraps...

I had just enough left over to make Juju's superhero outfit...
Serious business-cat by day...
... Super J by night!

GZC kindly lent me her sewing machine, and after careful reading of the manual with JM, I was on my way to sewing like a pro! Keep in mind that I had never used a sewing machine before, and had no concept of a bobbin or a presser foot. The instruction manual proved to be effective even for complete beginners.
I didn't even pose for this picture... This was the level of intensity the entire time.

Going around curves was my main source of frustration, but after some helpful tips from CB, I was able to sew each mitten layer with increasing agility and confidence.

A mitten begins to take shape!

Before sewing the cuffs on (which would permanently finalize my mittens), I took them out for a "test drive". It turns out that flannel is miserable as a mitten liner; the material did nothing against the wind that day, and its thinness left a lot of empty space inside the red shell. I ultimately decided to buy some fleece to replace the flannel.
Here, you can see the outer shell, the gray fleece, and the cuff. After sewing the three layers together, I would flip the cuff to the outside.

Tada! The finished product!

I had a lot of gray fleece left over, so I made some formal attire for Super J:

Thanks again to GZC, JM, and CB for all their help!!

Sunday, November 13, 2011

Be a wet lab scientist: Done!

People usually imagine a science lab to be full of bubbling flasks, petri dishes of bacteria, and lots of expensive, heavy machinery. My degree is in the sciences, but my lab looks like an ordinary office, complete with cubicles and personal computers. To differentiate, we call  the flask/petri dish/centrifuge lab a "wet lab", while my lab is a "dry lab".
I have a lot of wet lab friends, and would occasionally visit them in their natural settings. Last week, I decided to put on a pair of latex gloves and try my hand at some wet lab work. JM was my mentor/boss for the day.
Here I am with a pipette (also called a pipet, pipettor, pipetman, or chemical dropper according to wiki). Once you learn how to use a pipette, you are officially initiated to the wet lab club.

I found out that a lot of wet lab work is labeling lots and lots of samples. Here I am labeling Eppendorf tubes (1.5 mL plastic test tubes):

When I was young, I had numerous science kits, two of which included a monocular (one eyepiece) microscope. However, I never got to use a binocular microscope until I took a cancer course during my second year of grad school. That course included one lab session, in which my computational biology friends and I were so lost. Each group was given a diseased organ on a tray, and our task was to find the tumor.
I had no idea what a tumor looked like in real life. No one in my group did. Our group was assigned a heart. When the prof came over to check in on our progress, we pointed to what we thought might be a tumor. Apparently our conception of a tumor was actually just fat.
The conversation with the professor continued kind of like this:
Dr.: Where is the aorta?
Us: ... umm... ?? The term sounds familiar...
Dr.: Where is the left side of the heart?
Us: ... umm... ?? Both sides look the same...
Dr.: Which side is thicker and more muscular?
Us: ... umm... That side?
Dr.: No.
Us: Ah yes, ok. This side.
Dr.: So if this side is more muscular, what does that mean?
Us: ... ??? ...
He must have been wondering how these idiots were able to sneak into this class.

Going back to the binocular microscope... If you don't ever use them, then you think they're easy to use: just put one eye over each eyepiece. If you use them all the time, then you think they're easy to use: just put one eye over each eyepiece.
In actuality, using these microscopes is akin to riding a bike: If you already know how to ride a bike, you forget what it was like when your training wheels were removed and you wobbled around your driveway. If you're trying to get used to using a binocular microscope, it takes (for me, anyway) a lot of adjusting. I don't quite know how the optics work, but somehow I ended up seeing my eyelashes flash across my line of vision whenever I blinked. Or I would see cells in one eye, but not the other. Then vice versa.
I now know my pupillary distance is 57.

Once you get the hang of it, you see incredible images. It's amazing to think about what you're seeing. I was like, "Wow... science... is sooo cool!"
JM gave me some interesting samples to look at and compare. I was able to take pictures of what I saw by putting my camera lens over one of the eyepieces. On the left, you see normal cells. On the right are the same line of cells, but because they are sensitive to a particular drug, they look dead/dying/shriveled up after being exposed to that drug. (You can click on them to enlarge the pictures.)

Sooo cool, right?!?
It was a pretty eventful day in lab for me: Pipetting, labeling, and microscoping.

Writing this post reminded me of a Research-in-progress (RIP) talk I gave in 2008. Although I was in the computational biology program, my lab advisor is in the pathology department, so my RIP talk was in front of predominantly wet lab biologists. To close my talk (and this post), I pointed out some differences between the wet lab and the dry lab.