Sunday, November 17, 2013

New Game Again!! Memory:

This was the the weekly mini-project for last week. the game gives 16 unexposed cards.
Here are the rules:
1) A click on each exposes the card showing a number.
2) Every number has another duplicate.
3) After two incorrect turns the cards will be again unexposed.
4) In every turn we must open up two cards with the same number.
5) remembering where the number was found is the key here. Minimizing the number of turns is the goal. Enjoy!!
http://www.codeskulptor.org/#user24_sksSofwp9H_2.py

Friday, November 15, 2013

My new python game (with music). Inspired from www.lumosity.com. This is a hobby project. Just type the result of the calculation and press Enter key. The faster the better. Hope you people enjoy.
http://www.codeskulptor.org/#user24_Qo2Wt6d939_24.py

Tuesday, October 29, 2013

Tuesday, October 22, 2013

The dismal state of education in India


Introduction: 
Almost every other day we get a news in our newspapers about government policies to improve education in India. Almost always the focus of the government is on improving infrastructure in educational institutes. Thousands of crores are allocated every year for improving "education" starting from primary to doctoral. But somehow all these "policies" have made little or no impact on the ground. So, where is the problem? Is it really possible to improve our education system? Being an educationist myself here is my take on this very complex topic.

What is education?
Before we dive into the main topic of improving education system, we must first understand what IS education. This is the definition from wikipedia:
"Education in its general sense is a form of learning in which the knowledge,skills, and habits of a group of people are transferred from one generation to the next through teaching, training, or research"

Although this definition is right I dont think it is complete. It talks about knowledge, skills etc being transferred from one generation to another. But here is the missing part taken from the online dictionary.

Education: An enlightening experience
It is not necessary to be taught something by some person to be called educated. A person who learns on his own and experiences enlightenment is "educated" too.
To put it all together, Education is all about learning and sharing what one has learnt.
Hmmm, this seems to be almost complete. But we have missed a very important aspect of education. I would say that Education is something which makes us all humans. A person may have lots of degrees and lots of knowledge about various fields, but if his behaviour is inhuman then we cannot call him educated.

The journey of system of "education" in India:
The traditional system of education in India is addressed as "gurukula system". Here the student is sent to a guru or teacher who teaches different skills to the student. There are some subtle points which we need to remember about this system.

  1. The teachers used to reside in isolated places. Mostly in villages or forests, away from cities. 
  2. Each teacher had different capabilities and skills. For different skills a different teacher had to be approached by the student.
  3. All education was free. The teachers did not accept any money from students. The students generally had to beg for food in the nearby villages. Sometimes the teachers were funded by kings. In any case, the students were never provided all facilities. They had to face many hardships in the gurukul.
  4. Although basic education was common for all, specific education was dependent on the varna of the student.
  5. Emphasis was more on pursuing family occupation.
  6. The students had the freedom to choose teachers. Teachers were not dependent on students. Yet the students were supposed to respect the teachers.
The british introduced the "modern" education system in India which thrives even to this day. They wanted people who could handle their accounts and transactions. The traditional education system did not have these in its syllabus. They wanted slaves who could work for them sincerely without even complaining of being enslaved. So they started funding this "new" system which paid teachers, took money from students and was based on "schools".
So, this education system was dependent on the needs of the Western nations. It was dependent on industries and politics (and continues to be the same).

Education after Independence
Were any changes made to this system after Independence? Sadly the answer is NO. Before independence the schools taught things which were useful for the british. It helped them loot India using its own people. Since no changes were made to the system the ruling government is able to loot this country with its own people.  Here is an overview of the current system.
  1. Universities set syllabus for different courses, conduct exams, provide degrees, have affiliated colleges (are supposed to perform research).
  2. There are different types of Universities again. Technical and Non-technical.
  3. Some colleges are autonomous. They can do everything except giving degrees.
  4. All courses are paid. The pay is again different for different categories of students (based on caste, religion, place of birth etc.)
  5. There are many organizations looking upon "quality" of education like UGC and AICTE and there is something called accredition which is done by some organizations like NAAC.
So where is the problem with the current system??
Most of these "educational" institutes are run by politicians or industrialists who use these as a means of black money-to-white money conversion centres. These institutes need to show that they are performing well and the way to do this is through good pass-percentages, awards and ranks.
To make sure that many students pass or perform well these institutes often indulge in malpractices.

The teachers recruited in these are also not competent (although they may have the necessary degree). Most of the people who take up teaching in India do so because they dont get job elsewhere. This being the case how can we expect these teachers to teach well? 

The claim that autonomous institutes are providing high quality education is also flawed. Autonomy is good and productive only when the people to whom it is given are competent and sincere. Teachers will not want to float a course which is new and demands more effort from them and students. The students on the other hand know that they only need to be in the good books of the teachers to fare well in the exams.

The system of accredition also demands research paper publications from students and faculty. Getting a paper published is no longer difficult thanks to internet and existence of huge number of conferences.

With all these problems and many more, is it really possible to improve the quality of education in India?

Friday, August 9, 2013

Web-scraping with Python: Building a bot to fetch results from VTU website

Since three days i ve been working with this project of fetching results from vtu website. This problem was floated by Girish Sir and is a frequent problem for all staff members after announcement of vtu results. I used BeautifulSoup and mechanize python modules for doing the parsing and connections respectively. Here is an overview of what has been the outcome.

The python mechanize module https://pypi.python.org/pypi/mechanize/‎ is extremely simple yet powerful tool to fetch data from websites.
Its interface is almost similar to how we interact with websites using a browser. The vtu results page has a form with name as "new" which houses an "input" tag called "rid". So we need to select that form and initialize the contents of that input tag to our usn. Then submit the form. Here is the code to do that.

by the way if there are multiple forms in the page br.forms() is the way to go.

The response is a new page with the result and is stored in the "resp" variable. We can now use BeautifulSoup to parse this page to fetch the results.
1) Get the html of the page with resp.get_data()
2) create a new BeautifulSoup object with this html
3) The result table is stored inside a "td" tag with width "513". Note that this should be unique and it is in this case. In fact there are many tables within this "td". Get all of them.
4) Result table is the second one so tables[1] is the result table. It has a number of rows and columns. Find them all and fetch the data in them and store in a list. The code is self explainatory.


Python ROCKS!!


Tuesday, March 26, 2013

Reading Think Bayes

I have started reading the book http://www.greenteapress.com/thinkbayes/html and thought of posting some interesting stuff i read.
Here is a problem from chapter 3:

Suppose I have a box of dice that contains a 4-sided die, a 6-sided die, an 8-sided die, a 12-sided die and a 20-sided die. Suppose I select a die from the box at random, roll it, and get a 6. What is the probability that I rolled each die? 
We need to first define the hypothesis(H) ie our prediction of which die has been rolled. In this case the hypothesis has to be a number from the list 4,6,8,12 and 20.
Also the data or observation(D) we are given is that the first random roll resulted in a value of 6.  We have to find the posterior probability distribution P(H|D=6) ie probability of each outcome H=4, H=6, H=8 etc  given the data D=6. The Bayes' theorem says that P(A|B) = P(A).P(B|A)/P(B). in our case P(H|D=6) = P(H). P(D=6|H)/P(D=6).
Now P(D=6|H) is going to be a distribution like
Hypothesis(H) Probability
P(D=6|H=4) 0.0
P(D=6|H=6) 1/6 = 0.1667
P(D=6|H=8) 1/8 = 0.125
P(D=6|H=12) 1/12 = 0.0833
P(D=6|H=20) 1/20 = 0.05
As you can clearly make out the values do not sum to 1. So add all these values and divide each value by the sum (normalize). This is needed to make it a probability distribution. so final result table will be,
Hypothesis(H) Probability
P(h=4|D=6) 0.0
P(H=6|D=6) 0.392156862745
P(H=8|D=6) 0.294117647059
P(H=12|D=6) 0.196078431373
P(H=20|D=6) 0.117647058824
This is called (after normalizing) the Likelihood ie likelihood of getting a 6 on a roll for each die. It is obvious that if we roll a 4-sided die getting a 6 is impossible. Hence likelihood of this happening is 0.0.
The main strength of this book is all problems are solved computationally. The author gives programs for all these and that too in Python. Now if we get more data by going on picking a die at random and rolling the probabilities will change.