Saturday, 28 October 2017

MACHINE LEARNING AND ITS LIFE-CYCLE

MACHINE LEARNING–WHAT, WHY & WHERE

Before we go into the details of Machine Learning, it becomes very important for us to understand its need and the approaches used previously to address these needs, but, failed and now, how they are fulfilled by Machine Learning.
Algorithm is a process or set of rules to be followed in calculations or problem- solving operations on an input and produces desired output. Any problem, easy or complex can be solved with the help of algorithm. But, there are scenarios where input data is large, complex or unstructured that it becomes very difficult to write algorithms for them. Some common examples are to filter the spam emails, to find the information from images and videos, to predict customer behaviour, to diagnose the diseases and the list goes on. This is where the Machine Learning comes to the rescue. It takes the past experiences or datasets as input, extract useful information from it and then apply a set of complex rules and different models so that a usable output can be achieved.
For example, in case of stock Market, using the historical datasets, we can try to predict if particular share is going to be profitable or loss making. It’s easier to diagnose a disease which otherwise would have been very difficult using trial and error. Some other examples where Machine Language is used are:
  • Image Recognition
  • Face Recognition
  • Anamoly Detection
  • Medical Diagnosis
  • Search Engines
  • Handwriting Recognition
  • Financial Services
  • Crypto-currency


In short, Machine Learning helps us in solving many complex real world problems by taking past experiences as input and provides good future prediction.


Life-Cycle of Machine Learning

The process of Machine learning can discussed with the below figure.

1. Problem definition: First step is always to define the problem and then determine if Machine Learning can be used to solve it or not. 

2.Data Preparation: Once problem is defined, data is collected from the source systems and transformed into consumable files. This is the most important part of the Machine Learning as it helps to convert the raw data collected from different sources into useful information.


Steps for Data Preparation:
The raw data might contain the data which is not useful and hindering the ultimate performance.  More the accurate data, more the prediction will be accurate.
  • Firstly this raw data should be formatted in some format like csv files, database with headers, so that using the python libraries like ‘Pandas’, it can be stored as data frame and it became easy to operate on different rows and columns. The Pandas, sklearn libraries in the Python is very useful in preprocessing of the data.
  • Now, we can perform the different operations on these data-frames which hinder the performance like the unwanted records need to remove from the datasets, replacing and removing of missing data, encoding of categorical data, feature extraction (using only specific data from the dataset).
  • Then, the above processed data is divided between testing and training dataset generally in ratio of 40:60 or 30: 70.

3. Data Modelling: Different algorithms that can help in resolving the problem are identified and applied on the training dataset to prepare a predictive model with the highest accuracy possible. Once the model is ready, it is applied on testing dataset to evaluate the performance.
Data modelling usually is an iterative process. There are very high chances that model may not produce expected results in the first run. Hence, if the outcome of testing dataset are not as desired, model is reevaluated. Sometimes performance is fixed by tuning the model parameters and in some cases model is rebuild. This process continues until we desired outcome is achieved.

TYPES OF MACHINE LEARNING

There are three types of Machine Learning. Let’s discuss in brief about them.

Supervised Learning

The type of learning in which prediction is made with the given attributes or features of the dataset. The goal of supervised algorithm is to analyse the training data-set and generate a function that maps the input values with the desired output values. This training process with the given input will continue until the model or algorithm start demonstrating good performance.

Supervised Learning can be divided into two types on the basis of desired output variable.

1. ClassificationTo predict and label the output as category. For example - 
  • Knowledge Extraction: To divide the customers in a bank into ‘high risk’ and ‘low risk’ categories for the purposes of identifying the loan or credit card eligibility. 
  • Message filtering:  To filter out the malicious emails and flag them as ‘spam’.
  • Medical Diagnosis: Diagnose the patients with the help of their symptoms.
  • Recognising a person on the basis of his handwriting, face or speech.
  • Weather Prediction
2. RegressionRegression Learning have continuous, numerical value as their output.
  • To find out the number of mangoes in a basket of different fruits.
  • To predict the approximate salary of employee in an organisation based on the qualification and number of years of experience of the employees.
  • To predict the age of the person on the basis of its height and weight.
The different types of Supervised algorithm used in Machine Learning are:
  • Linear Regression
  • Polynomial Regression
  • Logistic Regression
  • Decision Tree
  • Random Forest
  • Naïve Bayes
  • Support Vector Machines
  • Kernel SVM
  • K-NN

UnSupervised Learning

In this type of learning, we only have input data available without any corresponding output variable to achieve. There is very little idea of the result or no prior prediction in unsupervised learning.

The categories of the data are unknown in unsupervised learning. The aim of this learning is to identify the regularities, structures or patterns in the data and divide the data among similar groups in order to learn more about it.

The unsupervised learning can be achieved through ‘clustering’. The goal of the clustering is to find out similar patterns or clusters in a given input. For example, to find the customer behaviour on the different products launched in the market. It helps to analyse the market value of the product and help to maintain customer relationship by providing good service.


Unsupervised learning also helps in face recognition from the image based on the pixels, colour, size etc.


Thanks all for reading this blog!!

You can find more information on these topic from the below reference which help me to take knowledge before writing this blog.


Sunday, 8 October 2017

Data Mining, Artificial Intelligence, Machine Learning- Get towards Learning

The terms Data Mining, Artificial Intelligence (AI) and Machine Learning are among the most widely searched topics on the internet. Their usage is widespread and used across various industries ranging from finance to healthcare. But, there is always some confusion on how are these terms related to each other conceptually. Let’s take a deep dive into these concepts one by one starting with Data Mining.

Data Mining

Conversion of raw Data into Useful information so that it can help the end-user in taking the decisions.
Lets’ discuss the cycle followed by Data Mining.
  1. Data Requirement: For any analysis of problem, related input is required which present in the form of raw data. This data may be numerical or categorical.
  2. Data Collection: The raw data can be take out from different sources like throgh online engines, stored directories etc.
  3. Data Processing: Before analysis of data, it is important to organised data or placed data in some stored format like in excels, database, or using some software.
  4. Data Cleaning: Now, this raw data contains such type of data which is not useful for the analysis and make the analysis more complex like, duplicates, unmatched, inaccurate records, fake data. These should be cleared before going forward.
  5. Data Analysis: Now, the data is ready for analysing and understanding. There are different problem solving, statistics, mathematical algorithms; programming languages which are applied to actually understanding the information present in this data. 



The applications of data mining are very vast. Artificial Intelligence and Machine learning are also one of the parts of Data Mining. It is also very much useful in Business for analysing Customer behaviour for different products, analysing feedback of the customers, searching online etc. We have one very common application of Data Mining which is using all over the world is Google Search.

Artificial Intelligence
  • Smartness
  • Intelligence

Both these behavior are provided artificially to the machines or computers.

How we can achieve AI?? Big challenge!!

Several Technologies are already created and still in research so that it become easy for machine to behave intelligently. Some of the common technologies which make the AI the most searched and hot topic in today’s world are:

  • Machine learning:  Implementation of different algorithms on large dataset through continuous learning in order to make prediction.
  • Natural Language Processing: It helps the machine to understand the human behaviour and language.
  • Perception: Machine takes the input in form of signals or we can say using different sensors. And the most common example in this are face, speech, Handwriting Recognition.
  • Robotics: provided intelligence to Robot. Combination of Computers, Mechanical, Electronics. Intelligent robots adapt to new environment and learn from their mistakes.
  • Reasoning, Problem Solving: AI increases the execution speed of complex programs by solving the complex problems. 
  • Planning and Scheduling

The AI is used in every sector whether it is Healthcare for Medical analysis and diagnosis, Automation or Finance. It is also used for entertainment purpose. Thus, we can provide intelligence to AI by different ways like Learning, Perception, problem solving, Reasoning (taking, judgement, decisions, predictions).

There are various Algorithms which are mostly used in AI are: Neural network, Fuzzy Logic, Heuristic Approach, Genetic Algorithm, different algorithms of PERT/CPM.

Machine Learning

Machine Learning is the successful approach of Artificial Intelligence or it is one of the methods of Data Analysis in which computers will able to learn and predictions can be done through the data.

The Core principle behind Machine learning is that machines takes large data sets and apply algorithms so that machines learns and make predictions with least error. It means prediction using ML improves with experience.

The algorithms are used to find the pattern from the given information of data in Data Mining, but, Machine learning has the extra ability to change the program behaviour after learning thousands of times and so it makes good prediction with least error.

The common applications where machine learning used are presented in the figure.
In Image recognition, the machine can predict from the data set of pictures and after many repetitions, the machine will able to learn which type of pixels are using and can make good predictions from the images.

Thanks all for reading this blog!!

You can find more information on these topic from the below reference which help me to take knowledge before writing this blog.



Sunday, 1 October 2017

BASIC PYTHON LEARNING- PHASE 1

Before going towards learning of Python language, It become important to know the Applications of Python. And, I try to cover most of the applications in below figure😃.




Now, let start with learning toward python language:

VARIABLE AND DATA TYPES
  • Variables are used to store values in reserved memory locations, means memory can be saved when variables are created.
  • It can be local or Global.
  • Local variables are declared inside the body of function and it can be limited to this function only, can’t access outside.
  • Global variable declare outside and can be accessed from anywhere.
The Data types used to stores value in Variables in Python are of different types as shown in below Figure:


Let’s discuss all data type in details with Programs:

1.       Numbers:
      These data type store numeric values which are immutable. It means if we change the value of data type number, then it will store as new object in memory.
There are 4 types of numbers: signed  integer, long integers, floating point integer, complex numbers.
In spite of above, there are some mathematical functions also.
1.       Random functions
2.       Trigonometric functions
3.       Mathematical Functions
2.       Strings:
Characters in single or double quotes
No character in Python, String of length one is Character only.
Strings are also immutable.
There are different operators used in Strings. Some common operators are concatenation (+), replication (*), in, not in operators, relational or comparison.
3.       Lists:
Different type of the data can be hold at a time.
List can be represented with elements and these elements can be accessed and retreived using index.
Index can be 0 to n.
All elements are separated with comma and enclosed with closed bracket. This represent the list.
Elements can be added and deleted from the list. It means new list will not create every time when we changed elements and its values. Thus, mutable.
+ and * operators can also be used in lists.
There are some common functions and method used for Lists are max, min, len, cmp, index, count, insert, remove, sort, reverse, pop, extend.
4.       Tuples:
The first 3 points are same as list.
But tuple enclosed in parenthesis ().
Tuple are immutable, can’t change the value of elements. Data safe in tuple due to this.
+ and * operators are also used in tuple.
Delete operation can be performed in tuple.
There are some common functions and method used for Lists are max, min, len, cmp, index, count, insert, remove, sort, reverse, pop, extend.
Fast Processing  in tuple.
5.       Dictionary:
Key value pair separated with colon(:)
Dictionary enclosed in curly braces {}
Keys are unique, but not values in dictionary
Updating and Deletion are possible using keys. Means dictionary are immutable.

OPERATORS IN PYTHON




FUNCTIONS IN PYTHON
  • Function - Reusable code -  written once and whenever required use it in Program.
  • We call Function as subprogram, part of program
  • Eg: some built in function like print(), close()
  • Def: used to start the function followed by function name and then parenthesis
  • Parameters can be passed in these parenenthsis  which acts as argument or parameter
  • But parameters must be variable, while argument can be variable, literal, expression.
  • Function must return to send back the control to the function and exit from it.

def employee(id, name):
{
Print id
Print name
return
}
employee(id=1, name=’isha’)
employee(id=2)

Arguments in Function
  • Positional Argument: Order and number of argument must match with argument passing in Function. Like for subtraction of two elements, both value should be present. If one is missing, function will not return anything while calling.
  • Default Argument: provide default value to the argument, eg: name=’akansha’ in above program.  def employee(id, name=’Akansha’)
  • Keyword Argument: During calling of function, argument must matched with function on basis of parameter name.
                employee( name=’neha’, id=6)

PYTHON INPUT & OUTPUT

Input and Output are used for reading and writing. There are two built in function used in Python which takes input from Keyword or which user wish to give.
  1. input()- Any expression is given as input by user.
  2. raw_input()- input is always in the form of string. Thus, this function always returns String. But, typecasting can be used to convert it into some another form.
Handling of Files:
  • A file can be used to store and retrieve data.  Firstly the file should be open before reading and writing in file using the method open(filename, mode, buffer). Once Operation on the file is done, file should be close using the method close().
  • Read() method is generally used to read data from file and write() method to write string into file.
  • There are some other methods also in File handling: mkdir, chdir, rmdir, rename, remove, getcwd, tell.
If anyone wants to see the real time implementation of the above Python tutorial, You can visit my link:

https://drive.google.com/drive/folders/0Bz02Fv4ao4_4NWpIVERqOG5zQ00


At the last, I sincerely thanks the sources JavaTpoint, TutorialPoint, Python.org which help me to learn the basics of Python and also Python 3.5 IDLE which help me to gain practical experience by Coding.
1. https://www.javatpoint.com/python-tutorial
2. https://www.tutorialspoint.com/python/
3. https://docs.python.org/3.3/library/functions.html


Thanks all for reading this blog !!










Monday, 25 September 2017

PYTHON JOURNEY


Python and Java become the most dominant and versatile IT languages in today’s world. 
Luckily I am working on the Java. But, apart from that Python future in IT sector and its features attract me to start working in this area.

But big question 💬 which  I ask myself how to start learning ?? and meet the expectation of organisations who demand the good hand’s on experience on Python😱.

Then, I started thinking about my educational background, so that I can utilise my knowledge in fast growing world 😌.

As I completed my Masters in Robotics and Automation, so how is the idea?? to utilise all my bachelors and Masters knowledge in this. 
There are various subjects which I go through in my career are operation research, Mathematics,  Machine Vision, Robotics and lot more. These all subjects may help in getting the knowledge of Machine learning algorithms.

Python + Machine Learning = How is the Combination ??

Sounds quite tough, at least for me 😨.

I know it is quite difficult to learn and mainly to implement it. But, let’s give a try, I hope my Basic Java Knowledge and my Educational background help me to succeed in this field 😐.


Better to try at your level best, May be I succeed !!