Week 1
What is Machine Learning - Simplistic View
  Automating automation
  Getting computers to program themselves
  Writing software is the bottleneck
  Let the data do the work instead!
What is Machine Learning – Technical view
  Machine learning is an application of artificial intelligence
  (AI) that provides systems the ability to automatically learn
  and improve from experience without being explicitly
  programmed.
   Machine learning focuses on the development of computer
    programs that can access data and use it to learn for themselves.
  Machine learning is a method of data analysis that
  automates analytical model building. It is a branch of
  artificial intelligence based on the idea that machines
  should be able to learn and adapt through experience.
ow is different from AI
Artificial Intelligence is the broader concept of
machines being able to carry out tasks in a way that we
would consider “smart”.
Machine Learning is a current application of AI based
around the idea that we should really just be able to
give machines access to data and let them learn for
themselves.
ow did it all Begin….?
credited to Arthur Samuel in 1959
Why Teach them everything….?
 Why not let them learn for themselves
  ○ Far more efficient
  ○ Far more effective
Vast e- info available
 Code them to process and learn from that info
 Code them to think like humans and adapt and learn
 continuously
Machine Learning – Pure Convenience with
 ccuracy
 By using algorithms to build models that uncover
 connections, patterns, organizations can make better
 decisions without human intervention
 Learning is used when:
   Human expertise does not exist (navigating on Mars),
   Humans are unable to explain their expertise /Black-box human
    expertise (speech recognition)
   Solution changes in time (diagnosis, fraud detection, routing on a
    computer network)
   Solution needs to be adapted to particular cases (user biometrics,
    personalized news reader, movie/book recommendation)
uzz Words
Big Data
 Yota byte
Deep Learning
Chatbot
Natural Language Processing
Data Mining
IoT
Smart City
Where it comes from
  Machine learning is primarily concerned with the accuracy
    and effectiveness of the computer system.
                                       data
                                      mining         control theory
                         statistics
                                                            decision theory
           information theory             machine
                                          learning
                                                            cognitive science
                   databases
                                                         psychological models
                                evolutionary     neuroscience
                                  models
What this course is about
 This course aims at introducing you to the exciting and
 trending world of Machine learning and teach the
 fundamentals so that you could use your human learning
 mechanisms to learn further (as required) and apply that
 knowledge effectively for any future ML applications
 We will learn fundamental concept, some popular machine
 learning algorithms and their strengths and weaknesses
 To reinforce our learning, we will implement these
 algorithms, for real world applications, using python.
          Introduction and Significance of Machine Learning, Machine Learning
ontents   applications
          Review of Important Mathematical/Statistical Concepts
          Introduction to Machine Learning Techniques
               Supervised, Unsupervised and Reinforcement Learning
          Supervised Learning Techniques
              Regression Learning Problems
              Regression Algorithms
                   Linear Regression
                   Multivariable Regression
          Feature Selection
          Supervised Learning Techniques
              Classification Problems
              Classification Algorithms
                   Naïve Bayes
                   KNN
                   ANN
          Dimensionality Reduction
          Unsupervised Learning
              Clustering Problems
              Clustering Algorithms
                  K Means
                  Fuzzy C Means
ourse Policies
2 Classes (1.5 hrs ) each week for 16 weeks
  45 mins lecture (little theory and more practice)
  45 mins pure practical
   ○ Python
 We will spend first few weeks practicing the fundamental
 programming constructs in python
 Followed by a refresher on statistics (practical)
 Finally by ML algorithm implementation to solve ML Problems
shaAllah
 Attendance
 Discipline
Machine Learning – Do we really need to
 udy it?
  “A breakthrough in machine learning would be worth
  ten Microsofts” (Bill Gates, Chairman, Microsoft)
  “Machine learning is the next Internet”
  (Tony Tether, Director, DARPA)
  Machine learning is the hot new thing”
  (John Hennessy, President, Stanford)
  “Web rankings today are mostly a matter of machine learning”
  (Prabhakar Raghavan, Dir. Research, Yahoo)
  “Machine learning is going to result in a real revolution” (Greg
  Papadopoulos, CTO, Sun)
  “Machine learning is today’s discontinuity”
  (Jerry Yang, CEO, Yahoo)
op Machine Learning Application
Security                             Lifestyle
 Data Security                        Smart Cars
 Personal Security                    Recommendations
 Employee Authorization –             Online Search
  Amazon                               NPL
Healthcare                           Financial Applications
 Heart Attack identification          Trading
 Seizure and stroke prediction        Fraud Detection
 CAD, etc.                            Marketing Personalization
What is ML in a Nut Shell???
 Tens of thousands of machine learning algorithms
 Hundreds new every year
 Every machine learning algorithm has three
 components:
  Representation
  Evaluation
  Optimization
epresentation
Decision trees
Sets of rules / Logic programs
Instances
Graphical models (Bayes/Markov nets)
Neural networks
Support vector machines
Model ensembles
Etc.
valuation
Accuracy
Precision and recall
Squared error
Likelihood
Posterior probability
Cost / Utility
Margin
Entropy
K-L divergence
Etc.
ptimization
Combinatorial optimization
 E.g.: Greedy search
Convex optimization
 E.g.: Gradient descent
Constrained optimization
 E.g.: Linear programming
Machine Learning Techniques
 Supervised Learning
 Unsupervised learning
 Reinforcement
 Learning
upervised Learning
   A task of inferring a function from labeled
    training data.
   The training data consist of a set of training
    examples.
   Each training example is a pair consisting of an
    input object and an output value
   The algorithm attempts to learn from the training
    examples and predict for unseen (test) data
     Finds a model that best maps the input to output (data
      to target)
      ○ A function
     Uses the inferred model to predict for the test data
upervised Learning
The input consists of feature(s) describing the input
object and the output is the target value
nsupervised Learning
A task to find hidden patterns in un-labbelled data
Unlike supervised learning , there is no correct answers
and there is no teacher
up Vs. Un Sup
e-enforcement Learning
Allows software agents and machines to automatically
determine the ideal behavior within a specific context,
to maximize its performance
Simple reward feedback is required for the agent to
learn its behavior; this is known as the reinforcement
signal.
e-enforcement Learning
Machine Learning Problems/Algorithms
 Regression
  Predicts a continuous value
 Classification
  Predicts a discrete class label
 Clustering
  Finding a structure in a collection of unlabeled data
  The process of organizing objects into groups whose
  members are similar in some way
egression Problems
The output is a continuous value
Examples
 • The price of a house
 • The humidity in environment
 • The stock price
 • The number of people online at a specific hour
lassification Problem
  • The output is a discrete class label
  • Example
     • Will it rain today (Yes/No)
     • Which Animal is it (Cat/Dog/Horse)
     • Student Performance Category (Below, Average or Above)
     • The severity of a tumor (benign/Malignant)
     • Outcome of a surgery (Successful/Unsuccessful)
lustering Problems
     Clusters
     Associations
     Examples
       Market Segments
       Deploying Police at spots with high crime rates for
        maximum coverage and effectiveness
dentify Problem Type/Algorithm
 Predict the temperature
 Which degree a student will opt based on scores and other factors
 Identifying a fruit in an image
 What should be the speed of a self driven car on this road
 Which team will win this match ?
 How much score will my team make in the next match
 Which complexity levels should we offer a particular course at?
 Would it rain tomorrow
 Would the project start on time
 How much delay is expected in the starting of this project
 What would be the girls to boys ratio in the next session of Computer
 Arts.
 Which products should be discounted near Eid
ow it goes??
Understanding domain, prior knowledge, and goals
Data integration, selection, cleaning,
pre-processing, etc.
Learning models
Interpreting results
Consolidating and deploying discovered knowledge
Loop
ython Introduction
High Level
Open source and community driven
“Batteries Included”
 a standard distribution includes many modules
Dynamic typed
Source can be compiled or run just-in-time
simple python program
x = 42
y = 58
z = ‘Intro to Python Programming’
a = x+ y
print( a, z)
ists
compound data type:
]
.3, 4.5]
, "Hello", "there", 9.8]
se len() to get the length of a list
>> names = [“Beenish", “Homa", “Sherein"]
>> len(names)
sts are mutable - some useful methods
> ids = ["9pti", "2plv", "1crn"]
> ids.append("1alm")
                                                       append an element
> ids
 ti', '2plv', '1crn', '1alm']
>ids.extend(L)                                         remove an element
Extend the list by appending all the items in the given list; equivalent to a[len(a):] = L.
> del ids[0]
> ids
 lv', '1crn', '1alm']
                                                       sort by default order
> ids.sort()
> ids
 lm', '1crn', '2plv']                                  reverse the elements in a list
> ids.reverse()
> ids
 lv', '1crn', '1alm']
> ids.insert(0, "9pti")
                                                       insert an element at some
> ids                                                  specified position.
 ti', '2plv', '1crn', '1alm']
                                                       (Slower than .append())
ictionaries
Dictionaries are lookup tables.
They map from a “key” to a “value”.
symbol_to_name = {
    "H": "hydrogen",
    "He": "helium",
    "Li": "lithium",
    "C": "carbon",
    "O": "oxygen",
    "N": "nitrogen"
}
Duplicate keys are not allowed
Duplicate values are just fine