Shamit Bagchi's Blog
April 1, 2022
CODA: Art & Ambiguity
All good art has something ambiguous about it, that gives the audience or the viewer an impetus to interpret it herself! This particular scene from the fantastic movie CODA (Oscar winner 2022) was exactly like that! In it a deaf father's daughter is singing a song for him and he is able to feel it. The second time I watched the movie, I got a totally different interpretation than the way I had interpreted it, this time from Tanuka who was watching it for the first time. She had interpreted it in a way I just did not think of, without going into specifics.
Which goes on to show the element of ambiguity in that scene which throws up a moment of aha! Or you got to use your brain to fill in the blanks and give it closure. Of course there is context and emotional depth that is necessary too, however the hallmark of good film-making are such subtly ambiguous moments and scenes without being over the top irrational or puzzling and uninterpretable! Good art, ergo the subtle ambiguity!

September 28, 2020
Ending Song: Meghe Dhaka Tara (2013)
Meghe Dhaka Tara (2013) directed by Kamaleshwar Mukherjee
Have not seen a better or a more intensely rousing movie ending scene than this one. Absolutely electrifying! The song is also just marvelous, riveting. The landscape and the scenes of the video song are just brilliant! Masterpiece. Every time I see or hear it, I get goosebumps. Watch the video: Aaohaan.
Meghe Dhaka Tara (Cloud Capped Star) is a 2013 Indian Bengali film directed by Kamaleswar Mukherjee. The film is inspired from the life and works of Bengali film director Ritwik Ghatak. The entire film is in black and white except the last scene which has been shot in colour. In this film Saswata Chatterjee plays the character of Nilkantha Bagchi and Ananya Chatterjee plays the role of Durga, Nilkantha's wife. Besides giving an account of Ghatak's life, the film also depicts the socio-political environment of contemporary West Bengal during the Tebhaga and Naxalite movements.

Kamaleshwar Mukherjee has used the metaphor of Bangabala in the closing shots of his film, where a young girl, Bangabala, from Ghatak's Jukti Takko Aar Golpo is given concrete shape to look like the rape victim Phoolmoni in the mental home (in the 2013 film). She waits for Neelkantha out in the fields, as if inviting him to join her back, to his roots in Pabna and other places in East Pakistan once a part of undivided Bengal. Mukherjee beautifully suggests the 'liberation' of Ghatak who frees himself to join his 'Bangabala' to go on a new journey and perhaps begin to rewrite his life again. Phoolmoni is liberated and so is Neelkantha. The director does not use the darkness of death but the brightness of a yellow horizon in the distance, shown in bright colour, where the two figures become smaller and smaller till the film freezes to a close.
Background:
Ghatak’s last film featured himself as the drunken and spent intellectual Neelkantha who goes on a picaresque journey through Bengal to reconcile himself with his wife. He is accompanied by Nachiketa (Burman) and Bangabala (S. Mitra), a young refugee from Bangladesh. On the way they are joined by a Sanskrit teacher, Jagannath (Bhattacharya). The episodic narrative also includes encounters with Shatrujit (Dutt) who was once a noted writer but who now writes pornography (apparently a reference to novelist Samaresh Bose); a ranting trade union leader and Panchanan Ustad (Mukherjee) who makes masks for Chhou dancers (a sequence is devoted to showing the famous dance). Jagannath is shot by a landlord when the group stumbles upon a land-grab action. The film ends with Neelkantha meeting a group of Naxalite students wanted by the police: he argues politics with them and is shot in a police ambush the next morning.
Filmed while Ghatak was ill and suffering from alcoholism shortly before his death, Jukti is an inventive and lucid though pessimistic testament film, acted with elegance and irony by the director. With an astonishing sense of freedom Ghatak weaves together different styles and images ranging from gross calendar art (the courtship of his wife) to an almost abstract dance of death; from the elaborate Chhou performance where the goddess Durga slays the demon to lyrical depictions of nature; from inserted bits of leader footage to a Baul song. The encounters with the pornographer and the Naxalites add up to a devastating critique of contemporary politics. In the end, Ghatak offers a disabused but stubborn politics of the everyday: Neelkantha dies with a quote from the Manik Bandyopadhyay story Shilpi about a weaver who wove an empty loom because ‘one must do something’. Geeta Kapur’s essay ‘Articulating the Self into History’ (1989) is the most extended study on the film.
Ritwik Ghatak was an epitome of 'anarchy in art', especially film-making! Anarchism in the Arts (Britannica link)

May 6, 2019
Trial of SPARQL on GraphDB

I used the OWL ontology files from Allen Brain Atlas (ABA) Adult Mouse Brain Ontology
Then used SPARQL Query on GraphDB
http://localhost:7200/import#user
First you need to Import the file using Import → RDF → Server Files
Then use SPARQL Query & Update - http://localhost:7200/sparql
Sample SPARQL query that I used:
select distinct ?o where {Result:
?s ?p ?o .
filter contains(?o,"Cerebral cortex") #-- the important line
}
limit 100
1Cerebral cortex, layer 52Cerebral cortex3Cerebral cortex, layer 2-34Cerebral cortex, layer 6a5Cerebral cortex, layers 1-6b6Cerebral cortex, layer 17Cerebral cortex, layer 68Cerebral cortex, layer 39Cerebral cortex, layer 210Cerebral cortex, layer 4
Schema.org - has more RDF / triples: https://schema.org/docs/developers.html
Another useful link: Ontologies in Neo4j: Semantics and Knowledge Graphs

January 11, 2019
Run MySQL without Administrator privileges
ALTER USER 'root'@'localhost' IDENTIFIED BY 'MyNewPass';
Save the file. This example assumes that you name the file C:\mysql-init.txt
Open a console window to get to the command prompt: From the Start menu, select Run, then enter cmd as the command to be run.
Start the MySQL server with the special --init-file option (notice that the backslash in the option value is doubled):
cd "C:\Program Files\MySQL\MySQL Server 8.0\bin"
mysqld --init-file=C:\\mysql-init.txt

July 6, 2018
Hurt not to hurt
Call me a coward if you will!
I lack the courage to stand up for myself.
For betwixt being hurt and hurting the other;
I know not what you would choose.
I would in my right mind always choose the former.
To be hurt than to hurt!
To allay instead of to scorch
That my belief is the right path
If it shall satisfy the other.
I shall stay mum and accept the pain as a soothing balm imagined!
Pain is my constant friend not anger. Anguish maybe not vitriol.
I try to think of hurting through words but it refuses to come from within.
Dies a silent death.
So tell me am I wrong to not hurt?
To fear hurting the other though I consume the poison of hurt?
Would not sound right but that is my deepest inner voice.
Ignore and stay aloof,
Unable to confront, to stand up in arms,
For fear of hurting the other!

January 4, 2018
Softmax function, softmax regression.
It is a generalization of the logistic function that "squashes" a K-dimensional vector {\displaystyle \mathbf {z} }[image error] of arbitrary real values to a K-dimensional vector {\displaystyle \sigma (\mathbf {z} )}[image error] of real values in the range [0, 1] that add up to 1.
In probability theory, the output of the softmax function can be used to represent a categorical distribution – that is, a probability distribution over K different possible outcomes.
Example:
We know that every image in MNIST is of a handwritten digit between zero and nine. So there are only ten possible things that a given image can be. We want to be able to look at an image and give the probabilities for it being each digit. For example, our model might look at a picture of a nine and be 85% sure it's a nine, but give a 5% chance to it being an eight (because of the top loop) and a bit of probability to all the others because it isn't 100% sure.
This is a classic case where a softmax regression is a natural, simple model. If you want to assign probabilities to an object being one of several different things, softmax is the thing to do, because softmax gives us a list of values between 0 and 1 that add up to 1. Even to train more sophisticated models, the final step is usually a layer of softmax.A softmax regression has two steps: first we add up the evidence of our input being in certain classes, and then we convert that evidence into probabilities.To tally up the evidence that a given image is in a particular class, we do a weighted sum of the pixel intensities. The weight is negative if that pixel having a high intensity is evidence against the image being in that class, and positive if it is evidence in favor.
We also add some extra evidence called a bias. Basically, we want to be able to say that some things are more likely independent of the input. The result is that the evidence for a class igiven an input x is:
evidencei=∑jWi, jxj+biwhere Wi is the weights and bi is the bias for class i, and j is an index for summing over the pixels in our input image x. We then convert the evidence tallies into our predicted probabilities y using the "softmax" function:
y=softmax(evidence)Here softmax is serving as an "activation" or "link" function, shaping the output of our linear function into the form we want -- in this case, a probability distribution over 10 cases. You can think of it as converting tallies of evidence into probabilities of our input being in each class. It's defined as:
softmax(evidence)=normalize(exp(evidence))If you expand that equation out, you get:
softmax(evidence)i=exp(evidencei)∑jexp(evidencej)But it's often more helpful to think of softmax the first way: exponentiating its inputs and then normalizing them. The exponentiation means that one more unit of evidence increases the weight given to any hypothesis multiplicatively. And conversely, having one less unit of evidence means that a hypothesis gets a fraction of its earlier weight. No hypothesis ever has zero or negative weight. Softmax then normalizes these weights, so that they add up to one, forming a valid probability distribution. (To get more intuition about the softmax function, check out the section on it in Michael Nielsen's book, complete with an interactive visualization.)You can picture our softmax regression as looking something like the following, although with a lot more xs. For each output, we compute a weighted sum of the xs, add a bias, and then apply softmax.

![[y1, y2, y3] = softmax(W11*x1 + W12*x2 + W13*x3 + b1, W21*x1 + W22*x2 + W23*x3 + b2, W31*x1 + W32*x2 + W33*x3 + b3)](https://i.gr-assets.com/images/S/compressed.photo.goodreads.com/hostedimages/1515290905i/24850545._SX540_.png)
![[y1, y2, y3] = softmax([[W11, W12, W13], [W21, W22, W23], [W31, W32, W33]]*[x1, x2, x3] + [b1, b2, b3])](https://i.gr-assets.com/images/S/compressed.photo.goodreads.com/hostedimages/1515290905i/24850546._SX540_.png)
y=softmax(Wx+b)
The idea of softmax is to define a new type of output layer for our neural networks. It begins in the same way as with a sigmoid layer, by forming the weighted inputs*
zLj=∑kwLjkaL−1k+bLj However, we don't apply the sigmoid function to get the output. Instead, in a softmax layer we apply the so-called softmax function to the zLj. According to this function, the activation aLjajL of the jjth output neuron isaLj=ezLj∑kezLk,(78)
where in the denominator we sum over all the output neurons.
In fact, if you look closely, you'll see that in both cases the total change in the other activations exactly compensates for the change in aL4. The reason is that the output activations are guaranteed to always sum up to 11, as we can prove using Equation (78) and a little algebra:As a result, if aL4 increases, then the other output activations must decrease by the same total amount, to ensure the sum over all activations remains 11. And, of course, similar statements hold for all the other activations.
Equation (78) also implies that the output activations are all positive, since the exponential function is positive. Combining this with the observation in the last paragraph, we see that the output from the softmax layer is a set of positive numbers which sum up to 1. In other words, the output from the softmax layer can be thought of as a probability distribution.
The fact that a softmax layer outputs a probability distribution is rather pleasing. In many problems it's convenient to be able to interpret the output activation aLj as the network's estimate of the probability that the correct output is j. So, for instance, in the MNIST classification problem, we can interpret aLj as the network's estimated probability that the correct digit classification is j.

December 23, 2017
Install and use IPython Notebook
sudo -H pip install jupyter
Running Jupyter : Execute the following command:
jupyter notebook
More details here: How To Set Up a Jupyter Notebook to Run IPython on Ubuntu 16.04

November 9, 2017
Convolutional Neural Networks - CNNs

Convolution: The primary purpose of Convolution in case of a CNNs is to extract features from the input image. Convolution preserves the spatial relationship between pixels by learning image features

In the computation above we slide the orange matrix over the original image (green) by 1 pixel (also called ‘stride’) and for every position, we compute element wise multiplication (between the two matrices) and add the multiplication outputs to get the final value which forms a single element of the output matrix (pink). Note that the 3×3 matrix “sees” only a part of the input image in each stride.

November 3, 2017
Machine Learning - Model Evaluation Metrics
November 1, 2017
Deploy a Python app on Google Cloud
TUTORIALDIR=src/tantal-183814/python_gae_quickstart-2017-11-01-23-03
git clone https://github.com/GoogleCloudPlatfor... $TUTORIALDIR
cd $TUTORIALDIR/appengine/standard/hello_world
dev_appserver.py $PWD
gcloud app deploy app.yaml --project tantal-183814
Using the Container Engine:
https://cloud.google.com/container-engine/docs/quickstart#optional_hello_app_code_review
