Tuesday 29 May 2012

Coding Week 1: Roller Coaster Ride,C++

Fun-filled and exciting Ride with c++

A roller coaster is a popular amusement ride  that turn the rider briefly upside down. Roller coaster are not self-powered rather run on mechanism of conservation of energy. Potential Energy by height is converted to Kinetic Energy and vice verse for the roller coaster ride.

Similar was my experience with the first week of coding thrilling. I was inclined toward choosing title as roller coaster ride. While coding there were areas where i had experience in coding and was working fairly easily and fast those area were enriching me with more of a kinetic energy to tackle grey area of difficulty and inexperience and obviously solving difficult one gave me potential energy to work even faster with easy coding areas.This shift of Potential and Kinetic energy is giving me experience of roller coaster ride.

What more fun one can ask for summers ??

Okay i must not forgot blog is primarily meant to share what i did with people interested in my work with less emphasis on how i felt.So here how i spent first coding week

This week i extending the prototype of UnigramLMWeight class build as a patch for GSOC Selection. four type of Smoothing was implemented with ability to api user to select the type of smoothing he wants. A
Brief  discussion on Smoothing techniques to be implemented took place and finally decision on implementing four smoothing scheme Dirichlet prior smoothing,Absolute Discount Smoothing,Jelinek Mercer Smoothing,Two Stage smoothing.

So Main task of week was to include smoothing in UnigramLMWeight Class and update prototype with technique discussed to handle negative value from log,Bounds for optimization,Ability to user to select type of smoothing used.

First i started with handling negative value of log,bounds for optimization which was pretty easy based on discussion on IRC and Mailing List.

Then another major task was to parameterize the constructor to provide user ability to select smoothing and parameter  to clamp negative value of log.Adding constructor is a fairly simple task and shouldn't have taken long for me to make them working.

But after implementing when i was looking at the constructor and trouble shooting them i found always default constructor is called what ever parameters i give.SO i tried around fiddling with parameter and with experience tried to make changes to parameter etc.But no luck always default was the final call and was stuck on the issue.Then i posted the question on Stackoverflow and discussion there came to know that when i make object of weight class and put it in set_weighting_method then weight object is clone and it calls the default constructor at last.

Then major hurdle i felt was about an  adding extra per document statistics in xapian architecture number of unique term in the document to be accessed in the Weight class. Initially i got confused in Rset and Mset and with discussion i tried getting this statistic in weightinternal class and we get document id there for Rset.But i needed it for Mset so whole implementation was wasted and had to reset to last commit and add the nouniqterm for document in database and make a new constructor for function get_sumpart for Weight class with extra per-document statistics.

Then Switching to Brass backend created some hurdles and i thought i would be something to disable chert while configuration and since chert is default Backend it created problems in disabling Chert . But believe what you just need to change namespace of open function to Brass:: while calling constructor for database and it will automatically start using Brass backend.

So this week working around some of these problem due to under-experienced in programming gave me fun-filled joy rides.

Hope i will catch up speed and cover-up lagging parts till end of next week.


2 comments:

  1. Nicely sums the work done and the issues you faced .Good going ! Share your repo link so I can watch :P.

    ReplyDelete
    Replies
    1. Visit my Project page at Xapian Wiki.Will keep updating my project details there as it progress.

      http://trac.xapian.org/wiki/GSoC2012/Bi-gram%20Language%20Modeling

      Delete