ML Week 1
ML Week 1
SkillifyMe
03 Human Vs Machine
05 Environment Setup
MADE BY SKILLIFYME
WHAT IS MACHINE LEARNING ?
MADE BY SKILLIFYME
Human can learn from past experience
and make decision of its own.
MADE BY SKILLIFYME
What is this object?
Ans :
It is a car
MADE BY SKILLIFYME
LET US ASK THE SAME QUESTION TO HIM
But, he is a human being.
He can observe and learn!
MADE BY SKILLIFYME
Let us make him learn.
MADE BY SKILLIFYME
Let us make him learn.
MADE BY SKILLIFYME
Let us ask the same question now
MADE BY SKILLIFYME
Let us ask the same question now
MADE BY SKILLIFYME
What about a Machine ?
MADE BY SKILLIFYME
We want a machine to act like a human
MADE BY SKILLIFYME
MADE BY SKILLIFYME
Algorithm
MADE BY SKILLIFYME
MADE BY SKILLIFYME
MADE BY SKILLIFYME
HUMAN VS MACHINE
MADE BY SKILLIFYME
MACHINE LEARNING
Refers to a computer or a Means improving at a task
system that can process by gaining experience.
data and perform tasks.
MADE BY SKILLIFYME
How does Machine Learning works?
MADE BY SKILLIFYME
My first machine learning model
MADE BY SKILLIFYME
MADE BY SKILLIFYME
MADE BY SKILLIFYME
MADE BY SKILLIFYME
MADE BY SKILLIFYME
MADE BY SKILLIFYME
Are all features useful?
MADE BY SKILLIFYME
Let us consider single feature
MADE BY SKILLIFYME
Given the #Wheel
Identify the vehicle
MADE BY SKILLIFYME
Let us estimate
MADE BY SKILLIFYME
Let us estimate the probability
(type|#wheel)
MADE BY SKILLIFYME
Ask the question now
MADE BY SKILLIFYME
More Features
MADE BY SKILLIFYME
MADE BY SKILLIFYME
MADE BY SKILLIFYME
Machine Learning Workflow
MADE BY SKILLIFYME
MADE BY SKILLIFYME
MOST USEFUL LANGUAGE
FOR MACHNE LEARNING :
PYTHON
MADE BY SKILLIFYME
Python is a high-level, interpreted programming language known for its
readability, simplicity, and versatility.
MADE BY SKILLIFYME
MADE BY SKILLIFYME
Common Uses of Python
Web Development: Frameworks like Django and Flask make it easy to build
robust web applications.
Data Analysis and Visualization: Libraries like pandas, NumPy, and
Matplotlib are widely used for data manipulation and visualization.
Machine Learning and Artificial Intelligence: Libraries such as TensorFlow,
Keras, and scikit-learn are popular for developing machine learning models.
Automation and Scripting: Python is often used to write scripts for
automating repetitive tasks.
Scientific Computing: Tools like SciPy and SymPy are used for scientific
research and numerical computations.
Game Development: Libraries like Pygame allow for the creation of simple
games and multimedia applications.
MADE BY SKILLIFYME
MADE BY SKILLIFYME
Writing your first Python Program
MADE BY SKILLIFYME
Comments in Python
MADE BY SKILLIFYME
Python Variable
Python Variable is containers that store values.
MADE BY SKILLIFYME
MADE BY SKILLIFYME
VALID AND INVALID VARIABLES NAME
Var1
_var1
my_variable
_myvariable
myVariable
123hello
var!name
my#variable
class
for
return
VAR12
MADE BY SKILLIFYME
Python Data Types
Data types are the classification or categorization of data items. It represents
the kind of value that tells what operations can be performed on a particular
data.
MADE BY SKILLIFYME
1. Numeric Data Types in Python
The numeric data type in Python represents the data that has a
numeric value.
MADE BY SKILLIFYME
Note –
type() function is used to determine the type of Python data type.
MADE BY SKILLIFYME
MADE BY SKILLIFYME
2. Sequence Data Types in Python
Python String
Python List
Python Tuple
MADE BY SKILLIFYME
String Data Type
A string is a collection of one or more characters put in
a single quote, double-quote, or triple-quote.
MADE BY SKILLIFYME
OUTPUT
MADE BY SKILLIFYME
Accessing characters in Python String
-10 -9 -8 -7 -6 -5 -4 -3 -2 -1
S K I L L I F Y M E
0 1 2 3 4 5 6 7 8 9
MADE BY SKILLIFYME
MADE BY SKILLIFYME
String Slicing
The String Slicing method is used to access a range of characters in the String.
MADE BY SKILLIFYME
MADE BY SKILLIFYME
Python String Reversed
MADE BY SKILLIFYME
Deleting/Updating from a String
MADE BY SKILLIFYME
MADE BY SKILLIFYME
Escape Sequencing in Python
MADE BY SKILLIFYME
MADE BY SKILLIFYME
STRING FORMATTING
MADE BY SKILLIFYME
Case Changing of Python String Methods
MADE BY SKILLIFYME
MADE BY SKILLIFYME
INPUT OUTPUT IN PYTHON
MADE BY SKILLIFYME
PRACTICE QUESTIONS
1. WRITE A PYTHON PROGRAM TO PRINT YOUR NAME ,ROLL NO.
,BRANCH WITH COMMENTS.
2. YOU ARE DEPOSITING YOUR CASH IN A BANK . THE BANK WANTS TO
TAKE USER INPUT OF AMOUNT ONLY IN INTEGER VALUE .WRITE A
PROGRAM TO PRINT THIS .
3. DELETE THE CHARACTER 'E' FROM THE STRING S = "HELLO" USING
SLICING AND CONCATENATION.
4. RAM PRINTS A STRING OUTPUTS MACINE LEARNING . THE SPELLING
IS WRONG .HE WANTS TO UPDATE THIS WITH MACHINE LEARNING
.WRITE A PROGRAM TO UPDATE THIS .
5. APPLY ALL STRING FORMATTING OPERATORS TO STRING “I WANT TO
LEARN MACHINE LEARNING”
MADE BY SKILLIFYME
List of String Methods in Python
MADE BY SKILLIFYME
MADE BY SKILLIFYME
MADE BY SKILLIFYME
MADE BY SKILLIFYME
LIST
Lists are used to store multiple items in a single variable.
Lists are created using square brackets.
MADE BY SKILLIFYME
Access Items
MADE BY SKILLIFYME
Note: The search will start at index 2 (included) and end at index 5 (not included).
MADE BY SKILLIFYME
Check if Item Exists
MADE BY SKILLIFYME
Change a Range of Item Values
MADE BY SKILLIFYME
Insert Items
Append Items
MADE BY SKILLIFYME
Remove Specified Item
MADE BY SKILLIFYME
Clear the List
MADE BY SKILLIFYME
Sort Descending
MADE BY SKILLIFYME
Copy a List
MADE BY SKILLIFYME
Join Two Lists
MADE BY SKILLIFYME
List Methods
MADE BY SKILLIFYME
Tuples
Tuples are used to store multiple items in a single variable.
Tuple items are ordered, unchangeable, and allow duplicate values.
Tuples are written with round brackets.
MADE BY SKILLIFYME
Create Tuple With One Item
MADE BY SKILLIFYME
Check if Item Exists
MADE BY SKILLIFYME
Python - Update Tuples
Tuples are unchangeable, meaning that you cannot change, add, or remove items
once the tuple is created.
MADE BY SKILLIFYME
Add Items
MADE BY SKILLIFYME
Remove Items
MADE BY SKILLIFYME
Join Two Tuples
Multiply Tuples
MADE BY SKILLIFYME
MADE BY SKILLIFYME
Python Boolean
Represents one of the two values i.e. True or False
MADE BY SKILLIFYME
Boolean value from the expression
MADE BY SKILLIFYME
Boolean Operators
Common boolean operations are –
or
and
not
== (equivalent)
!= (not equivalent)
Boolean OR Operator
MADE BY SKILLIFYME
MADE BY SKILLIFYME
MADE BY SKILLIFYME
MADE BY SKILLIFYME
PYTHON SET
Python Set is an unordered collection of data types that is iterable,
mutable, and has no duplicate elements.
MADE BY SKILLIFYME
MADE BY SKILLIFYME
MADE BY SKILLIFYME
Python dictionary
A Python dictionary is a data structure that stores the value in key:value pairs.
MADE BY SKILLIFYME
Nested Dictionaries
MADE BY SKILLIFYME
Python Operators
Arithmetic operators
Assignment operators
Comparison operators
Logical operators
Identity operators
Membership operators
Bitwise operators
MADE BY SKILLIFYME
Python Arithmetic Operators
MADE BY SKILLIFYME
MADE BY SKILLIFYME
Python Assignment Operators
MADE BY SKILLIFYME
Python Comparison Operators
MADE BY SKILLIFYME
Python Identity Operators
MADE BY SKILLIFYME
Python If
It is used to decide whether a certain statement or block of
statements will be executed or not.
MADE BY SKILLIFYME
MADE BY SKILLIFYME
MADE BY SKILLIFYME
MADE BY SKILLIFYME
Python Nested If Statement
MADE BY SKILLIFYME
MADE BY SKILLIFYME
MADE BY SKILLIFYME
Check if a number is positive, negative, or zero.
Determine if a number is even or odd.
Check which of two numbers is greater.
Grade calculation based on marks.
Check if a number is divisible by both 5 and 7.
Determine and display the oldest person among four people.
MADE BY SKILLIFYME
Python For Loops
A for loop is used for iterating over a sequence (that is either a list, a
tuple, a dictionary, a set, or a string).
MADE BY SKILLIFYME
Python For Loop with String
MADE BY SKILLIFYME
Python for loop with Range
MADE BY SKILLIFYME
Python for loop Enumerate
MADE BY SKILLIFYME
Nested For Loops in Python
MADE BY SKILLIFYME
Python For Loop Over List
MADE BY SKILLIFYME
Python For Loop with Zip()
MADE BY SKILLIFYME
Continue in Python For Loop
Python continue Statement returns the control to
the beginning of the loop.
MADE BY SKILLIFYME
Break in Python For Loop
Python break statement brings control out of the loop.
MADE BY SKILLIFYME
For Loop in Python with Pass Statement
MADE BY SKILLIFYME
For Loops in Python with Else Statement
MADE BY SKILLIFYME
PRACTICE QUESTION 1
MADE BY SKILLIFYME
MADE BY SKILLIFYME
PRACTICE QUESTION 2
MADE BY SKILLIFYME
MADE BY SKILLIFYME
While Loop in Python
In Python, a while loop is used to execute a block of statements
repeatedly until a given condition is satisfied. When the condition
becomes false, the line immediately after the loop in the program is
executed.
MADE BY SKILLIFYME
MADE BY SKILLIFYME
MADE BY SKILLIFYME
Python Continue Statement
returns the control to the beginning of the loop.
MADE BY SKILLIFYME
MADE BY SKILLIFYME
Python Break Statement brings control out of the loop.
MADE BY SKILLIFYME
MADE BY SKILLIFYME
The Python pass statement to write empty
loops. Pass is also used for empty control
statements, functions, and classes.
MADE BY SKILLIFYME
MADE BY SKILLIFYME
While loop with else
Note : The else block just after for/while is executed only
when the loop is NOT terminated by a break statement.
MADE BY SKILLIFYME
MADE BY SKILLIFYME
Python while loop with user input
It first asks the user to input a number. if the user enters -1 then the loop will
not execute, i.e.
The user enters 6 and the body of the loop executes and again asks for
input
Here user can input many times until he enters -1 to stop the loop
User can decide how many times he wants to enter input
MADE BY SKILLIFYME
MADE BY SKILLIFYME
MADE BY SKILLIFYME
MADE BY SKILLIFYME
Python while loop with Python list
MADE BY SKILLIFYME
MADE BY SKILLIFYME
MADE BY SKILLIFYME
MADE BY SKILLIFYME
MADE BY SKILLIFYME
MADE BY SKILLIFYME
Simple while-loop exercise code to build countdown clock
MADE BY SKILLIFYME
MADE BY SKILLIFYME
MADE BY SKILLIFYME
MADE BY SKILLIFYME
Python Functions
Python Functions is a block of statements that return the specific task
MADE BY SKILLIFYME
MADE BY SKILLIFYME
MADE BY SKILLIFYME
MADE BY SKILLIFYME
Calling a Function in Python
MADE BY SKILLIFYME
Arguments
MADE BY SKILLIFYME
MADE BY SKILLIFYME
MADE BY SKILLIFYME
Types of Function Arguments
MADE BY SKILLIFYME
Default Arguments
MADE BY SKILLIFYME
Positional Arguments
MADE BY SKILLIFYME
MADE BY SKILLIFYME
Keyword Arguments
The idea is to allow the caller to specify the argument name
with values so that the caller does not need to remember
the order of parameters.
MADE BY SKILLIFYME
Arbitrary Keyword Arguments
MADE BY SKILLIFYME
MADE BY SKILLIFYME
MADE BY SKILLIFYME
MADE BY SKILLIFYME
MADE BY SKILLIFYME
MADE BY SKILLIFYME
MADE BY SKILLIFYME
Python Variable Scope
MADE BY SKILLIFYME
Python Local Variables
When we declare variables inside a function, these variables will
have a local scope (within the function). We cannot access them
outside the function.
MADE BY SKILLIFYME
Python Global Variables
MADE BY SKILLIFYME
MADE BY SKILLIFYME
Python Nonlocal Variables
MADE BY SKILLIFYME
MADE BY SKILLIFYME
Python Recursion
MADE BY SKILLIFYME
MADE BY SKILLIFYME
MADE BY SKILLIFYME
MADE BY SKILLIFYME
Python Program to Find Sum of Natural
Numbers Using Recursion
MADE BY SKILLIFYME
MADE BY SKILLIFYME
Python Lambda
MADE BY SKILLIFYME
MADE BY SKILLIFYME
MADE BY SKILLIFYME
Python Arrays
MADE BY SKILLIFYME
Create an Array in Python
MADE BY SKILLIFYME
MADE BY SKILLIFYME
Adding Elements to a Array
MADE BY SKILLIFYME
MADE BY SKILLIFYME
MADE BY SKILLIFYME
Removing Elements from the Array
Elements can be removed from the Python array by using
built-in remove() function
MADE BY SKILLIFYME
Slicing of an Array
MADE BY SKILLIFYME
MADE BY SKILLIFYME
Searching Element in an Array
In order to search an element in the array we use a
python in-built index() method. This function returns
the index of the first occurrence of value mentioned in
arguments.
MADE BY SKILLIFYME
MADE BY SKILLIFYME
Updating Elements in a Array
In order to update an element in the
array we simply reassign a new value to
the desired index we want to update.
MADE BY SKILLIFYME
MADE BY SKILLIFYME
Different Operations
on Python Arrays
1. Counting Elements in a Array
In order to count elements in an array we need to use count method.
MADE BY SKILLIFYME
2. Reversing Elements in a Array
In order to reverse elements of an array we need to simply use reverse method.
MADE BY SKILLIFYME
THANK YOU