Archive for March, 2008

This won’t turn into an annoying journal. I will probably regret posting this even. But I’ve grown annoyed with my inefficiency and clutter. I thought maybe if I typed out my plans I’d be more likely to follow them, and if I posted them it would cause people (like Kevin) to claim I won’t follow them. Giving me motivation to prove them wrong!

  1. Become an early riser: Yes, some probably think I am an early riser already; however, I am not satisfied. Many days of the week I am up at 6am but there are too many days I sleep in till 7am or even 8am! I also think 6am is too late now. I plan to start with a more consistent schedule of 6am and then improve from there. This was easier when I could use the paper, which would show up at 6, as a “reward” of early rising. I’d be able to relax with a cup of coffee and read through it before having to start on work, impossible if I wasn’t up early enough. With the paper coming even less often than it did before, I had to cancel it because of how rare it showed up, I’ve started slipping more. So, I need to develop new “rewards” for the morning. Maybe actually walking to get the paper in the morning, helping with number 7 as well.
  2. Read less useful and useless news: Working from my computer all day means I switch over to Firefox and start clicking through news sites too often. I must get on a schedule of reading morning news and reading evening news, nothing in between.
  3. Remove clutter: Not only is clutter distracting, useless and at times a time suck, it also pisses me off (yes, its far worse than just anger or annoyance). Some times I just want to toss everything I own out the window… I’ve done well to restrict my workspace down to a few things (keyboard, mouse, monitor, speakers and coffee warmer; goodbye stapler and pen holder) but the rest of the apartment needs the same attention. Which means getting rid of clothes I won’t wear, books I’ll never reread, games I barely play, DVDs I don’t watch, papers I won’t reread, take out menus I’ll never use, etc, etc! Its crazy how much builds up. I think I do a decent job of not purchasing useless junk, DVDs, games, clothes and snacks (I try to keep food down to only “necessities”), but when I do get those things, one way or another, they never go away. That will be stopped. Additionally, I’ve unsubscribed from most mailing lists in an attempt to declutter my Inbox.
  4. Furniture: I have a fairly minimal setup, just a mattress for a bed, no chest of drawers and a table instead of a desk. But not good enough! Maybe I’ll get rid of the table and chairs in the living room I’ve been left with or the computer chair that won’t be used anymore. I’ll figure something out. But if any of you Chicago GLUG people want either of those, let me know.
  5. Monotask: I’ve tried to convince myself that multitasking and using switching to a different task as almost like a break from the current one is a good way of getting things done. Now I plan to completely change that in an attempt to be more efficient and less stressed. My hope is that focusing on a single task allows for the best possible work on that task, instead of having my mind have to reload what I was working on when I switch back.
  6. Slow down: This will probably be my toughest, but be really good for stress and quality of work. I’d at least like to not start back on work while still finishing my last bite of a meal, working while eating or always cooking and eating in just a few minutes. Obviously these are dependent on how soon my current task is due.
  7. Exercise: Nothing extreme here. Its not about getting strong or even my health. Exercise is suppose to help with early rising and reducing stress. Like the rest of the tasks, I’ll start this off slowly.
  8. Schedule: I already have useless schedules. Maybe they aren’t schedules, but ask someone who’s lived with me what happens if I have to do my morning tasks (or any really) out of order :). Now I will start adding useful tasks to my morning schedule, as well as my daily work schedule, in hopes of not procrastinating or flat our skipping them. Additionally, having a pseudo night schedule, getting everything cleaned up and washed before bed and such, so that when I wake up I won’t dread what awaits me.

Read Full Post »

I wanted to finally really learn OCaml and couldn’t think of a project to start. So, I’ve begun implementing the code in Programming Collective Intelligence, originally in Python, in OCaml. I’ll save my initial complaints about OCaml till later, since they may go away once I become more accustomed to it, but there are definitely things I miss from Erlang and Haskell.

Below is the first code for making recommendations, Chapter 2. Its very simple but will be built off of in my next posts.

let sim_distance critics critic_1 critic_2 =
  let movies_1 = Hashtbl.find critics critic_1 in
    let movies_2 = Hashtbl.find critics critic_2 in
      let add_squares movie rank_1 sum =
        if Hashtbl.mem movies_2 movie then
          let rank_2 = Hashtbl.find movies_2 movie in
            sum +. ((rank_1 -. rank_2) ** 2.)
      in (1. /. (1. +. Hashtbl.fold add_squares movies_1 0.)) ;;

let create_hash list =
  let hash = Hashtbl.create 1 in
    let rec create_hash_rec list = match list with
        []               -> hash
      | (key, value)::xs -> Hashtbl.add hash key value ; create_hash_rec xs
    in create_hash_rec list;;

let test =
  let critics =
    create_hash [("Lisa Rose", (create_hash [("Lady in the Water", 2.5) ;
                                             ("Snakes on a Plane", 3.5)])) ;
                 ("Gene Seymour", (create_hash [("Lady in the Water", 3.0)]))]
  in sim_distance critics "Lisa Rose" "Gene Seymour" ;;

This code creates a hash with keys being the name of a movie critic and the value is another Hash containing names of movies and the score the critic gave the movie. The sim_distance function finds the similarity between two reviewers, when the test is run it return 0.8 for the similarity between Lisa and Gene. I’ll go into how similarities work later.

My main problem with the code is its not purely functional. I originally implemented it with lists but wanted the running time to be the same as the Python code, requiring a hash for O(1) lookups and, sadly, destructive data structures. Luckily, this gives me a reason to play around more with Purely Functional Data Structures. Meaning, I’ll probably get caught up implementing data structures for this very basic first part of Collective Intelligence…

As I said, I don’t know OCaml, so this is probably not the best code but it works. Suggestions would be great.

Read Full Post »