Sunday, 5 January 2020

Guidelines for a leadership position



January 2020: I was promoted to the role of an Apprentice Leader at Mu Sigma. Apprentice leader can be thought of as a Data Science Manager where we have to continuously strive to improve the quality of the team that will be conducive for its growth. Transitioning into a manager role was certainly challenging. In addition to solving technical problems, there were new responsibilities such as collaborating with multiple people, ensuring that your team is motivated and inspired.

I have listed down a few guidelines (and not rules) that I felt are important to be successful in a leadership position.  

  1. Willingness to take up challenging tasks: I will be doing a lot of work that I haven’t done before and I will be pushed out of the comfort zone. I need to be prepared for this. In order to get results for these tasks, the points below will be of utmost importance
  2. Time management: The importance of time management can never be stated enough. When there are busy days, having a to-do list and a schedule will be very effective. Also, it is important to be in the present and not think about other issues at that point in time. Context switching is a skill that comes in handy in management
  3. Not getting affected by environment and people: Be ready to listen to opinions that are not aligned with my opinions. Be ready to be criticized and not get pissed off when people show a lack of understanding. In such cases, if I feel that I have a strong point that can show a different perspective based on my observations, then make sure it is being articulated in a calm and composed manner without insulting or criticizing the other person. Also getting angry is natural but wasting a considerable amount of time because of the anger is not worth it
  4. Be strong and decisive: The ability to take timely and tough decisions are indispensable in a leader’s toolkit. Additionally, I need to be impartial and unbiased while making decisions. It is difficult but it is what the role demands
  5. Be a powerful narrator: Many a time it will be necessary to promote the work being done or to present an impactful project. In such cases, it is essential for me to have the necessary storytelling skills with a powerful narrative. The message has to be loud and clear when discussing something critical
  6. Be persistent in your initiatives: No matter how lofty any idea is, it will not survive the test of the time if the leader is not being persistent with it. Does that mean the leader should never change any plan? No that’s not true. If the data shows that the plan is not working out then the leader should be the first one to quickly change the plan and take learnings from the failure
  7. Be willing to change beliefs and personality depending on the circumstances: I have faced this issue many times owing to my previous role. Now that I have been promoted I should grab this opportunity and hone my leadership skills
  8. Understand when you are getting stressed and relax: Generally stress leads to stiffening of the body. It is easy to be observe that. In such cases, taking a deep breath relaxes our muscles. The brain -- by observing that the tension no longer exists in the muscles -- will be free of stress and will lead to positive reinforcement of a good mood
  9. Be ready to seek help and talk to people: Talking to people gives us a new perspective and also leads to an improvement in our networking skills. Asking for help when stuck in a problem is also equally important
  10. Consistency: This is a crucial dimension as I have seen that consistency leads to incredible results. Consistency in sleeping time especially on Weekdays is key to get a good rest and waking up fresh. Consistency in going to gym builds up the momentum and develops a good physique. Consistency in preparing breakfast leads to a healthy diet and good digestion. Consistency in planning the day right after going to the office gives a direction for the rest of the day


While these 10 principles are being followed, it is also necessary to take a break and reward yourself.

Saturday, 14 July 2018

Cross Validation - Model checking, not model building

1st Update on 11th August 2020
2nd Update on 4th August 2023
3rd Update on 25th September 2023


Cross-Validation 

Cross-validation is a popular technique that is used for model evaluation in machine learning. If you skim through any Kaggle Kernel then you're bound to find Cross-validation in the script. It allows us to evaluate how our model will work when faced with unseen data and extends the concept of train-test datasets. It is also used to counter overfitting by examining how well our model generalizes.

CV has 2 main objectives: 
1. Give a good estimate of how our model generalizes to unseen data
2. Compare the performance between different models or a combination of hyperparameters 

I had this question about cross-validation. Suppose we do 5 fold CV, we are splitting our dataset into 5 portions and then training and testing on each portion. Then how are we supposed to choose which of these models is the best?

A similar question was asked on StackExchange which cleared my concern.

Also, this link from Machine Learning Mastery was helpful.

An example of choosing the best type of model. Let's consider a classification problem and we want to try Logistic Regression and Random Forest. Now, in this case, we will compare the CV error of both methods and choose the one that minimizes the error. 
Suppose Logistic Regression is a winner here. We will thus discard all the models that were built during the CV and train the model on the entire dataset. This model will then be utilized for predictions.

An extension to the above problem: We considered Logistic Regression and Random Forest in the above scenario but the question of hyperparameter tuning will now arise.
In logistic regression, we have L1, L2 regularization and in the random forest, we can vary the number of trees, maximum number of features etc. Hence, we are not just trying 2 models but a lot of variations amongst these models as well. Scikit Learn's GridSearchCV can be used here as it will iterate through all the variations and find the optimal model with its hyperparameters.
Now that we are aware of the best model along with its hyperparameters, we can train the model on the entire dataset.

Cross-validation Pseudocode:
Here we divide the training dataset into k-folds and k-1 folds are used for training and the remaining fold for validation
1. For 1 to N hyperparameter combinations:
    i. For 1 to k folds: #(The step repeats holdout approach k times)
        Train the model on k-1 folds and compute the validation error.
    ii. Calculate the average validation error
2. Choose the hyperparameters with the lowest average validation error and evaluate the model on test error

Here is the link to an example jupyter notebook.

Holdout validation:
We understood the concept of cross-validation but there is yet another strategy that can be adopted for choosing the best model or the model with the best hyperparameters. The strategy is called "holdout validation". 

Here, the dataset is divided into 2 sets: training and testing. However, the training dataset is further divided into training and validation sets. Thus, we would train our model on the training data and then evaluate its performance on the validation dataset. We could then compare the validation metrics between different models or if we want to choose the best hyperparameters. 

Once, the best model is selected we can then train it on the entire dataset and compute the test dataset metrics to understand how well our model generalizes. The con of this method is that we would choose only a small portion like 10% of the training data as our validation data and our decision would be based on this validation metric. 

Holdout Validation Pseudocode:
1. For 1 to N hyperparameter combinations:
    Train the model on the training dataset and compute the error on validation data.
2. Choose the hyperparameters that generalize the best and evaluate the model on test error

Here is a great link that explains the difference between holdout validation and k-fold cross-validation.

Sunday, 31 December 2017

Travelogue: Alleppey and Varkala

Kerala, God’s own country, is an Indian state, well known for its serene backwaters, palm-lined beaches, national parks and various other things. I went to Kerala with a group of friends for the long weekend having visited this state once way back in 2000 with my family. We traveled to Alappuzha (Alleppey) and Varkala in this tour.

We started off on 22nd Dec midnight in a tempo traveler. We were first traveling to Alleppey which was located at a distance of 600kms from Whitefield, Bengaluru. It generally takes about twelve to thirteen hours to cover the distance and we were expecting to reach the place by two in the afternoon. However, there were some obstacles along the way as the traveler’s tyre got punctured at around 3AM. It delayed us by about half an hour. Getting the Kerala permit was also time-consuming as it took us around ninety minutes to get the permit and it was pretty expensive at Rs.6500. As if this wasn’t enough there was heavy traffic owing to construction work all along the roads which was further aggravated by Christmas holiday season. 

Backwater is a part of a river where there is little or no current and one simply cannot miss the scenic backwaters of Kerala. We had intended to cruise along backwaters in Alleppey having booked a houseboat which included a stay at night. Having stuck in traffic the backwater sail started looking a distant possibility. Moreover, the houseboat gets stationed at a place by around six in the afternoon. We were going to Alleppey via Thrissur, Kochi, Ernakulam and one couldn’t miss the sea of CPI-M flags present every hundred yards. We finally managed to reach our destination at 5:45pm. We had missed sailing through backwaters which was a major draw to the houseboat but our caretaker assured us that he can arrange for the same the next morning. Hearing that was a big relief. Anxious to get to the destination we had skipped our lunch and as soon as I set foot in the boat I pounced upon the food that was kept ready for us. To my delight, the food included fish fry. That very night I had two meals within a span of three hours.

The next morning sharp at 7AM the boat roared to life and we set out on a journey through the backwaters. We cruised along the picturesque backwaters covered in the lush vegetation of palm trees which teamed up with aquatic wildlife. We also saw some other boats pass by us with tourists having a good time. We sailed at a leisurely pace getting away from the hustle and bustle of day-to-day and city life. It was definitely a relaxing journey. Here are some of the pictures which capture the essence of what we witnessed.


Present day houseboats are used for tourism but I was curious to find out what was their purpose in older times. I got to know that these houseboats were used for carrying tons of rice and spices to Kochi and each houseboat could hold up to 30 tons of goods. They were earlier called Kettuvallams. Let’s also have a look at the structure of the boat. The hull is the main body of a ship or a boat and we can think of it as the main framework. Wooden planks held together by ropes of coconut fiber make up the wooden hull. We notice that these boats have a thatched roof cover which is made up of Bamboo sticks and palm leaves.

Next destination was Varkala, approximately 120KM drive from Alleppey. From Kollam, Google Maps took us through a rustic road rather than the bustling city stretch. We drove past the charming coastal towns and the scenic view reminded me of the Sierra Nevada track in Roadrash game. 



We had booked Airbnb cottages in Varkala and it was quite cheap. The best part was that it was just 100 meters away from the beach. There was a narrow road from the cottages that led to the beach. We reached Varkala at around 2 in the afternoon and it was time to have lunch. We had already decided upon the place that we were going to have lunch at and we started off for the beach with that intention. However, there were only a few restaurants lined up along the beach and our decided restaurant was not to be found there. Google Maps showed that the restaurant was on Varkala cliff. Reaching the cliff included a steep walk up from the beach. The cliff has a large variety of great restaurants (mostly Tibetan), cafes and shops.  The view of the beach from the cliff is breath-taking.



After a lavish lunch, I could no longer resist the magnetic force of the beach and we descended to the beach from the cliff. The beach is quite clean and unspoiled despite a lot of tourists flocking to this place. There were both domestic and international tourists here. The sea, however, had strong current and big waves. We only got knee deep in the water and didn’t risk going any further. We then had a walk along the long stretch of glorious sand. Overall it was a refreshing experience.  

Before embarking on the journey, I had made up my mind of sampling the local cuisine with the primary focus on seafood. If one is a seafood lover they simply cannot resist the fish delicacies found here. At night in Varkala, I had prawns masala served with rice and also a portion of steamed butterfish in banana leaf. No wonder I was treated to a gastronomical delight.

We reached Bengaluru back in the early hours of Monday morning. The trip was a much-needed break from the daily routine with sun, sand, seafood, and serenity.  

Sunday, 3 September 2017

Shoe dog by Phil Knight

Shoe dog is a memoir by Phil Knight, the co-founder of Nike. I've completed reading the book and have to say the book is simply terrific. It recounts how Knight and his team went about building the company from scratch and how they faced insurmountable challenges and obstacles all along the way. The book is so engrossing that you feel that all the events are unfolding right in front of your eyes.

I loved this book because it gives out a message that if you have the determination and the grit to achieve something then you will definitely sail through. The author being an accountant also brings in accounting concepts such as assets equal liabilities plus equity. I got curious about these concepts and ended up watching youtube videos and had a fruitful discussion with my father who is from a financial background.

The book produces valuable messages throughout the book. The message on the art of competition was one that hit me really hard. Knight goes on to explain that the people who succeed in the competition are the ones who master the art of forgetting. You need to forget your past, your pain, and your doubts and most importantly forget your limits. Another key takeaway from the book would be the way Knight describes his internal chant: fail fast. He explains that when Nike's team were about to take terrifying risks they always had it in the back of their minds that they might fail. They only hoped that they would fail quickly so they would have enough time to implement all their hard-won lessons.

It's not short of quotes as well. Here are some of my favorite quotes:

  • "The man who moves a mountain begins by carrying away small stones" - Confucius. It reminded me of Dashrath Manjhi 
  • "You could do all the running it takes to keep in the same place. If you want to get somewhere else, you must run at least twice as fast as that" - Lewis Carroll
  • "The cowards never started and the weak died along the way -- that leaves us"
Overall it is a book not only meant for entrepreneurs but also for any person that has the willingness and endurance to turn a dream into reality. The memoir is guaranteed to get you inspired.

Sunday, 2 October 2016

Moto X Play browser lag



Ever since I updated my moto x play to marshmallow, I started experiencing lags in my browser. Initially, I thought it was chrome issue but even other browsers such as firefox weren't smooth.

Websites such as wikipedia started crashing. This was quite annoying as all the other apps were running fine. I googled the same and found that several users faced the same problem. I scrolled through a lot of forums. Some users had suggested a fix. The fix didn't involve rooting and stuff which could have made the warranty void, rather it was a simple workaround.


The steps of the workaround are as follows:

1. Go to settings.

2. Click on 'Accessibilty'(Located at the bottom).

3.  Turn off all the accessibility services such as moto voice etc.

The fix has a good success ratio.

Sunday, 13 September 2015

The stranger - II

“Let’s get on with the journey.”

The bus was halted as Raghu had once again witnessed the mysterious man. The driver was all set to start the bus when he saw the huge rocks tumbling down the mountain. Raghu was beside the driver. They both were shell shocked to see the landslide right in front of their eyes. Landslides occur when the gravitational force exceeds the strength of the materials that compose the slope. Landslides can be initiated by rainfall, earthquakes, stream erosion, or a combination of any of these factors. But, at the moment Raghu and the driver could only manage to witness nature’s fury with disbelief.

The road which had existed a few minutes was all gone now. The thundering sound of the landslide had woken up the other passengers of the bus. They were all shocked to see the terrible sight. This had happened in the month of August so rainfall could have been one of the reasons for the initiation of the landslide. All the passengers were now gripped with fear. However, the onslaught of nature stopped at a few meters away from where the bus was now standing.

“We’re very lucky,” said a passenger with trembling fear.

“Let’s get out of here as quickly as possible” came a voice from the backseat of the bus.

“I know of an alternate route. It is a long route but we are left with no other option.”
The driver drank some water, regained his composure and they again set out. He didn’t want to waste any more time as that area was prone to landslide.

 Raghu, meanwhile, couldn’t believe that a few minutes of delay had saved them. He had got off the bus for just a few minutes which was the reason why they were still alive.  He cleared his mind of these thoughts and took out his phone. He contacted the police helpline and gave them details of the landslide. No other passenger could sleep till they had reached the destination. 

Raghu had desired to take the day off after a strenuous journey but impending work meant that he had to report to his office. The bank staff would gather at lunchtime to share their day’s work, the new policies that were being implemented, and also discuss their day to day life. Raghu narrated the landslide incident and how lucky they were to escape the predicament unscathed.

One of his co-workers, Sanjay said: “You should seek the blessings of the god.” He then told him about a nearby temple which was quite popular among the locals. Raghu wasn’t a very religious person but, nonetheless, he believed in gods. He accepted his friend’s invitation to go and seek the blessings once their work was done.

Raghu and Sanjay both set out for the temple. It took them some time to reach the temple.  Like all other temples in Goa, this was also beautifully carved. The temple was empty barring the priest and one more devotee. The devotee was an old man supposedly in his 70’s. He was a regular visitor and came to the temple every day.

 Raghu walked up to the idol and just as he looked at the idol he stood there frozen. His expressions changed rapidly. He was astonished. The other devotee who was present there looked at Raghu and said” I know what you’re feeling right now. I have also passed through the same disbelief and amazement. I’ll tell you a story and maybe that will help you to feel better.”

The old man started narrating the story. The story was set in the 1960’s when the devotee was a young man and had lost his way while coming back home at night. He was very scared and frightened with hardly any street lights. The jungles were very dense and he wasn’t able to navigate properly. Then he saw a tall person whose description was exactly the same as that of the stranger who Raghu had witnessed. The stranger carried a long bamboo stick. He told the frightened youth that he is the guardian of the village and there is no need to be scared of him. He also told him that he likes to move at night and provide protection and keep vigil over the property of his devotees. This was the reason why his sandals get worn out. The youth had no other option than to trust him. The stranger then guided him in the right direction and before he could thank him he had disappeared. The youth then told the seniors of his village who believed that he was none other than Betal (बेताळ).

Betal is considered to be the gram devata(village chief) and is worshipped in the form of warrior Shiva. He is also considered to be Shiv Sardar (warlord) in Lord Shiva’s army.

Raghu could no longer comprehend what was going on. He always considered himself to be a rational and pragmatic person. But, what had happened in the last few weeks had shaken him. The drums beating(Shiva’s damru), the appearance of the man, the delay which saved them from destruction when he tried to approach the man.  All these things were now making him uneasy.

He then stepped out of the temple and checked the watch. It was 8.30 pm. He had got so engrossed in the old man’s story that he couldn’t keep a count of the time. The temple was now closed. He had many unanswered questions in his mind. He now felt that the world around him had turned blank.

As he was about to start his journey back home he saw the stranger again waving his hand and smiling at him. The stranger then moved in the direction of the dense jungle.


---Tejas Ekawade
The article was first published here.

Note: While this story is a work of fiction, Betal temples do exist in Goa. Also, some old villagers claim that they have seen a tall figure moving in the village late at night. It is left up to the readers to infer their own conclusion.

Friday, 11 September 2015

The Stranger - I

The article was first published here. 

Raghu Bandodkar was an honest and upright bank officer. He had recently been promoted to the post of the senior manager. Even though he was just 35 years old, he had made great strides in his career by working earnestly. However, he had to travel a lot and that meant passing through the meandering Goan roads. He had to visit the Bicholim office every week.

He would board a non-AC bus for Bicholim at 11.50 pm every Sunday. Six hours were needed to reach the destination. Raghu was accustomed to sleeping on the bus. While some people complained about traveling by bus at night, he had no such qualms. Raghu would sleep tight.

Traveling to Bicholim had become a routine. The driver of the bus knew him well by now. Raghu didn’t know what was in store for him in the near future.

Next week somewhere around midnight during his journey, the loud beating of drums woke him up. But to his amazement, he could no longer hear it once his eyes were wide open. ‘It’s surprising that anyone will want to play drums at 3 am’ he thought after checking the time on his watch. A cool breeze swept the bus and the night insects started squeaking ferociously. He closed the window, but that didn’t reduce the intensity.



 As the roads were lonely at that time the bus moved at quite a speed. What surprised Raghu more was that just as the bus was about to enter a mountain pass, the speed drastically reduced. It is obvious that while entering a road full of twists and turns the speed should be reduced, however driving at 5-10 kmph made no sense. He glanced out of his window. A very tall man with a long beard appeared out of nowhere on the road. He started waving his hand towards Raghu. Raghu was perplexed. Even in the darkness he managed to see that the man was wearing torn out sandals, carried a sword, and had a very muscular physique with no shirt on. The man was smiling at Raghu. It sent a chill down his spine. After the bus passed the mysterious man, the night insects stopped squeaking.

A day or two after working intensely he didn’t remember about it until the same thing occurred the next week. The same man in the same attire and at the same time was there on the road. The man again started waving his hands. This time Raghu looked around to see if anyone was awake. No one was.
He walked up to the driver and asked if he had seen any person on the roadside.  The answer was negative. ‘How could the driver miss the man?’ He then glanced at the speedometer. It showed 40kmph.  ‘How is this even possible?’ The bus was moving at a snail’s pace and the speed was 40kmph. He began to wonder whether he was actually awake. He went back to his place and fell asleep.

This continued for several weeks. During his commute at night, he would see the same man waving at him at the same place. It had now started bothering Raghu. To his surprise, none of his co-passengers seemed to notice this man.  Was this some paranormal activity or was his brain playing games with him?  Or was he just simply dreaming? He even searched on the internet for solutions. Some experts said that this scenario pertains to the realm of mind consciousness. Some said it was because he was under stress, but nothing could decipher the mystery.
He finally decided this was enough and would halt the bus next time when he sees that man.

Next week, again he unintentionally woke up at 3 am. The speed of the bus reduced as usual. Today he spotted the man from a long distance and told the driver to pull over for a moment. Just as Raghu got off the bus the man started walking in the opposite direction. Raghu called out for the man, but his calls went unanswered. Following the man at this time wasn’t a good option. He was thinking when the driver interrupted his thoughts by telling him that he should get on the bus. Raghu got on the bus unconvinced.
“Sir, there was no man on the road. I was calling out for you for the last 15 minutes.” 
“15 minutes. That’s impossible I was down there for only a moment.”
“No sir. Anyway, let’s get on with the journey.”

What happened next astonished them all… 

To be continued
---Tejas Ekawade