Sunday, May 10, 2020

Learn to CODE - 1

'Hello World'


Day by day, month by month - Automation, Machine learning, artificial intelligence, data science, etc is creeping into our life more and more. Tech companies were one of the first groups to take the most advantage of the emerging field. Looking at the impact and rewards of data analysis and machine learning, everyone wants to get into the race. 
I have been doing process automation in my organization and as a part of the next step - I am preparing myself to get into Machine learning. I have many of my colleagues coming up to me asking about how to get started with coding. There are different answers I keep giving, depending on who is asking and their past history with coding. This post is for someone the no (or very minimal) coding experience. I'll list down the major areas to look into and provide a roadmap to get started with any language.

It's a good option to start with the motivation to learn to code. This can help answer which language to learn and how much to learn. Much commercial software comes up with GUI to make machine learning models and train the same. You don't need to learn to code for that. Read on if you still want to learn to code. This can be used for automation or training your own models with custom datasets. You can start off with as little as 7 hours a week. Let's get started with the pointers - 

1. Choosing a Language -


If you haven't decided which language you want to learn - pick Python. I use javascript and Matlab, for automation at work. So, if you already have a tool you wish to work on, better pick the language it supports. Python is my current choice - open-source, many resources available online to solve the issues related to Python. Once you learn the basics of one language, it is easy to transfer it to another.

Extra reading - Find out which languages topped the annual popularity charts for the past 10 years.

2. First code - "Hello World" -


Congratulations on selecting your language - the next step is to get the installation done and write the first code. Once the installation is done the first task should be to print "Hello World". This makes sure that the installation is correctly done and you will also learn about the interface. You will understand the console, where to write the code, how to execute, and where to see the output.
You can improvise the above code by asking the user to input a text from a user and print out the same.

Extra Reading - Explore the history behind "Hello World" in the programming language.

3. Data Types - 

This is an important step. All the data stored in the program is stored in different buckets or data types. Example - Integers, Float, Strings, etc. Now, why is this important? Simple example - If you read text from a document, even the numbers are read as a string. You cannot compare that directly with another number. You need to convert the type before proceeding. Many mathematical operations are also dependent on the data type of a variable. Second is multi-dimensional data - like arrays - this is my personal favorites.

In this section, you should focus on mathematical operations like - how to add a string and a float/double.
What happens if you divide integer with a float/double.
How to index array and modify the values.
If you are in Python - then read about Lists, tuples, dictionary.

4. Control statements - 

As the name suggests, this controls the flow of your program. Based on a certain condition you can decide to execute a block of code or skip it. You can iterate over multiple items using control statements. You should be focusing on following major types - 

1. If - elseif - else
2. Switch statements
3. While - for iterations
4. for - for iterations


Example problem - take a string input from the user -
if the string length is less than 4 - Output - 'String too short'
else if the string length is greater than 4 and less than 6 - Output - 'Perfect Length'
else - Output - 'String too long'


Advance example problem - Write a code to convert decimal number to binary equivalent.

5. Functions -

These help you to repeat a task. In code, if you want to compute compound interest at 5 different places then you can reduce your code length by using functions. You create a function that will compute the compound interest. Then just make a call to a function whenever you need compound interest. Compound interest requires - Principal amount, interest rate, and time period - this will be input arguments to the function. The compound interest at the end of the tenure will be the return value of the function.

What you need to focus on - 
1. How to pass arguments like string, array, etc
2. How to return a string, array, multiple values
3. How to call a function within that function - recurring function - One of the concepts I like the most in this heading. I haven't used this much in my live codes, but I like the concept.

Example problem to be solved - Write a recurring function to calculate the Fibonacci series. The number of terms required as the output of the series - must be input to the function.


There you go - You are ready to start automating your daily tasks or learn advanced concepts. Debugging - that is a skill I guess and an essential one. Now, remember - your code won't compile or run in the first go and that is fine. The process of looking through the code for errors and rectifying is part of debugging. At times the code will run without error but the output won't match with the desired output and again you will get your debugging skills out. Don't worry now, the more you code the better you will be at debugging.

My next post will be on writing code to generate the Fibonacci series in Python. I will also write a code to convert a decimal number to a binary equivalent.


Drop-in your experience, feedback, and comments. Also, write about the topics that you want to learn more about and I'll write a post for the same.

Exit()



Friday, May 1, 2020

2019 - A year of Rejections

My last proper post was in October 2019, almost 6 months back. I wrote my last 7-8 posts from Chennai and Mumbai airport. I use to travel to Mumbai every alternate month. In January I wrote a short blog on the installation of some python modules (it got only one read). I had flight tickets for Mid March and I decided to write this post in 2019 on that trip. Covid - Corona - etc lead to restrictions on travel and I canceled my trip and this post too. Anyway, finally, the time has to pen down my thoughts on the year that was. The next post may be on lockdown experiences.

When December started, I tagged 2019 as a year of rejections and I wanted to post all the details about it. When 2019 ended I was so so determined to change things and make 2020 as so-called - MY YEAR. I celebrated my 30th birthday last month, an event that led me to think that I'll be making a big impact in 2020.

February - Valentine - Proposed my crush and never heard from her since that day. I had like more than 5-6 crush when 2018 ended and few of them were yet to be married. By the end of 2019, all my crushes had got married and it was time for me to move on :P

My Marriage - Same story like a year before. Most of them wanted a guy settled in Mumbai or US/UK. Anyway, I got the chance to meet a few of them face to face and obviously, things didn't move forward. People can call it anything - I rejected her, she rejected me, mutually rejections, family rejections, compatibility issues, horoscopes not matching, etc. Bottom line - It was one of meet.

Feeling stagnant at my workplace, I started looking out for higher studies. I applied to couple of Institutes only to get rejected in the first round. This was a hard blow and it took me some time to come to terms with the decision. If this was not enough, I rejected something soon after. I was offered a chance from the company to pursue a course in data science, but I didn't find it too promising and rejected it. From then and now my perspective has changed. The ground reality has changed too. I am still looking to study even more but more focused on my strengths and hobbies. Maybe I should have worked more on my statement of purpose to get an interview call. or maybe I should have accepted my company's offer to study - I don't know. What's done is done and accepted.

Jobs - Let me not shy away from this topic. In early 2019 I got an opportunity to interview for a few jobs. One was in auto-sector, not 100% what I was looking for but still, it would have been a decent change for me. Where things failed - they found me too expensive :D
The second was a startup, focused on android app development. I was more interested in this because it was a startup and aa core programming job. What I liked the most is the hiring process. Two co-founders put forward a puzzle and asked to write an algorithm to solve the same. They liked my approach and then big BUT in this case was the joining period. They wanted me to join in a month but that was not possible at all.
The BEST outcome of those two rejections - I got promoted to the Manager band, got a chance to work on a machine learning project. I also presented my first ever paper after coming to the corporate world. I am really happy the way Mahindra is managing us in this condition of lockdown. The IT and HR teams rose to the occasion and went 10 miles more than their normal call of duty. It is times like this that help me connect to Mahindra on a deeper level.


I think these were the biggest letdowns of 2019. 4 months have passed in 2020 and I am not sure what to label it. I miss being with the family in this lockdown and I don't see meeting them for next two months. If it wasn't for the lockdown, I wouldn't have learned to cook or manage groceries, etc(more on this later).

So far in my posts, I have tried to be selective of what I share with my readers. I am trying to open up a bit more with each passing post. I am sure this will be reflected in my writings in the future. My Whatsapp statuses used to get 100 views before lockdown and post lockdown it has been 140+, a 40% increase in the viewership. I expect the same for this blog post too.

Keep Reading!