Showing posts with label Machine Learning. Show all posts
Showing posts with label Machine Learning. Show all posts
Well, last year I thought it was the block chain technology which is going to dominate in future but soon I realized that it is the Machine Learning and it's sub branch deep learning.

Why Machine Learning Now

Why it is so important?

Have you heard about the Google's Self driving cars, it's the future. It's not just car, trucks, or any vehicle which will pickup something from source and deliver at the destination without any manual intervention. Humans can track or monitor it. Uber, Lyft they all will be in loss, once the self driving cars are out.

How those are working, In simple terms Machine Learning, how to drive. It identifies the signals, it identifies the crossing paths, animals, humans, and most importantly the difference.

Is there anything else which is live?

Yes all the smart speakers (Siri, Cortana, Alexa, Google assistant), all of them uses the Machine learning. It learns the routine.

Have you ever used YouTube Autoplay?
Have you ever wondered why YouTube/Netflix/Amazon recommends a video?
Have you ever seen a book or a thing you may buy in next week or month or so, is recommended to you?
Your loan application result also determined by the same concept.

Not only these and many more in our life is now uses this technology. It's never late to learn a technology. Better late than never. Welcome to the world of Machine Learning. Let's continue with python programming basics. 
Usually every programmer will start with "Hello World!", but for a change lets start with numbers. I personally believe that numbers play vital role than alphabets.

Numbers
For someone who worked on other programming languages, it will be surprise and shock, since python doesn't have a concept called Variable Declaration.

For new beginners, Variable declaration is a technical way of saying the data type for a variable. Let's go with an example.

In Python 2.x,
In Python 3.x,
If you look at both the examples, there is a very minor change. Let's not worry about it now. If you see the variable 'x', we didn't define what kind of value it is going to hold.

We assigned the value of x to 1, we are printing it, and we are also printing the (data) type of x. In the last line we are printing both the type and value of x. The output will be like this:

Output of Numbers
If you look at the output, python understood that the variable 'x' is of type 'int', even though we didn't declare the variable with the data type 'int'. There is no semicolon at the end of the lines (some language tend to have that semicolon at the end of each line).

Another observation from 2.x and 3.x is the open and close brackets. Python 3 has more explicit way of passing the variables, where as Python 2 doesn't have this. This is one among the different between 2 and 3. Here after all my codes will be Python 3, as I mentioned earlier in the post.
Well, I don't think you need any extra prerequisite other than understanding simple English and a computer with you (preferably with internet connection) to access the source codes and you can move from there.

Python Pre-requisite for Machine Learning
When I started Learning, I started with python, but I realized its so boring since I already know other languages and it doesn't need any challenges in creating the Python scripts. I also got into the puzzle of Python 2 vs Python 3. I started with Python 2 (yes old golden days, where we don't have conflict to choose version), I left it in half and I continued Python 3 in later 2018 for fixing a not working script written in python.

I finally ported those codes to C#, and created "exe" for running on Windows Machines. I don't want to create an environment with every customer to have python installed. But there is a way, where you can convert your Python codes to Windows executable. There are couple of options, Py2exe and PyInstall . Both of them are easy to do, but I personally don't recommend creating executable from python, well that's my personal preference.

Am planning to cover some of python programs in order to complete our machine learning with more clarity. You don't need to know much but at least this. Most of the scripts I have taken and modified it from Stanford University Lectures for CS228 and CS231n. 
With Windows computer, you can still choose other famous IDE's. The first one I recommend is Anaconda. It has Spyder, Jupyter and Many more. I personally recommend using Jupyter notebook for interactive programming.

Anaconda Distribution for R, Python, Jupyter, Spider, NumPy, SciPy, TensorFlow, pandas

Pycharm is another IDE which I used earlier, this is good for Python.

PyCharm - Python IDE for Professional Developers
Jupyter supports other programming languages including R, Scala and almost 40 languages.

In fact all of them are available for free. Some paid versions also there, for personal use we can stick to the free version.

When it comes to Python Language, you don't need to know any other languages to start with. It's super easy and user friendly. Python is built on top of C, and C++.

Python eliminates the variable declaration part. We can see more about python programming in my next post.


Since Microsoft Visual Studio Code and Visual Studio 2019 both of them are available for free, you can choose whatever you are comfortable with.

Visual Studio Code doesn't have any inbuilt compilers (you need to install different compilers if you want to run any of the other language), on the other hand Visual Studio 2019 comes with compilers for bunch of languages (C, C++, C#, and many more based on selection). When you get something extra, always you need to have more storage.

Visual Studio Code is a light weight editor, and takes very less space for doing our Machine Learning with Python.

Go to the URL: https://visualstudio.microsoft.com/downloads/

Download and install the most comfortable (for you) software. Community Edition is free and comes with lot of perks including online access. You can register for Microsoft account.

MS Visual Studio Code vs MS Visual Studio 2019

Installation process is so easy, just press next wherever you see that option, when it provides check box for selecting environment select python for Visual Studio 2019. Visual Studio Code leave everything in the default state. We are not playing with configurations now.

If you want to download on different machine and install it on different machine, you need to follow a different process.

Once you download the Visual Studio Installer, (vs_community.exe), you need to run it with command prompt. Do not download anything you don't need it, because the entire package is almost 30 GB.

vs_community.exe --layout c:\vslayout --lang en-US

Add anything you want to be added as parameters, for example the below parameters lets you to install C++.

--add Microsoft.VisualStudio.Workload.NativeDesktop --includeRecommended

I have added .NET desktop development and Python.

Python Development in Visual Studio

Select whatever you want along with this, if you have already installed VS you can just go to the Installer, hit of More -> Modify and select this option to install.

I learnt C program and their concepts by actually writing it down on a piece of paper and then later on computer, when it comes to machine learning, most of them are concepts.

Machine Learning - Theory vs Practical

The actual piece of work can be written in a line of one or two (that's the reason we choose python). Before even debating whether theory takes priority or practical takes priority, lets focus on why we need machine learning?

People tend to write programs for everything they want computer to take care of. In technical world, this process is called automation. Anything that can be automated can be automated in IT industry. But there comes a situation, when it cannot be automated.

For example, If I give you a picture of cat and picture of dog, how do you differentiate both of them?
In order to identify the difference, you will ask lot of questions about its characteristics.

1. How big it is?
2. How is the skin?
3. Does it have legs?
4. How many legs does it have?

Can we answer with these 4 questions, the answer is NO. We need more details and we need to learn from the previous answers. Even if it is technically possible to write all the possible questions and come to conclusion, but all the efforts will be wasted if I put another picture of Mouse, and ask you to choose, what is Cat, what is Dog and what is Mouse. The problem is choosing the feasible way to teach machines to understand our thinking behavior based on previous analysis.

How a child learns?

The kids learn based on watching, listening, thinking and then uses the same pattern to analyze things. The same way, we are training the systems, we are providing guidance using algorithms to get the best output, cross verifying the results, and providing the feedback to the system. In that way, the machine increases it learns. I believe that now you might have understood, the process of making the computer to learn and think based on learning is Machine Learning.

In real world, Self Driving Cars, Personal Assistants (Alexa, Google, Cortana, Siri), Product recommendations (Amazon you might be interested in, Netflix recommended for you), Search Engine results refining (How google sends results and advertisements), Chat bots (If you message any company support, it will answer based on its learning experience), and many more. Will see one by one in detail later.

Well, the best way to learn machine learning is doing it in parallel and put more focus on the concepts. Because, once you are aware of the concepts you can implement it in any programming language you want.
Artificial Intelligence is one of the domains which is going to rule the IT field for at least some decades from now on, it could be in various forms Machine Learning, Deep Learning or whatever.

Artificial Intelligence vs Machine Learning vs Deep Learning

Machine Learning

Recently started taking various courses related to machine learning, most of them explains in a very complicated way or at least complicated to me to understand whatever they are trying to convey.

I found lot of free courses and paid courses for the same. Finally I understood what they tried to explain. Let me try to put it in a simple way.

This is my scribbles based on my understanding, it may not be true!

Before learning about I think it is always good to learn the basics about mathematics (yes, the same maths :( ), refresh the hands-on over python (Not the snake, its the programming language) along with various packages (or libraries or tools or whatever) like Numpy, Scipy, Pandas, Scikit-learn, matplotlib, pillow and others as required.

I saw lot of people uses different set of tools, languages, for their tasks. I tried using C, C++ , Matlab (yes you can perform machine in almost any language you are comfortable with) but I felt easy with the following options.

1. Windows 10 OS [was Available for free, you can even use Windows 7]
2. Microsoft Visual Studio 2019 (Yes, its working with 2017 as well) [Community Edition is free] [Alternatively you can use Visual Code as well]
3. Python and its packages [Easy to write code (very less numbers), good for beginners and its free]