Thought Experiment: Deep Learning on Life

Quick Refresher on Neural Networks
A feed forward neural network (referred as NN in future) has three types of layers: input layer, hidden layers and output layer. There are two main stages of using a NN: training stage and testing stage. In the training stage, the input is fed via the input layer and then it passes through multiple hidden layers (that’s why it’s called deep) and finally through an output layer. At the output layer, we get the output of NN for the given input and we also have the corresponding expected output. The difference between expected or true output and computed output is called ‘loss’ and it is backpropagated through the NN and the weights of the hidden layers are updated so as to minimize the loss in future. This process is repeated multiple times to train the NN. Then at test stage, a new input is fed to the NN and we get the corresponding output.

Applying Deep Learning and Neural Networks on Life

life_NN

I thought it might be an interesting thought experiment to try applying a basic Deep Learning Neural Network model on our life! (Probably effect of too much Deep Learning 😀 ) The overall idea is shown in the figure above. All the inputs from the five sense organs (things we see, hear, taste, smell and touch) are transformed and fed as input to the NN. The deep hidden layers further process this information. At the output end, the output is transformed into multiple output metrics like happiness, satisfaction, peace of mind, monetary benefit and many more. Our life’s NN is mostly in training mode. Each and every experience is transformed and fed into the input layer and then it passes through hidden and output layers. For every experience, we have its corresponding expectation called the output vector. Our expectations have a different score for each of the different output metrics. And the difference between expectation and output called loss is backpropagated to train the NN. Thus our model is trained by the experiences of our life so far. Every experience is a training sample. At test time, we give the test experience as input to this trained model and take some major/minor decision based on the output which affects the experiences (future inputs) which we will face in future. Thus the decisions we take in our life, at any point, are based on the experiences we have had in our life so far and our expectations of each of those experiences.

The usual Gyaan derived from NNs:

* Sometimes we think some people are crazy when they take certain decisions in life, however it is wrong to judge others as we can never put ourselves in other’s shoes firstly because we don’t know what all things they have experienced in their lives and secondly because we don’t know what exactly are their expectations from their own lives. So it makes sense to stop judging others!

* Sometimes, our own decisions may seem crazy. That might be because the weights of our output metrics (expectations) might be significantly different from the usual weights of other people, and in such case, it makes sense to embrace our crazy self!

* Training our life’s NN, just in itself is very hard task! And then if we start taking other people’s expectations into account while training our NN, it is very difficult to attain a stable convergent model. So it makes sense to live our life and make decisions in our life based on our own terms and stop caring about the char log (random strangers)!

* If we have too high expectations in our life, then mostly the loss is also higher than usual and the model is frequently updating. These frequent updates require more energy. So it makes sense to be prepared and to practice to stay strong in order to efficiently keep training the NN in case one has very high expectations from life. Similarly having no expectations doesn’t make sense, because in that case, the model does not have any guidelines. Thus it helps to know and set our expectations in advance.

* It is difficult to train NN with little data. As we experience new experiences, we train our NN better. So even in case of our life’s NN, acche din (good days) are coming as we keep experiencing new experiences!

* Sometimes if you feel that life is screwed up (you are stuck in a local minima or a saddle point) and the NN of life is not doing any good, it is ALWAYS possible to make some changes in the parameters so as to resume effective training of the NN. It will be hard but not impossible. The loss function will always have its ups and downs. Stay strong, have hope and don’t give up!

* At any point in time, every person is at a different stage of training their NN. Also every person has faced different experiences and has different expectations. Structurally and parameter wise also, the NNs will be very different. So it does not make any sense to be competitive and compare each other! It makes sense to share strategies which help in training the NN better. Life is actually NOT a race! Cooperation is better than competition!

* If you find mentors who genuinely care for you, then preserve and nurture those relationships, they can guide and motivate you in difficult times. Same thing applies to real friends and family, they can be your pillars of support. It makes sense to learn to network and build lasting meaningful relationships. (Networking can be hard for introverts like me, but then it is all about quality not quantity!)

* Our education is like initialization and running few initial epochs to setup the NN of life. Initial conditions are very important. Also the closer our education is to real life, the better prepared we will be in future! Stop memorization and rote learning.

* Just like high end GPUs can significantly improve the training speeds as compared to normal CPUs, similarly we can make the life’s NN train much better if we maintain good health. It makes sense to eat healthy, exercise and stay fit.

* Sometimes if we compare two consecutive iterations, we might not notice any significant change which in turn might make us doubt ourselves and our abilities and we might question if anything is truly happening? are we on the right track? and so on. It is very rare to get great short term results. It makes sense to be patient and focus on long term results.

* Even if you meet or exceed expectations on one of the output metrics while the other metric scores are significantly low (for example your experiences have a high monetary value and low score of peace of mind or vice versa), in that case, overall the loss is going to be very high i.e. things are going to be hard. It also shows that lopsided expectations and outcomes are bad and it makes sense to work towards holistic, all round development.

P.S.

* Ofcourse real life is a lot more complex and no model can exactly mimic it. This NN model is also an attempt to model some of the significant features of life.

* I could have titled this post as Feed Forward Neural Network on Life but then Deep Learning on Life sounds way cooler! 😀

Advertisements

Sailors

Michael_Zeno_Diemer_-_Ship_at_Sea
Ships in the Sea

The oceans and seas have sailors young and old,
Having ships to sail around the world.
Some ships are simple while others made of gold!
Yet all sailors have a common aim to sail to lands unknown.

Every ship at any point in time is hit by different waves,
Yet if you think, at an abstract level, all waves are the same.
Some waves may be gentle while others may hit powerfully hard,
Every sailor must be prepared to face the waves, gentle or hard!

The oceans and seas will have fishes, pearls and icebergs as well.
Similarly the approaching land might be a desert, jungle or a volcano.
The sailor must be prepared to tackle and learn,
From the varied diversity of sea and land.

Some sailors know where they want to go,
While others just go on along with the flow.
The unknown lands may be near or far,
They may be exactly what the sailors imagined or completely apart.

Some relax and have fun while being off sea,
Make merry and celebrate on the stable land.
While others use that time to enhance their anchored ships,
And make themselves stronger to face challenges.

All sailors by nature, never like to stay on the land too long,
After few days, months or years on land, they feel the oceans calling for their souls!
They then pack up to explore new lands,
Afterall how long can a sailor be on land?

Sometimes, after repeatedly sailing and living on shore,
Life may seem like an endless loop!
But then staying at a point may be comfortable,
However then there is going to be nothing new!

While sailing and on land, they meet fellow sailors,
Make friends with them and learn from each other’s experiences.
They must however sail independently,
As all ships are designed for one sailor alone.

Sometimes, sailors may envy other sailors’ experiences or fancy ships,
But then all these are enhancements while the primary goal for all is to sail.
Nothing stops sailors with smaller or simpler ships from sailing to better lands,
And to improve themselves, as well as their ships with resources available at hand.

Over a period of time, all sailors experience sailing as well as living on different lands,
Each of their experiences are very different and yet the same from a higher stand!
The more they travel and the more they explore,
The deeper they can unravel their own selves to the core!

Image Source – http://commons.wikimedia.org/wiki/File:Michael_Zeno_Diemer_-_Ship_at_Sea.jpg

Visit to Mutianyu Great Wall of China

Mutianyu

Visiting the Great wall of China was the top most item on my places to visit list of my recent China trip. I specially planned to go to Beijing to visit it. After all who will miss visiting one of the seven wonders of the world!

I visited Beijing in September 2017 end. The weather a cloudy and i didn’t want to go to the wall on a rainy day as it might be slippery. I was in Beijing for three days out of which one full day was to visit the wall. The first two days were cloudy with prediction of rain so i skipped going to the wall. On the third day i decided come what may, i am going to the wall today! And i tell you, it would have been my biggest regret if i would not have visited to the wall…

So i got up early and decided to start early. I wanted to withdraw cash from an ATM and there were some issues with my forex card so i used my credit card to withdraw some cash. And in all this i got a bit delayed. (Tip : Keep multiple credit cards and forex cards to handle things in case of such glitches).

I had done a lot of research online about which part of the wall to visit. I had seen the crowded pics of Badaling. And thus decided to visit the Mutianyu part of the wall. It is also the highest rated place on TripAdvisor.

Also, I wanted it to be an adventure, so i decided to go to the Mutianyu great wall using public transport. That way, i had more freedom to walk on the wall as per my wish and take breaks when i wanted. Also it was a lot cheaper (and far more adventurous!).

So the first step was to take the subway line 2 and reach the Dongzhimen station. At this point i will recommend that you by a transport card if you don’t have one. It can be used further on the bus and it will save some money.
There i took Exit C and followed the directions which led to the transport center. It is a few hundred meters away. Reached the boarding point of 916 express bus. The 916 bus is slower with more stops, so take the 916 express bus.
After about an hour or so i reached Huairou. There i got down at Beidajie stop. There you will see a building with greenish glass and a China mobile shop across the road.
Just cross the road and you will find a bus stop. Now based on some YouTube videos i waited at this stop for half an hour and finally took the H23 to Mutianyu wall, however after some time i found that it was not going towards Mutianyu wall. So i suggest do not take the bus.
At this bus stop there will be many people n vans to take you to the wall. Bargain and decide to go for 5 CNY per head. Wait for some more people to join. At this point i met 3 people from different parts of the world and they became my wall buddies to walk on the wall. So we waited and took the bus. One of us noticed that the bus is going on a different route. So we got down at a stop midway. From that point it would have taken us 2 hours to reach the wall walking!!! But the lady who was pestering us to take her van to the wall followed us! She said she would take the four of us to the wall! Some of us were skeptical but then we had no choice. We got in her van and she took us to the wall near a stone bridge. And i felt so relieved and happy after seeing the entrance. I had finally made it! 🙂

Based on my research i had decided to go up using chairlift and to come down using a toboggan. So i took an all inclusive ticket for 180 CNY which included the shuttle to and fro to the wall, the entry ticket, the chairlift ticket and the toboggan ticket. There are restaurants and a lot of souvenir shops. But i suggest visit the souvenir shops on the way back. The wall buddies i met split into two groups at this point, a guy and me decided to immediately go to the wall while the other two decided to take a break and then go up.

We reached the point to get to the chairlift. It seems a bit dangerous but actually it is okay and safe. You need to quickly get in and they put the handle and lock on top. It goes up slowly and there are awesome views all around. Enjoy the ride. You can see the toboggan track below. It will take around 5 minutes. When you reach the top of the wall, they click your photo. You can buy it for 30 CNY. I didn’t buy it and i regret it now. So i suggest buy it if you can.

And yipee i was on top of the wall! It was just AWESOME! Amazing views in all the directions. The lush green peaks, the endless stretch of the great wall up and down the mountains, the chirping of birds and nice cloudy weather. It was simply AWESOME!

We decided to walk towards watchtower 5 on the left. Initially there was descend and then steep ascend. This part of the wall is difficult for people with joint / knee problems. Some parts of the wall are easy and some are really hard. In some parts which are very steep, they have put hand railings. Climb the stairs very carefully. I took multiple breaks in between. Climbed up the watchtowers and enjoyed the views. Took a few snack breaks. Carry a few things to eat and drink. Things are available in some parts, but the choice is limited and the prices are high. Clicked a lot of pictures and selfies 🙂 Didn’t go to the highest tower as we were tired and also we didn’t want to miss the bus back to Beijing. So took a break at the highest watchtower we climbed and just soaked in the views. Recharged our batteries by eating some more snacks. Met people from all over the world panting and climbing the wall. Met some fellow Indians too. Did a video call and showed the live view from the great wall to family and friends 🙂

And then it was time to head back towards the starting point. And the descent was riskier. I was very careful and got down the steps with a great care. We were back to the starting point and from here the highest watchtower which we went to seemed so far! Again took a final photography break and then it was time to go down.

And this is the coolest part of the Mutianyu wall visit. Ride the toboggan of slide down! If you are healthy and fit then chose it over other options like chairlift or cablecar and believe me it is totally worth it. They have built a metal slide. And there are individual plastic tray seats to sit. There is a lever to increase or decrease the speed. Push the lever forward and it moves fast, pull it back and it slows. It works just using gravity! Tip : Allow sufficient distance between the person in front of you and then start the ride. The faster you go, the more thrilling it is. Slow down a bit on the turns. Overall the slide is very long, i guess atleast a kilometer long. Twice i thought that it ended but it went on.. Enjoy the slide to the fullest. Again when you reach down they will take your picture. Buy it if you can for 30 CNY.

Took the shuttle back to the entrance gate. There are a lot of souvenir shops. I bought some magnets for 5 CNY per piece. There are other small things which you can bargain and buy.

And guess what? our savior, the van lady was waiting for us here to take us back. She charged 10 CNY to take us back and we didn’t bargain with her as she had saved us that day. We waited for our other two wall buddies to be back and finally we waved goodbye to the Mutianyu great wall!

The van lady dropped us back at the bus stop and we took the 916 express bus back to Beijing. In the evening the traffic was more and it took 2 hours to reach back. But the aching legs required the much needed break after so much of climbing up and down the wall. Bid goodbye to the wall buddies hoping to meet them suddenly in some other parts of the world.

And thus ended my adventure of visiting the Great Wall of China. I made the right decision of vising the Mutianyu section. It was not very crowded and sometimes i could get a part of the wall to myself to click nice pics and selfies. I would recommend going as early in the day as possible so one can spend more time on top of the wall. If only i had another day in Beijing, i would have revisited the wall! I was the coolest solo experience of my life so far and i will cherish it forever!

“Newer us” meets “Older us”

Sometimes we leave behind some places and move on,
To find new lands and to learn different things,
But we don’t leave like the person we came,
We have been transformed,
By the people, the place and the experiences.

A part of us, decides to stay back…
And, everytime when we go back,
The newer us meets the older us,
And both of them, talk with each other,
As there are a lot of things to catch up on…
The newer us shares the news of the outside world,
As well as the newer lessons learnt and experiences gained,
And the older us turns nostalgic and reminisces of the old times,
It also tells how the place has transformed since the time we left,

And after this discussion, the combined us,
Starts to think if the newer us is better or the older us?
But the truth is that neither is better in itself,
It is the combined us with the combined knowledge and experiences,
Which turns out to be wiser…

And then when the time comes to leave that place again,
The older us decides to stay back, a bit wiser
And the newer us thinks back of the good old days…
Both will be back from where they came and where the belong,
But both have transformed a lot in the process,

And the place where it all happened, feels like home…
And its people, like family…
And the knowledge gained, priceless…

Quest of HappYness

The quest of happYness will take you far and wide,
Make you do all sort of crazy things to bring out funny side.

The quest of happYness will shake you & won’t let you sleep,
Even in your dreams new ideas to seek fulfilment will creep.

The quest of happYness will always keep you on the go,
Motivate you to move further ahead, even when you feel low.

The quest of happYness might be long and tiring.
However, on every milestone, the results are rewarding.

The quest of happYness is like an infinite loop,
Just keep moving, looking for the upcoming fruit.

The quest of happYness will never probably end,
As permanent lasting happYness is just a pretend.

The quest of happYness teaches of joy even when things may not be perfect,
Just like the ‘Y’ in happYness instead of the usual ‘I’ which you expect.

The quest of happYness shows that sum of parts is more than whole,
The journey is more rewarding than the pleasure of reaching the goal.

The quest of happYness shows that everything is temporary,
As the current source of ecstasy won’t last till eternity.

The quest of happYness also has a deeper and higher motive,
To make a well-experienced individual, wise as well as emotive.

The quest of happYness is so alluring and mystique,
Paths may be different but happYness is the aim we all seek.

If a tree falls in a forest…

If a tree falls in a forest and no one is around to hear it, does it make a sound?

Initially it may seem a trivial question, however on second thought its a philosophical question. It all depends on the definition of sound. The meaning of sound is “vibrations that travel through the air or another medium and can be heard when they reach a person’s or animal’s ear.” Thus as per the scientific definition, vibration is sound only if its perceived by the auditory glands of an animal or human. Without the receptor its just vibration and not sound. However philosophically it questions whether the state of an object depends on how it is perceived by a subject. Does something which cannot be perceived by anyone actually exist? And as one can say its not a yes / no answer.

“Two monks were arguing about the temple flag waving in the wind. One said, “The flag moves.” The other said, “The wind moves.” They argued back and forth but could not agree.
The Sixth Ancestor said, “Gentlemen! It is not the wind that moves; it is not the flag that moves; it is your mind that moves.” The two monks were struck with awe.”
– The Mumonkan Case 29, translation by Robert Aitken

I just briefly explained this because of the title and the introductory question. However this post mainly asks questions on similar lines based on how people behave on social networks these days…

If a tree falls in a forest and no one is around to hear it, does it make a sound?

If you met your friends and didn’t check in online, did you actually meet them?

If you visited a new city or country and didn’t update your FB, WhatsApp, Twitter etc DPs did you actually visit?

If you had dinner at a restaurant and didn’t check in on Zomato, did you actually have dinner?

If you got married or had a baby and you didn’t update your ‘status’ on social networks, did it actually happen?

If you changed your job and didn’t immediately update on LinkedIn, did you actually change the job?

If you went on your honeymoon to an exotic location and didn’t post the pics, did you actually go?

If you bought a new house or car and didn’t post a pic on the same day, did you actually buy it?

If you didn’t write a R.I.P. when someone passed away, didn’t they actually rest in peace?

If you saw a sunrise or sunset and didn’t take a selfie (with your back facing the sun), did you actually see a sunrise or sunset?

If you didn’t change the display picture for a cause, do you actually support it?

I can go on and on. My point is simple, lets enjoy the moments of life. Nothing is wrong or bad about posting updates on social networks. Only that it should not be the first thing we think or do. At the end of day, once in a while its ok to post updates about our life. However doing that EVERYDAY for every single thing that happens in the life surely sounds like a bad idea. Believe me, no one actually cares about the constant updates about our life on social networks. Its more like an information source for others. So why not spread some useful, thought provoking, inspiring, interesting or funny information? It might actually be useful for someone. And if the intent of regular online updates is to maintain a log of the happening of our life then the best idea is to maintain a journal (either in a book or online form). And it can be shared (if you wish) with a few people who actually care about you.

Even i am not perfect. Sometimes even i feel to click a pic or post an update. However, mostly i stop myself until the event has completed and i have thoroughly lived it. Then i rethink whether it should be posted online. Will it be useful for anyone? If the answer is yes, then it its updated, otherwise not. So stop taking a selfie or posting an update instantly. Lets learn to live in the moment. I know it can be hard, as the whole world (or the majority) is doing things the usual way. However its not mandatory that everyone should follow the crowd. Lets enjoy the moments of our life as they come. Lets try to live in the present. Lets push back the thought of immediately posting updates of the happening of our life to sometime later after the event has happened and we have fully experienced it.

Cheers! 🙂

Life as an N-ary Tree

480px-Fractal_canopy.svg

Our life is like an n-ary tree.

Each node of n-ary tree can have n or fewer child nodes. In case of our life, every decision point is a node and all possible options or choices which can be made at that decision point are its child nodes. For example: a career choice is a node, which may have various child nodes or options like engineering, medicine, journalism, law etc. Similarly, it can also have minor day to day decision nodes like restaurants to have dinner at and in this case various possible restaurants will be it’s child nodes. Thus this design can handle all types of decisions and its choices as it’s children.

Also if a same decision is to be made at multiple times in one’s life, then in each case it will be a new instance with same or different choices as children. For example one may wish to make a career change multiple times in life and each time there will be a new decision point with new children.

Thus there are no back-links or backtracking possible in our n-ary tree of life. “Life is a one way and forward is the way to go!” After a choice has been made about a decision, it’s a line in stone, which can never be changed. We can always learn from the choices made in past but we can never undo or delete our choices. NEVER. One has to live with the decisions made in the past. It’s good to learn lessons and make better decisions in future.

Next, lets have a look at the traversal strategy of the n-ary tree of life. Only Depth First Search (DFS) is available. It means that we need to make a decision from all the choices. Breadth First Search (BFS) in which case all the options are explored to the paths they lead and then making an informed decision is not available. For example: It would have been great if we could try multiple career choices for a while and then make a final decision. But it is not so. Every decision is final in the n-ary tree of life and it also has its consequences on the choices available and the decisions which can be made in future. In this case “wisdom” is to make the best possible decision from all available choices based on our limited knowledge of choices and it’s repercussions.

Every choice has a pay-off or value associated with it. It is not known to us but again we can make a guess about it based on our “wisdom”. The basic strategy is to choose the path of life which has the maximum pay-off. However given that life offers only Depth First Search and that too without backtracking, it’s really difficult although not impossible to find it. Some of the paths may be close to best, some worst and some mediocre.

Also as in case of n-ary trees, greedy strategy may not be the best possible strategy. Firstly it’s not possible to find the best choice out of all available choices. And secondly even if the best choice is made, the current best choice may not necessarily be on the best or good paths of life. Similarly, sometimes even a low-paying current choice may actually lie of the better paths of life. Thus we should not to get disheartened by the current low pay-off choice as it may possibly lie on on of the better paths. Always have hope of making better choices in future which lead to better paths.

So actually, our life is not about the road not taken, it’s about the decisions made at every decision point in our life. We are the controllers of our n-ary trees of life. It’s always in our hands to make a decision out of all available choices. Let’s be brave to accept and face the decisions we have taken in past. More importantly, let’s gain the wisdom, to take the right decisions in our lives which maximizes the overall pay-off and leads to the best possible path in life.

P.S. –