Friday, 1 June 2012

Lloyd-max alogrithm again


The lloyd-max algorithm for scalar quantization chooses points randomly in the begining which causes the problem of local minima and global minima
possibily giving a non optimal solution
So
instead of choosing points randomly in the begining
can we choose them in this way

consider the pdf the r.v.
integrate the pdf till we get 0.5
consider this point as the first boundary point b1
then divide the intervals so obtained further again
in the first interval integrate till cdf is  0.25
consider this to be the second boundary point b2
thus we can acquire as many points as required considering the probabilistic behaviour of the rv

once sufficient number of boundary points are obtained we can the apply the lloyd max algo considering this boundary points
taking the mse and finding the approximation points a1 to an
then working on a1 to an to find the boundary points

the added part would take care that areas which have more probability will have the approximation points closer reducing the mse
hence the drawback mentioned in your notes where points choosen randomly may not be best if probability distributions are considered
can be resolved

Saturday, 26 May 2012

Simple application of Pressure imbalance

Mostly everyone has seen or been to a magic show at least once during the natural course of lifetimes.
I have also been to few  when I was kid.
The magic trick showed then was ' the magician filled a bottle of water with small holes in the cap
for the water to drain out. he then called me on to the stage asked me to look at the bottles and to tell the audience if the holes were authentic or if they were sealed with some transparent glue.
After conformation he gave me the bottle and asked me to turn it upside down and well obviously
water fell out thanks to gravity.
He then took to the bottle in his hands, whispered a few chants, gave the bottle a few shakes and walla
the drizzling water stopped as though gravity wasn't working.'
The trick ended and i have been thinking about it for a quite some time and finally
it dawned
it wasn't the absence of gravity but the mere pressure of air and water which was stopping the water from falling out.
The mumbo-jumbo was just for the amazement of the audience the real trick was in the shakes and wobbles he squeezed the plastic bottle while shaking
And as we very well know squeezing causing pressure and the pressure was sufficient to create an imbalance between air inside and outside the bottle.
Thus stopping the flow of water from the bottle.
Knowing is way more fun then the trick itself.....

Sunday, 13 May 2012

Max-Lloyd algorithm

Here I am talking about the algorithm used for finding the regions in which we are to quantize the given set of values and the values themselves.
As per the Max-Lloyd algo
1) we choose a given set of points as the quantization points
2) we then proceed to find out the region boundary points as perpendicular bisectors so as to minimize the error from the respective set of points
3) we then find the expected value of the point chosen to lie in the interval of interest and call this the new quantization value and so on reiterate the algo
what this basically does is we chose some points and move onto a better approximation of the points, however the algo by itself does not have any clue of the shape of the region so achieved considering two or more dimensional vector space for the points chosen ie group pairs of points.
Hence, even if better MSE(mean square error) can be achieved by changing some of the parameters of the shape of the particular area in consideration then may be the MSE can be reduced further more
For eg if we consider a two dimensional vector space then the algo would most likely settle on a square grid as the best value for MSE. However, a circle would have the least MSE but that will cause problems of coverage and hence hexagons would be the next best option.
So taking all this into account why not modify one the steps of the Lloyd-Max algo
It can be as follows:
Steps 1) , 2) and 3) remain the same during the 1st iteration.
During the next iteration add one more step after step 2) in the algo
Step 3) would now become
Find the MSE on the bisectors at fixed distances. The fixed distance would depend on the spacing of the two dimensional vectors. So when we obtain this we can realize how the MSE changes and modify the shape of the area.

But this would lead to a circle and some areas will remain untouched.
To solve this problem
I have asked to take measurements at fixed distance and not extremely close

Now the previous step 3 will become step 4
And the reiteration can take place

If increasing the quantization levels is permitted then
We can assign  a few levels for the spaces that will be left considering that circles would leave some areas untouched.
However the probability that those spaces are actually utilised by the points will be very less due to the very nature in which the algo works

Thursday, 10 May 2012

LZ-77

LZ-77
I am not talking of a car model or something.
Its the dictionary based coding scheme in digital communications designed by lempel and ziv in 1977
They had an amazingly cool idea. The whole problem prior to this was that when we assume a source having certain distribution say Markov process but then  the source does not produce anything even near that particular process or does not produce states that agree with the general concepts of a Markov process.
Then the whole model goes for a toss. And sometimes instead of coding we end up with something that's even more sad as compared to the original source data stream.
So these guys said, Owell lets not assume what the source distribution instead lets build it up based on statistical model as when the source generates the output.
Hence, when an infinite sequence of source symbols have occurred and the source stabilises to some distribution without major changes, we have the statistics collected so far,  and then we can model based on those statistics itself generating one hell of a code.
The only problem is the fact that we are not assuming anything in the beginning. This is the source of one problem or another. In this case more specifically, we have no clue of the distribution till a lot of statistics have been collected. So, we transmit everything till that is available which kind of is clumsy
when the source changes its statistics or when we start something.
So, how can we overcome this problem??
Solutions may already exist which I am unaware of at this point.
But i feel why not just assume some model and code that way till we generate sufficient data
and then let the LZ algo kick in.
The model we chose might not be an exact representation but even if it does a decent job of coding
a lot is achieved in this bandwidth needy world.
I haven't quite thought of which models we can assume in the beginning.
More on that next time when i have some more idea of what we are exactly dealing with

Saturday, 28 April 2012

Minority By Thought


The most difficult part is to pretend to do what everyone thinks is right. Or rather should I say what is socially right when there is no interest to do it. Its not so simple as I thought, I guess it is a complicated mess after all. Only if being non social was also socially acceptable option. Sadly or merely for most of the lot its quite simple to just be with people. Only if life was simpler then this and just do what we feel like irrespective of what others think. But then again being in minority has its own disadvantages. Doesn’t really matter why we are in minority. Sadly conformity is the only rule that has to be followed irrespective of what happens. Sometimes there is no choice no matter what we intend to do what happens in the end is the only thing that matters. Almost as if we were martyrs saying conformity rules. Only if this could be different. There would be some real understanding beyond words where no one has to say anything but still everything is understood. This could be our Ethiopia. The perfect legacy. Something that ought to be passed on. Thoughts are perceived cherished and then finally passed on unlike other material objects which just perish.

Saturday, 14 April 2012

MYOPIA

Have you ever wondered why cricket fielders or for that matter goal keepers jump irrespective of their distance from their respective balls.....
It’s the effort they make even though they are seemingly very far away from their respective targets. And people see them diving around trying to catch a ball they applaud the effort even if it fails in achieving the required output.
What would happen if they did not jump after that and instead just stood still allowing the ball to go past them. I am pretty sure that the people shout at them or rather boo in this case for not even attempting to make an effort to stop the ball. The people are in no condition really to judge what’s happening out there but they still do determine a lot of things for the club as well as the players. Most importantly it’s the fan base that I guess matters to any sportsperson.
Some how I feel people don’t really care much about whether those people can do something or not.
Its more like are they trying for that. Sometimes it just turns to a game of can u act to do that particular thing or not.
It’s whether people seeing that they have done something. It’s secondary that only those particular players know whether they are actually doing it or not.
Sometimes I feel that people should, may be for a second think about spot that particular person is and that no one wants to lose their position or something or want to lose the game but it’s just that it can’t be helped. He has done all that he can and yet the results remains unchanged so why not at least so the people that we are making an effort.
The thing is we forget about the circumstances and get so involved that never realize what we end up commenting on, mostly without thinking about the actual person’s ideas or involvement or for that matter his state.
Such bias, such narrow vision. That we take things to be the way we want them to look instead seeing the whole picture......
This is myopia of perfect vision......

Thursday, 29 March 2012

Light and Heat

Wen light falls on something that particular object becomes hot.
So does light and heat exhibit in the same form. Well may be it does but i feel that they can be treated as two separate entities though linked. Light is just what enables us to see. Whereas heat must be some transfer of energy.
Light can also be said as a transfer of energy. Consider this light is electron rotating causing certain wavelengths in the visible spectrum to be emitted. When this electron collides with some other object
it will transfer all of its energy elastically to the object. Since it does not have infinite energy it should to stop or at least slow down in the rotatory motion. This should cause a change in the wavelength emitted by that electron. Now if it is in the visible spectrum we see it. If it isn't we cant
The object to which it collided should now acquire the energy transferred by the electron. This should cause the electron in the object to revolve faster than before causing hindrance to the opposing forces in the material of which the electron is a part.
This friction can be responsible for the heat liberated.
Now again if that electron is rotating and emitting in the visible region we see the a particular colour
if it stops we see a change in the colour of the object when light falls on it.
most interestingly if all the energy from the colliding electron is transferred to the object that particular electron should stop rotating and also if the electron that it collided with wastes all of its energy as heat in opposition to the material forces of bonding then we should not be able to see anything
May be this is how black holes are. Light doesn't come out well because there is no energy left
all of it just gets spent in overcoming the nuclear forces in the material making that up.