0% found this document useful (0 votes)
60 views

Machine Learning Notes - Lec 03 - Gender Identification Using Scikit-Learn

The document discusses gender identification using machine learning. It describes the three phases of machine learning: training, testing, and application. In the training phase, a model is trained on labeled training data. In the testing phase, the model is evaluated on labeled test data. In the application phase, the trained model is used to make predictions on new, unlabeled data. The document outlines the steps involved in each phase of building a gender identification model using Scikit-Learn, including preprocessing data, training algorithms, evaluating performance, and making predictions on unseen data.

Uploaded by

Zara Jamshaid
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
60 views

Machine Learning Notes - Lec 03 - Gender Identification Using Scikit-Learn

The document discusses gender identification using machine learning. It describes the three phases of machine learning: training, testing, and application. In the training phase, a model is trained on labeled training data. In the testing phase, the model is evaluated on labeled test data. In the application phase, the trained model is used to make predictions on new, unlabeled data. The document outlines the steps involved in each phase of building a gender identification model using Scikit-Learn, including preprocessing data, training algorithms, evaluating performance, and making predictions on unseen data.

Uploaded by

Zara Jamshaid
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 71

Machine Learning

Lecture 03
Gender Identification using Scikit-Learn

Dr. Rao Muhammad Adeel Nawab


How to Work

Dr. Rao Muhammad Adeel Nawab 2


Power of Dua

Dr. Rao Muhammad Adeel Nawab 3


Dua – Take Help from Allah before starting any task

Dr. Rao Muhammad Adeel Nawab 4


Course Focus
Mainly get EXCELLENCE in two things
1. Become a great human being
2. Become a great Machine Learning Engineer

To become a great human being


Get sincere with yourself
When you get sincere with yourself your ‫ ﺧﻠﻭﺕ‬and ‫ ﺟﻠﻭﺕ‬is the
same
Dr. Rao Muhammad Adeel Nawab 5
Introduction
Aim
The main aim of this tutorial is to explain the task
of gender identification using Scikit-Learn Machine
Learning toolkit.
Task
Learn Input-Output Function
Given a human as input predict its gender (output)

Dr. Rao Muhammad Adeel Nawab 6


Introduction
Goal
The problem of gender prediction is treated as a
supervised learning problem.
We need
Labelled data
High quality data
Large amount of data

Dr. Rao Muhammad Adeel Nawab 7


Input and Output
Input:
Human
Represented as set of attributes (Height, Weight, Hair
Length, Beard, Scarf)
Output:
Gender of human
Represented as Gender attribute (Male/Female)
Goal:
Learn from Input to predict Output
Dr. Rao Muhammad Adeel Nawab 8
Three Phases of Machine Learning

Use subset of data (called Train


Training data) to train model (learning)

Use subset of data (called Test


Testing Data) to evaluate train model

Use your learned/trained model in


Application real world applications

Dr. Rao Muhammad Adeel Nawab 9


PHASES 1 & 2: TRAINING AND TESTING
Step 1: Import Libraries

Step 2: Read, Understand and Pre-process Train/Test Data

Step 2.1: Read Data

Step 2.2: Understand Data

Step 2.3: Pre-process Data


Dr. Rao Muhammad Adeel Nawab 10
PHASES 1 & 2: TRAINING AND TESTING
Step 3: Label Encoding for Train/Test Data

Step 4: Feature Extraction – Values of Attributes

Step 5: Train Machine Learning Algorithms using Train Data

Step 6: Evaluate Machine Learning Algorithms using Test Data

Step 7: Selection of Best Model

Dr. Rao Muhammad Adeel Nawab 11


PHASE 3: APPLICATION PHASE

Step 8: Application Phase

Step 8.1: Combine Data (Train + Test )

Step 8.2: Train Best Model (see Step 7) on all data (Train + Test)

Step 8.3: Save the Trained Model as Pickle File

Dr. Rao Muhammad Adeel Nawab 12


PHASE 3: APPLICATION PHASE

Step 9: Make prediction on unseen/new data

Step 9.1: Load the Trained Model (saved in Step 8.3)

Step 9.2: Take Input from User

Dr. Rao Muhammad Adeel Nawab 13


PHASE 3: APPLICATION PHASE

Step 9.3: Convert User Input into Feature Vector (Same as


Feature Vector of Trained Model)

Step 9.4: Apply Trained Model on Feature Vector of Unseen


Data and Output Prediction (Male/Female) to User

Dr. Rao Muhammad Adeel Nawab 14


Step 1: Import Libraries

Dr. Rao Muhammad Adeel Nawab 15


Step 2: Read, Understand and Pre-process Train/Test
Data

Read, Understand and Pre-process Train/Test Data

Dr. Rao Muhammad Adeel Nawab 16


Step 2.2: Understand Data

Dr. Rao Muhammad Adeel Nawab 17


Step 2.2: Understand Data

Dr. Rao Muhammad Adeel Nawab 18


Step 2.2: Understand Data

Dr. Rao Muhammad Adeel Nawab 19


Step 2.2: Understand Data

Dr. Rao Muhammad Adeel Nawab 20


Step 2.2: Understand Data

Dr. Rao Muhammad Adeel Nawab 21


Step 2.2: Understand Data

Dr. Rao Muhammad Adeel Nawab 22


Step 2.2: Understand Data

Dr. Rao Muhammad Adeel Nawab 23


Step 2.2: Understand Data

Dr. Rao Muhammad Adeel Nawab 24


Step 2.2: Understand Data
Understanding Data via

GRAPH is easy.

Let’s Go!

Dr. Rao Muhammad Adeel Nawab 25


Step 2.2: Understand Data

Dr. Rao Muhammad Adeel Nawab 26


Step 2.2: Understand Data

Dr. Rao Muhammad Adeel Nawab 27


Step 2.2: Understand Data

Dr. Rao Muhammad Adeel Nawab 28


Step 2.2: Understand Data

Dr. Rao Muhammad Adeel Nawab 29


Step 2.2: Understand Data

Dr. Rao Muhammad Adeel Nawab 30


Step 2.2: Understand Data

Dr. Rao Muhammad Adeel Nawab 31


Step 2.3: Pre-Process Data

Dr. Rao Muhammad Adeel Nawab 32


Please convert data to a
form that I can
understand

Dr. Rao Muhammad Adeel Nawab 33


Step 3: Label Encoding for Train/Test Data

Dr. Rao Muhammad Adeel Nawab 34


Step 3: Label Encoding for Train/Test Data

Dr. Rao Muhammad Adeel Nawab 35


Step 3: Label Encoding for Train/Test Data

Dr. Rao Muhammad Adeel Nawab 36


Step 3: Label Encoding for Train/Test Data

Dr. Rao Muhammad Adeel Nawab 37


Step 3: Label Encoding for Train/Test Data

Dr. Rao Muhammad Adeel Nawab 38


Step 3: Label Encoding for Train/Test Data

Dr. Rao Muhammad Adeel Nawab 39


Step 5: Train ML Algorithms using Train Data

Dr. Rao Muhammad Adeel Nawab 40


Step 5: Train ML Algorithms using Train Data

Dr. Rao Muhammad Adeel Nawab 41


Step 5: Train ML Algorithms using Train Data

Dr. Rao Muhammad Adeel Nawab 42


Step 5: Train ML Algorithms using Train Data

Dr. Rao Muhammad Adeel Nawab 43


Step 6: Evaluate ML Algorithms using Test Data

Dr. Rao Muhammad Adeel Nawab 44


Step 6: Evaluate ML Algorithms using Test Data

Dr. Rao Muhammad Adeel Nawab 45


Step 6: Evaluate ML Algorithms using Test Data

Dr. Rao Muhammad Adeel Nawab 46


Step 6: Evaluate ML Algorithms using Test Data

Dr. Rao Muhammad Adeel Nawab 47


Step 7: Selection of Best Model

Dr. Rao Muhammad Adeel Nawab 48


Step 8: Application Phase

PHASE 3: APPLICATION PHASE

Dr. Rao Muhammad Adeel Nawab 49


Step 8.1: Combine Data (Train+Test)

Dr. Rao Muhammad Adeel Nawab 50


Step 8.1: Combine Data (Train+Test)

Dr. Rao Muhammad Adeel Nawab 51


Step 8.1: Combine Data (Train+Test)

Dr. Rao Muhammad Adeel Nawab 52


Step 8.2: Train Best Model on All Data

Dr. Rao Muhammad Adeel Nawab 53


Step 9: Make Predictions on Unseen/New Data

Making Predictions on Unseen/New Data

Dr. Rao Muhammad Adeel Nawab 54


Step 9.1: Load the Trained Model (saved in Step 8.3)

Dr. Rao Muhammad Adeel Nawab 55


Step 9.2: Take Input from User

Dr. Rao Muhammad Adeel Nawab 56


Step 9.3: Convert User Input into Feature Vector
(Same ss Feature Vector of Trained Model)

Dr. Rao Muhammad Adeel Nawab 57


Step 9.3: Convert User Input into Feature Vector
(Same ss Feature Vector of Trained Model)

Dr. Rao Muhammad Adeel Nawab 58


Step 9.3: Convert User Input into Feature Vector
(Same ss Feature Vector of Trained Model)

Dr. Rao Muhammad Adeel Nawab 59


Step 9.4: Apply Trained Model on Feature Vector of
Unseen Data and Output Prediction to User

Dr. Rao Muhammad Adeel Nawab 60


How To Become a Great Human
Being

Dr. Rao Muhammad Adeel Nawab 61


Balanced Life is Ideal Life
Get Excellence in five things
1. Health
2. Spirituality
3. Work
4. Friend
5. Family
A Journey from BIGNNER to EXCELLENCE
You must have a combination of five things with different
variations. However, aggregate will be same.
Dr. Rao Muhammad Adeel Nawab 62
Excellence
1. Health
I can run (or brisk walk) 5 kilometers in one go
I take 7-9 hours sleep per night (TIP: Go to bed at 10pm)
I take 3 meals of balanced diet daily
2. Spirituality

Dr. Rao Muhammad Adeel Nawab 63


Excellence
3. Work
Become an authority in your field
For example - Dr. Abdul Qadeer Khan Sb is an authority in research
4. Friend
Have a DADDU YAR in life to drain out on daily basis
5. Family
1. Take Duas of Parents and elders by doing their ‫ ﺧﺩﻣﺕ‬and ‫ﺍﺩﺏ‬
2. Your wife/husband should be your best friend
3. Be humble and kind to kids, subordinates and poor people
Dr. Rao Muhammad Adeel Nawab 64
GURU

Dr. Rao Muhammad Adeel Nawab 65


This Sentence is Summary of my Life

Dr. Rao Muhammad Adeel Nawab 66


KEY TO SUCCESS

Dr. Rao Muhammad Adeel Nawab 67


ALLAH KA FAZAL

Dr. Rao Muhammad Adeel Nawab 68


KEY TO SUCCESS
TWO THINGS WILL LEAD YOU TO SUCCESS

Dr. Rao Muhammad Adeel Nawab 69


KEY TO SUCCESS

Dr. Rao Muhammad Adeel Nawab 70


REASONS OF FAILURE
TWO THINGS WILL LEAD YOU TO FAILURE

Dr. Rao Muhammad Adeel Nawab 71

You might also like