Today's christmas. VLC icon on my taskbar is wearing a Santa hat! Is this regular, or are they doing it with only this version?
Search This Blog
Friday, December 25, 2009
Thursday, December 24, 2009
Things I miss at home
It's been around 5 days since I've been at home, and I have already begun to miss a few things
- I can no longer download 90MB in 40s
- DC++, it's been such a long time since I stress tested the media player
- Gym, I feel ssssssooooooooo lazy
- Damn these regular powercuts, I had forgotten all about them
- Hostel food
- The noise free ambience of IITB
- Borrol and Kashyap's "discussions" over food
Wednesday, December 9, 2009
Tuesday, December 8, 2009
Panther again!
Got this in mail today. I really don't want my parents to read this!
C I R C U L A R
Sub : Sighting of Panther in the campus
Residents of the campus may recall previous circulars issued on the subject cited above. Panthers were seen at various places in the campus during the last few days. All out efforts are being made to ensure that the panther is trapped/chased away from the campus by the Forest Authorities. Special patrols are being deployed everyday to patrol the most vulnerable areas where the panther is being sighted frequently in jeep and motorcycles equipped with high power search lights and fire crackers.
Campus residents are requested to inform any suspicion about presence of leopard on the telephone numbers given below:
Main Building Security Control
Intercom no.: ****, **** & ****
For the purpose of precautionary measures, the campus residents are requested to observe the following:-
1)Not to provoke the animal by stone throwing or attempting to hit it with anything.
2)Not to take photograph, nor should the animal be followed or make provocative gestures.
3)If the cubs are sighted, do not indulge in any provocation whatsoever, as the panther accompanying the cubs can be highly dangerous.
4)Not to allow small children unaccompanied by adults to move around during night.
5)Not to sleep outside and, doors and windows should be secured.
6)Lonely and dark stretches of roads should not be used during night.
7)When dogs bark or run frantically at night, it may be taken as warning of panther’s presence nearby.
8)Panther is afraid of lights and cracker bursts. Hence, it is advisable to carry a torch and flick it around while moving at night.
9)In case of a pet dog, it should be kept indoors at night.
The Institute has approached the authorities concerned to remove/scare away the panthers. This section will be bursting crackers during nights. Hence do not panic on hearing sounds of crackers.
C I R C U L A R
Sub : Sighting of Panther in the campus
Residents of the campus may recall previous circulars issued on the subject cited above. Panthers were seen at various places in the campus during the last few days. All out efforts are being made to ensure that the panther is trapped/chased away from the campus by the Forest Authorities. Special patrols are being deployed everyday to patrol the most vulnerable areas where the panther is being sighted frequently in jeep and motorcycles equipped with high power search lights and fire crackers.
Campus residents are requested to inform any suspicion about presence of leopard on the telephone numbers given below:
Main Building Security Control
Intercom no.: ****, **** & ****
For the purpose of precautionary measures, the campus residents are requested to observe the following:-
1)Not to provoke the animal by stone throwing or attempting to hit it with anything.
2)Not to take photograph, nor should the animal be followed or make provocative gestures.
3)If the cubs are sighted, do not indulge in any provocation whatsoever, as the panther accompanying the cubs can be highly dangerous.
4)Not to allow small children unaccompanied by adults to move around during night.
5)Not to sleep outside and, doors and windows should be secured.
6)Lonely and dark stretches of roads should not be used during night.
7)When dogs bark or run frantically at night, it may be taken as warning of panther’s presence nearby.
8)Panther is afraid of lights and cracker bursts. Hence, it is advisable to carry a torch and flick it around while moving at night.
9)In case of a pet dog, it should be kept indoors at night.
The Institute has approached the authorities concerned to remove/scare away the panthers. This section will be bursting crackers during nights. Hence do not panic on hearing sounds of crackers.
Sunday, December 6, 2009
Saturday, December 5, 2009
Placements, and a BIG thank you!
The last 3 days were really busy, with little time for food, bath or sleep. I'm writing this post to thank a few people who helped me so much during these 3 days.
Devshree, Prajakta, Ajinkya, Borrol, Adil, Ambika, Ashish, Chander, Somil - thank you sssooooooo much for everything you guys did.
Saurabh, Prashima, Kulk - You guys gave me an "I'm not alone" feeling, which was so reassuring. Thank you.
DPNs Sree and Rakesh - Thank you for everything.
On a lighter note, below is a pic of the goodies I got. Not getting placed early has some advantages :)
Devshree, Prajakta, Ajinkya, Borrol, Adil, Ambika, Ashish, Chander, Somil - thank you sssooooooo much for everything you guys did.
Saurabh, Prashima, Kulk - You guys gave me an "I'm not alone" feeling, which was so reassuring. Thank you.
DPNs Sree and Rakesh - Thank you for everything.
On a lighter note, below is a pic of the goodies I got. Not getting placed early has some advantages :)
Thursday, November 19, 2009
Comments!
Recently, I have been getting comments like these...
Great blog as for me. It would be great to read something more about that theme.
By the way check the design I've made myself Young escort
Order In Brossard (Quebec) [url=http://www.wikipatterns.com/display/~wertinskoi] generic viagra kamagra caverta pillshoprxcom[/url] canada pharmacy chewable viagra.
So, I'm disabling anonymous comments. And of course, a heartfelt f**k you to the people who are responsible for the above comments.
By the way, you can read the details here and here.
Update:
I've allowed anonymous comments again :) But have enabled word verification to prevent automated spam
Great blog as for me. It would be great to read something more about that theme.
By the way check the design I've made myself Young escort
Order In Brossard (Quebec) [url=http://www.wikipatterns.com/display/~wertinskoi] generic viagra kamagra caverta pillshoprxcom[/url] canada pharmacy chewable viagra.
So, I'm disabling anonymous comments. And of course, a heartfelt f**k you to the people who are responsible for the above comments.
By the way, you can read the details here and here.
Update:
I've allowed anonymous comments again :) But have enabled word verification to prevent automated spam
Wednesday, November 18, 2009
Monday, November 16, 2009
How to mount NTFS partition in Linux
Well, these days, NTFS partitions do get auto-mounted. But it may get a little irritating when you are asked for the admin password every time you boot your comp and click on the partition.
So, to make the mounting "truly" automated, you have to add an entry to the file /etc/fstab.
In my case, I had to add
So, the first thing you have to do is - create a directory /media/cdrive. Then, to find out which device your ntfs partition is listed as, run
From what I can see, my NTFS partition is /dev/sda3. This is how my /etc/fstab looks after making the entry.
--------------------------------------------
Reboot. You'll find your partition mounted :)
So, to make the mounting "truly" automated, you have to add an entry to the file /etc/fstab.
In my case, I had to add
/dev/sda3 /media/cdrive ntfs-3g defaults
So, the first thing you have to do is - create a directory /media/cdrive. Then, to find out which device your ntfs partition is listed as, run
# fdisk -l Disk /dev/sda: 320.1 GB, 320072933376 bytes 255 heads, 63 sectors/track, 38913 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Disk identifier: 0x01238b30 Device Boot Start End Blocks Id System /dev/sda1 1 26 208813+ 83 Linux /dev/sda3 29447 38913 76043677+ 7 HPFS/NTFS /dev/sda4 27 22978 184361940 f W95 Ext'd (LBA) /dev/sda5 27 20914 167782828+ 83 Linux /dev/sda6 20915 22873 15735636 83 Linux /dev/sda7 22874 22978 843381 82 Linux swap / Solaris
From what I can see, my NTFS partition is /dev/sda3. This is how my /etc/fstab looks after making the entry.
# <file system> <mount point> <type> <options> <dump> <pass> proc /proc proc defaults 0 0 # / was on /dev/sda6 during installation UUID=295dd122-7bd3-49e3-8e94-e192bd48e741 / ext4 errors=remount-ro 0 1 # /boot was on /dev/sda1 during installation UUID=31640fe8-bd0a-409f-b09e-f340e31b87ce /boot ext4 defaults 0 2 # /home was on /dev/sda5 during installation UUID=88e313d9-2537-466d-9856-4ae03bf75f81 /home ext4 defaults 0 2 # /media/cdrive was on /dev/sda3 during installation UUID=286841F96841C672 /media/cdrive ntfs defaults,umask=007,gid=46 0 0 # swap was on /dev/sda7 during installation UUID=872f1854-af38-48ee-807d-b46ec1db6a75 none swap sw 0 0 /dev/scd0 /media/cdrom0 udf,iso9660 user,noauto,exec,utf8 0 0
/dev/sda3 /media/cdrive ntfs-3g defaults
Reboot. You'll find your partition mounted :)
Tuesday, October 20, 2009
Ants in my laptop - II
The extermination
I got suggestions ranging from "Put your laptop in a refrigerator" to "Put your laptop in the microwave" :). I chose to use the laxman rekha approach.
So, last night, I put my laptop on a cardboard box and encircled it using the killer chalk. The result is shown in Figure 2 ;)
I got suggestions ranging from "Put your laptop in a refrigerator" to "Put your laptop in the microwave" :). I chose to use the laxman rekha approach.
So, last night, I put my laptop on a cardboard box and encircled it using the killer chalk. The result is shown in Figure 2 ;)
Figure 1: The setup
Figure 2: Suicide (or mass murder?)
Monday, October 19, 2009
Ants in my laptop :(
There are heaps of tiny red ants crawling out of my keyboard and USB ports from time to time! I have eliminated around 40 today. I wonder how many are still inside! What do I do!!!
Friday, September 18, 2009
Scilab 5.1.1 on Linux
Well, if you have landed on this page, you must have got something like this when you ran Scilab 5.1.1 on linux
bin/scilab: line 132: 8184 Segmentation fault "$SCILABBIN" $*
The easiest way to get around this is to run it as
$ bin/scilab -nogui
You obviously will have to sacrifice the "improved" GUI features of Scilab 5.1.1. But it really shouldn't matter much as gedit/kwrite are perfectly fine as text editors. And I think the terminal version is much much easier to use than the GUI version.
Update:
- Well, no GUI is a problem when you want to plot graphs :( I haven't yet figured out a way to get around this.
- Ubuntu has a deb package to install scilab 5.1. Fedora users, bad luck.
Wednesday, September 2, 2009
Friday, August 28, 2009
A few people I admire most
Abhiram Natarajan - For his never ending repository of algorithms and swear words | |
Anup B Prakash - Simply awesome at everything he does | |
Chaya Ganesh - For being such a wonderful person | |
Rama B - For shamelessly lying about his academic abilities all the time | |
Netra Malagi - For being a geek, and an open source enthusiast right from the beginning | |
Prashant Borole - Coder++, writes his own kernels, file systems and what not. IMO, one of the best systems guys in the world | |
Sriram Kashyap - An extremely helpful Geek++ |
Sunday, August 23, 2009
A lecture series on Analysis and design of algorithms
A lecture series on Analysis and design of algorithms
Just happened to find it on youtube :) .The above set of videos is from the under grad algorithms course offered by Prof. Abhiram Ranade and Prof. Saisundararaman Vishwanathan at IIT Bombay. More subjects here
Just happened to find it on youtube :) .The above set of videos is from the under grad algorithms course offered by Prof. Abhiram Ranade and Prof. Saisundararaman Vishwanathan at IIT Bombay. More subjects here
Friday, August 14, 2009
Bought an Acer 5738 :)
Comes with Linux, 3GB DDR3 RAM, Core 2 Duo T6500 2.1GHz, 320GB hard disk, Gigabit ethernet card, fingerprint reader, an HDMI port (pretty useless unless you have a decent graphics card), multi touch touchpad (allows to zoom using a 2-finger motion), laptop bag, and the usual stuff. More here.
Price: Rs. 34,000
Saturday, August 8, 2009
About IIT profs and exams
In my last post, I said that I would post something about SVN clients. Since it's pretty boring, I'll do that some other time :)
Now, coming to the topic, there are different kinds of exams...the general idea is that nothing from the allowed material comes in the exams.
Another prof usually doesn't have a time limit on the exam. People come to the exam hall, think....think....think, write whatever they can figure out, and leave when they are too tired to think any more, or just get hungry. And there is a certain prof who said, "Leave the exam hall in <=2 Hours, get 3 bonus marks!"
There are some profs who give "unrelated questions" like "Do you think Obama will be a better president than Bush?", just so that students can take a break from thinking, and relax. These questions, of course, do not carry any marks.
Though weird, the good thing about all these exams is that it's "marks for thought", rather than "marks for how well you can mug or how much you can write".
Now, coming to the topic, there are different kinds of exams...the general idea is that nothing from the allowed material comes in the exams.
- Closed book: Nothing allowed. The easiest kind of exam.
- Open notes: The most common type of exam. We are allowed to take our notes, print outs of slides and a few research papers.
- Cheat sheet: 1 or 2 A4 size sheets are allowed. Contents must be handwritten. The number of sides that can be used is pre-specified.
- Open book: The toughest. You can take any book (any number of books) you want.
Another prof usually doesn't have a time limit on the exam. People come to the exam hall, think....think....think, write whatever they can figure out, and leave when they are too tired to think any more, or just get hungry. And there is a certain prof who said, "Leave the exam hall in <=2 Hours, get 3 bonus marks!"
There are some profs who give "unrelated questions" like "Do you think Obama will be a better president than Bush?", just so that students can take a break from thinking, and relax. These questions, of course, do not carry any marks.
Though weird, the good thing about all these exams is that it's "marks for thought", rather than "marks for how well you can mug or how much you can write".
Wednesday, July 15, 2009
How to set up SVN
I wanted to set up an SVN server for my project recently. Here is the small script that I wrote for configuring SVN. Just copy-paste it in a file and run it. It'll guide you through the configuration process.
-------------------------------------------
-------------------------------------------------
To start svnserver,
/users/proj/prashanth.kamle/svnrepos is the path of the directory in which the SVN repository would reside (/users/proj/prashanth.kamle is the current directory).
To stop the SVN server, just kill the process (or use the script below)
In my next post, I'll explain how to access SVN from eclipse. Till then, happy subversioning :)
-------------------------------------------
#!/usr/bin/bash svnadmin create svnrepos #creates a directory called svnrepos #in the current directory, and #creates the config files printf "[general]\nanon-access = none\nauth-access = write\npassword-db = passwd\n" > svnrepos/conf/svnserve.conf printf "[users]\n" > svnrepos/conf/passwd while [ 1 -gt 0 ] do printf "Username: " #create username,password for read user #whom access is required if [ $user == "q" ] #press "q" to stop accepting username, passwords then break fi printf "Password: " read pass printf "$user"" = ""$pass\n" >> svnrepos/conf/passwd done
-------------------------------------------------
To start svnserver,
svnserve -r /users/proj/prashanth.kamle/svnrepos -d
/users/proj/prashanth.kamle/svnrepos is the path of the directory in which the SVN repository would reside (/users/proj/prashanth.kamle is the current directory).
To stop the SVN server, just kill the process (or use the script below)
#!/bin/bash pid=`ps -A|grep svnserve| cut -d" " -f1` kill $pid
In my next post, I'll explain how to access SVN from eclipse. Till then, happy subversioning :)
Monday, June 29, 2009
Sunday, June 28, 2009
Rain ke side effects
Rains are a time when many things begin to happen. Here in IIT Bombay, they start clearing the drains, cementing the roads and tarring the roofs (yeah, you read it right :-P ). Most of the campus goes a nice shade of light green, and the moist soil smells so good. And the best of all, little creatures start appearing. Here is my collection :)
Most of the pics which follow were taken in this corridor which connects the four wings of my hostel
Thursday, June 18, 2009
Wednesday, June 17, 2009
Resizing images
Pictures accumulate. The treks, trips, parties and the infinite fun that we've had in the past one year of college has resulted in me filling up half my hard disk with photos. My dear friends have fancy cameras which produce 8 mega pixel images, each occupying almost 2.5MB of my precious hard disk space.
Since an 8 mega pix image is serious overkill, I decided to resize them all to 1600x1200 (2 mega pix, around 1MB). Now that I've turned all linuxy, I was looking for a 'Microsoft Office Picture Manager'-like application for linux when Sriram Kashyap suggested that it'd be way easier to write a shell script to do the job.
So friends, here it is :)
Since an 8 mega pix image is serious overkill, I decided to resize them all to 1600x1200 (2 mega pix, around 1MB). Now that I've turned all linuxy, I was looking for a 'Microsoft Office Picture Manager'-like application for linux when Sriram Kashyap suggested that it'd be way easier to write a shell script to do the job.
So friends, here it is :)
#!/bin/bashPass the folder containing your pics as an argument to the script, or just put the script in your folder and double-click :)
pics=`ls $1 | grep JPG`
for pic in $pics
do
echo "Converting $1$pic ..."
convert -size 1600x1200 $1$pic -resize 1600x1200 $1$pic
done
Wednesday, May 20, 2009
Renovated :)
I finally paid some attention to my long neglected home page. www.cse.iitb.ac.in/~pkamle
Sunday, May 3, 2009
Train, food and home
It was 6.30 in the evening when I was at the new Canara bank ATM in IIT Bombay, looking at a receipt which said "Unable to dispense cash. Transaction failed". I had exactly Rs. 260 in my wallet, and a 24hr journey ahead.
After a short auto ride to Kanjurmarg, and 20 minutes of waiting in the queue, I got a ticket to Dadar. The local train ensured that I was at Dadar in the next 20 minutes. At the entrance of platform 8, my luggage was inspected, and the policeman on duty spent almost 3 minutes playing with my Nokia 6300. He seemed to be particularly interested in the albums. I still wonder what he was looking for!
On to platform 8, and I bought a packet of chips (10 bucks, and barely 10 pieces of chips) and boarded the train. There was 1 hour before the train departed, and I busied myself with the chips and Jeffrey Archer.
As the train was reaching Kalyan, I bought a veg palao for dinner (Rs 40!), and I felt thoroughly cheated. The fact that I now had only Rs. 183 left didn't help the cause.
After 9 hours of uninterrupted sleep (even the TTE didn't turn up), I woke up near Belgaum, the land of VTU. I had 2 idlis and 2 vadas for breakfast (Rs. 20), and it was a pleasant break from the usual pav-bhaji - vada-pav of Mumbai. Even the chutney had just the right amount of spice.
By lunch time, I was in Dharwad. I must say, the menu on trains has improved considerably. I had 2 ಜೋಳದ ರೊಟ್ಟಿs, curry, rice, dal and buttermilk for lunch (Rs. 35 only). I started feeling more and more south indian :)
After 200 pages of Jeffrey Archer, the train neared Tumkur. The cool air was refreshing. For the first time in months, my shirt was not sticking to my body - I was dry! What a feeling!
Dad was waiting for me at the railway station. I wonder why home always feels sweet.
After a short auto ride to Kanjurmarg, and 20 minutes of waiting in the queue, I got a ticket to Dadar. The local train ensured that I was at Dadar in the next 20 minutes. At the entrance of platform 8, my luggage was inspected, and the policeman on duty spent almost 3 minutes playing with my Nokia 6300. He seemed to be particularly interested in the albums. I still wonder what he was looking for!
On to platform 8, and I bought a packet of chips (10 bucks, and barely 10 pieces of chips) and boarded the train. There was 1 hour before the train departed, and I busied myself with the chips and Jeffrey Archer.
As the train was reaching Kalyan, I bought a veg palao for dinner (Rs 40!), and I felt thoroughly cheated. The fact that I now had only Rs. 183 left didn't help the cause.
After 9 hours of uninterrupted sleep (even the TTE didn't turn up), I woke up near Belgaum, the land of VTU. I had 2 idlis and 2 vadas for breakfast (Rs. 20), and it was a pleasant break from the usual pav-bhaji - vada-pav of Mumbai. Even the chutney had just the right amount of spice.
By lunch time, I was in Dharwad. I must say, the menu on trains has improved considerably. I had 2 ಜೋಳದ ರೊಟ್ಟಿs, curry, rice, dal and buttermilk for lunch (Rs. 35 only). I started feeling more and more south indian :)
After 200 pages of Jeffrey Archer, the train neared Tumkur. The cool air was refreshing. For the first time in months, my shirt was not sticking to my body - I was dry! What a feeling!
Dad was waiting for me at the railway station. I wonder why home always feels sweet.
Friday, April 24, 2009
Monday, April 6, 2009
April fooled!
Last week, Prof. Om Damani announced our next assignment. We had to implement statistical machine translation, that too with exams just 15 days away. Given that he took almost around 4 classes (that's about 6 hours) to give the overview of the procedure, we simply had no clue how we would manage it.
Well, we got this email from him today.
I've never ever felt this good after being fooled!
Well, we got this email from him today.
Was it April 1st when I announced it :)
Sorry to disappoint you, but no assignment 6.
- Om
I've never ever felt this good after being fooled!
Thursday, March 19, 2009
munnabhai@cse.iitb.ac.in
Life at IITB surely rocks, and so does our department :)
Starring Adil as Munna Bhai, and Sree Shankar as Circuit.
Starring Adil as Munna Bhai, and Sree Shankar as Circuit.
Monday, March 9, 2009
Viterbi algorithm for second order Hidden Markov model
This post is a supplement to the Viterbi article on Wikipedia I'm posting this because I couldn't find an understandable implementation of Viterbi for second order HMM anywhere (I badly needed it for my assignment). So, Anup, Saurabh and I put our heads together and modified the Wiki article's Viterbi code to work for 2nd order HMM.
The story goes thus(from Wiki) - Two friends, Alice and Bob, who live far apart from each other and who talk together daily over the telephone about what they did that day. Bob is only interested in three activities: walking in the park, shopping, and cleaning his apartment. The choice of what to do is determined exclusively by the weather on a given day. Alice has no definite information about the weather where Bob lives, but she knows general trends. Based on what Bob tells her he did each day, Alice tries to guess what the weather must have been like.
Below is the python code (with some helpful print statements added). Feel free to copy :)
The story goes thus(from Wiki) - Two friends, Alice and Bob, who live far apart from each other and who talk together daily over the telephone about what they did that day. Bob is only interested in three activities: walking in the park, shopping, and cleaning his apartment. The choice of what to do is determined exclusively by the weather on a given day. Alice has no definite information about the weather where Bob lives, but she knows general trends. Based on what Bob tells her he did each day, Alice tries to guess what the weather must have been like.
Alice believes that the weather operates as a discrete Markov chain. There are two states, "Rainy" and "Sunny", but she cannot observe them directly, that is, they are hidden from her. On each day, there is a certain chance that Bob will perform one of the following activities, depending on the weather: "walk", "shop", or "clean". Since Bob tells Alice about his activities, those are the observations. The entire system is that of a hidden Markov model (HMM).
Alice knows the general weather trends in the area, and what Bob likes to do on average. start_probability reflects Alice's belief that it is rainy on a given day, there is a probability of 0.7 that it'll rain the next day as well.Below is the python code (with some helpful print statements added). Feel free to copy :)
states = ('Rainy', 'Sunny')
observations = ('walk', 'shop', 'clean')
start_probability = {
'Rainy|Rainy' : 0.7,
'Rainy|Sunny' : 0.3,
'Sunny|Rainy' : 0.4,
'Sunny|Sunny' : 0.6
}
transition_probability = {
'Rainy|Rainy' : {'Rainy' : 0.8, 'Sunny' : 0.2},
'Rainy|Sunny' : {'Rainy' : 0.5, 'Sunny' : 0.5},
'Sunny|Rainy' : {'Rainy' : 0.6, 'Sunny' : 0.4},
'Sunny|Sunny' : {'Rainy' : 0.3, 'Sunny' : 0.7},
}
emission_probability = {
'Rainy' : {'walk': 0.1, 'shop': 0.4, 'clean': 0.5},
'Sunny' : {'walk': 0.6, 'shop': 0.3, 'clean': 0.1},
}
def forward_viterbi(obs, states, start_p, trans_p, emit_p):
T = {}
for state1 in states:
for state2 in states:
## prob. V. path V. prob.
T[state1+"|"+state2] = (start_p[state1+"|"+state2], [state2], start_p[state1+"|"+state2])
for output in obs:
U = {}
print "--------------------\nObservation:",output
for next_state in states:
total=0
argmax=None
valmax=0
print "Next state:"+next_state
for curr_state in states:
for prv_state in states:
print "\tprv_state|curr_state:",prv_state+"|"+curr_state
try:
(prob, v_path,v_prob)=T[prv_state+"|"+curr_state]
except KeyError:
(prob, v_path,v_prob)=T[prv_state+"|"+curr_state]=(0,None,0)
p=emit_p[curr_state][output] * trans_p[prv_state+"|"+curr_state][next_state]
prob *= p
v_prob *= p
total += prob
if v_prob > valmax:
argmax=v_path+[next_state]
valmax=v_prob
print "\t\t",v_path,v_prob
U[curr_state+"|"+next_state] = (total, argmax, valmax)
print "\targmax:",argmax,"valmax:",valmax
T=U
## apply sum/max to the final states:
total = 0
argmax = None
valmax = 0
for state1 in states:
for state2 in states:
try:
(prob, v_path, v_prob) = T[state1+"|"+state2]
except KeyError:
(prob, v_path, v_prob) = T[state1+"|"+state2]=(0,None,0)
total += prob
if v_prob > valmax:
argmax = v_path
valmax = v_prob
return (total, argmax, valmax)
def example():
return forward_viterbi(observations,
states,
start_probability,
transition_probability,
emission_probability)
res=example()
print "\nResult:",res
Subscribe to:
Posts (Atom)