SlideShare a Scribd company logo
1 of 17
PYTHON FOR MACHINE
LEARNING
Dr. Amanpreet Kaur​
Associate Professor,
Chitkara University,
Punjab
CONTENTS TO BE STUDIED
• Introduction to Python Programming
• Python for Machine Learning
• Python Libraries used in Machine Learning
• NumPy
• NumPy Questions
• References
PYTHON FOR MACHINE
LEARNING (ML)
• A Python framework is an interface or tool that allows developers to
build ML models easily.
• without getting into the depth of the underlying algorithms.
• Python libraries are specific files containing pre-written code that can be
imported into your code base by using Python’s import feature.
• This increases your code reusability.
3
PYTHON FOR MACHINE
LEARNING (ML)
• A Python framework can be a collection of libraries intended to build a
model (e.g., machine learning) easily,
• without having to know the details of the underlying algorithms.
• An ML developer, however, must at least know how the algorithms work in
order to know what results to expect, as well as how to validate them.
4
FEATURES OF PYTHON
PROGRAMMING
• Used in Various Domains ( Artificial Intelligence, Machine Learning, Deep
Learning )
• Python is Object Oriented
• Python is Open source
• Shift from one system to another
5
INSTALLATION OF ANACONDA
• Visit Anaconda.com/downloads
• Select Windows
• Download the .exe installer
• Open and run the .exe installer
• Open the Anaconda Prompt and run some Python code
6
Figure- 1 Anaconda Distribution [1]
PYTHON LIBRARIES USED IN
MACHINE LEARNING
• NumPy
• SciPy
• Scikit – Learn
• Pandas
• Matplotlib
• TensorFlow
7
NUMPY
• NumPy is a well known general-purpose array-processing package.
• An extensive collection of high complexity mathematical functions make
NumPy powerful to process large multi-dimensional arrays and matrices.
• NumPy is very useful for handling linear algebra, Fourier transforms, and
random numbers.
• Define arbitrary data types and easily integrate with most databases.
• NumPy can also serve as an efficient multi-dimensional container for any
generic data that is in any datatype.
8
OPERATIONS USING NUMPY
9
Using NumPy, a developer can perform the following operations −
Mathematical and logical operations on arrays.
Fourier transforms and routines for shape manipulation.
Developer can perform Operations related to linear algebra.
NumPy has in-built functions for linear algebra and random number generation.
Installation of NumPy
pip install numpy
10
• Object defined in NumPy is an N-dimensional array type called ndarray.
• It describes the collection of items of the same type.
• Items in the collection can be accessed using a zero-based index.
• Every item in an ndarray takes the same size of block in the memory.
• Each element in ndarray is an object of data-type object (called dtype).
• Any item extracted from ndarray object (by slicing) is represented by a Python object of one of
array scalar types.
Figure-1.2 Relationship between ndarray, data type object (dtype) and array scalar type [6]
PROGRAM TO PRINT FIRST 25
PRIME NUMBER
11
• def isPrime(num):
for i in range(2,num):
if (num % i) == 0:
return False
else:
return True
print("prime numbers")
count, num=0, 2
while count<25:
if isPrime(num):
print(num)
count+=1
num+=1
• Output-Prime Numbers
• 2
• 3
• 5
• 7
• 11
• 13
• 17
• 19
• 23
• 29
• 31
• 37
• 41
• 47
• 53
• 59
NUMPY(ONE DIMENSIONAL) 12
# this is one dimensional array
import numpy as np
a = np.arange(24)
#Function return the number of
dimensions of an array.
a.ndim
# now reshape it
b = a.reshape(2,4,3)
b #print b
# b is having three dimensions
Result-
$python main.py
[[[ 0 1 2]
[ 3 4 5]
[ 6 7 8]
[ 9 10 11]]
[[12 13 14]
[15 16 17]
[18 19 20]
[21 22 23]]]
NUMPY-QUESTIONS
13
• Write a Python program to print Factorial of given numbers.
• Write a Python program to print all Prime numbers in an Interval.
• Write a python program to sort the elements of an Array in Ascending order.
• Write a python program to print the Fibonacci series.
• Write a Python program to copy all elements of one array into another array.
• Write a Python program to print the elements of an array present on even position
PYTHON PROGRAMMING-
ANACONDA
14
• Anaconda is a free and open source distribution of the Python and R programming
languages for large-scale data processing, predictive analytics, and scientific
computing.
• The advantage of Anaconda is that you have access to over 720 packages that can
easily be installed with Anaconda's Conda, a package, dependency, and
environment manager.
• Anaconda distribution is available for installation
at https://www.anaconda.com/download/. For installation on Windows, 32 and 64
bit binaries are available −
PYTHON PROGRAMMING
15
Online Compiler:-
https://dataplatform.cloud.ibm.com/
https://jupyter.org/
PYTHON PROGRAMMING
16
E Books-
• Peter Harrington “Machine Learning In Action”, DreamTech
Press
• Ethem Alpaydın, “Introduction to Machine Learning”, MIT Press
Video Links-
• https://www.youtube.com/watch?v=BRMS3T11Cdw&list=PL3pGy4HtqwD2a
57wl7Cl7tmfxfk7JWJ9Y
• https://www.youtube.com/watch?v=EWmCkVfPnJ8&list=PL3pGy4HtqwD2a
57wl7Cl7tmfxfk7JWJ9Y&index=3
THANK YOU
aman_preet_k@yahoo.co.in

More Related Content

Similar to Python for ML.pptx

Basic of python for data analysis
Basic of python for data analysisBasic of python for data analysis
Basic of python for data analysisPramod Toraskar
 
Basic Introduction to Python Programming
Basic Introduction to Python ProgrammingBasic Introduction to Python Programming
Basic Introduction to Python ProgrammingSubashiniRathinavel
 
Python indroduction
Python indroductionPython indroduction
Python indroductionFEG
 
ANN-Lecture2-Python Startup.pptx
ANN-Lecture2-Python Startup.pptxANN-Lecture2-Python Startup.pptx
ANN-Lecture2-Python Startup.pptxShahzadAhmadJoiya3
 
Data Analysis in Python-NumPy
Data Analysis in Python-NumPyData Analysis in Python-NumPy
Data Analysis in Python-NumPyDevashish Kumar
 
Python your new best friend
Python your new best friendPython your new best friend
Python your new best friendLuis Goldster
 
Python your new best friend
Python your new best friendPython your new best friend
Python your new best friendFraboni Ec
 
Python your new best friend
Python your new best friendPython your new best friend
Python your new best friendYoung Alista
 
Python your new best friend
Python your new best friendPython your new best friend
Python your new best friendJames Wong
 
Python your new best friend
Python your new best friendPython your new best friend
Python your new best friendHarry Potter
 
Python your new best friend
Python your new best friendPython your new best friend
Python your new best friendTony Nguyen
 
Python your new best friend
Python your new best friendPython your new best friend
Python your new best friendHoang Nguyen
 
Introduction to numpy.pptx
Introduction to numpy.pptxIntroduction to numpy.pptx
Introduction to numpy.pptxssuser0e701a
 
Intellectual technologies
Intellectual technologiesIntellectual technologies
Intellectual technologiesPolad Saruxanov
 
Travis Oliphant "Python for Speed, Scale, and Science"
Travis Oliphant "Python for Speed, Scale, and Science"Travis Oliphant "Python for Speed, Scale, and Science"
Travis Oliphant "Python for Speed, Scale, and Science"Fwdays
 
Python for Machine Learning(MatPlotLib).pptx
Python for Machine Learning(MatPlotLib).pptxPython for Machine Learning(MatPlotLib).pptx
Python for Machine Learning(MatPlotLib).pptxDr. Amanpreet Kaur
 
Data Analyzing And Visualization Using Python.pptx
Data Analyzing And Visualization Using Python.pptxData Analyzing And Visualization Using Python.pptx
Data Analyzing And Visualization Using Python.pptxPoojaChavan51
 

Similar to Python for ML.pptx (20)

Basic of python for data analysis
Basic of python for data analysisBasic of python for data analysis
Basic of python for data analysis
 
Numba
NumbaNumba
Numba
 
Kaggle tokyo 2018
Kaggle tokyo 2018Kaggle tokyo 2018
Kaggle tokyo 2018
 
Basic Introduction to Python Programming
Basic Introduction to Python ProgrammingBasic Introduction to Python Programming
Basic Introduction to Python Programming
 
Python indroduction
Python indroductionPython indroduction
Python indroduction
 
ANN-Lecture2-Python Startup.pptx
ANN-Lecture2-Python Startup.pptxANN-Lecture2-Python Startup.pptx
ANN-Lecture2-Python Startup.pptx
 
Pa2 session 1
Pa2 session 1Pa2 session 1
Pa2 session 1
 
Data Analysis in Python-NumPy
Data Analysis in Python-NumPyData Analysis in Python-NumPy
Data Analysis in Python-NumPy
 
Python your new best friend
Python your new best friendPython your new best friend
Python your new best friend
 
Python your new best friend
Python your new best friendPython your new best friend
Python your new best friend
 
Python your new best friend
Python your new best friendPython your new best friend
Python your new best friend
 
Python your new best friend
Python your new best friendPython your new best friend
Python your new best friend
 
Python your new best friend
Python your new best friendPython your new best friend
Python your new best friend
 
Python your new best friend
Python your new best friendPython your new best friend
Python your new best friend
 
Python your new best friend
Python your new best friendPython your new best friend
Python your new best friend
 
Introduction to numpy.pptx
Introduction to numpy.pptxIntroduction to numpy.pptx
Introduction to numpy.pptx
 
Intellectual technologies
Intellectual technologiesIntellectual technologies
Intellectual technologies
 
Travis Oliphant "Python for Speed, Scale, and Science"
Travis Oliphant "Python for Speed, Scale, and Science"Travis Oliphant "Python for Speed, Scale, and Science"
Travis Oliphant "Python for Speed, Scale, and Science"
 
Python for Machine Learning(MatPlotLib).pptx
Python for Machine Learning(MatPlotLib).pptxPython for Machine Learning(MatPlotLib).pptx
Python for Machine Learning(MatPlotLib).pptx
 
Data Analyzing And Visualization Using Python.pptx
Data Analyzing And Visualization Using Python.pptxData Analyzing And Visualization Using Python.pptx
Data Analyzing And Visualization Using Python.pptx
 

Recently uploaded

(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...ranjana rawat
 
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLS
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLSMANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLS
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLSSIVASHANKAR N
 
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICSAPPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICSKurinjimalarL3
 
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...Dr.Costas Sachpazis
 
Call Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile serviceCall Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile servicerehmti665
 
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escortsranjana rawat
 
Biology for Computer Engineers Course Handout.pptx
Biology for Computer Engineers Course Handout.pptxBiology for Computer Engineers Course Handout.pptx
Biology for Computer Engineers Course Handout.pptxDeepakSakkari2
 
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...ranjana rawat
 
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...Dr.Costas Sachpazis
 
Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024hassan khalil
 
Introduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptxIntroduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptxupamatechverse
 
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur High Profile
 
HARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IVHARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IVRajaP95
 
Current Transformer Drawing and GTP for MSETCL
Current Transformer Drawing and GTP for MSETCLCurrent Transformer Drawing and GTP for MSETCL
Current Transformer Drawing and GTP for MSETCLDeelipZope
 
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Serviceranjana rawat
 
Processing & Properties of Floor and Wall Tiles.pptx
Processing & Properties of Floor and Wall Tiles.pptxProcessing & Properties of Floor and Wall Tiles.pptx
Processing & Properties of Floor and Wall Tiles.pptxpranjaldaimarysona
 
Coefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptxCoefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptxAsutosh Ranjan
 
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝soniya singh
 

Recently uploaded (20)

(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
 
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLS
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLSMANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLS
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLS
 
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICSAPPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
 
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
 
Call Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile serviceCall Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile service
 
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
 
Biology for Computer Engineers Course Handout.pptx
Biology for Computer Engineers Course Handout.pptxBiology for Computer Engineers Course Handout.pptx
Biology for Computer Engineers Course Handout.pptx
 
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
 
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
 
Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024
 
Introduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptxIntroduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptx
 
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
 
Exploring_Network_Security_with_JA3_by_Rakesh Seal.pptx
Exploring_Network_Security_with_JA3_by_Rakesh Seal.pptxExploring_Network_Security_with_JA3_by_Rakesh Seal.pptx
Exploring_Network_Security_with_JA3_by_Rakesh Seal.pptx
 
HARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IVHARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IV
 
Current Transformer Drawing and GTP for MSETCL
Current Transformer Drawing and GTP for MSETCLCurrent Transformer Drawing and GTP for MSETCL
Current Transformer Drawing and GTP for MSETCL
 
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
 
Call Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCR
Call Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCRCall Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCR
Call Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCR
 
Processing & Properties of Floor and Wall Tiles.pptx
Processing & Properties of Floor and Wall Tiles.pptxProcessing & Properties of Floor and Wall Tiles.pptx
Processing & Properties of Floor and Wall Tiles.pptx
 
Coefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptxCoefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptx
 
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝
 

Python for ML.pptx

  • 1. PYTHON FOR MACHINE LEARNING Dr. Amanpreet Kaur​ Associate Professor, Chitkara University, Punjab
  • 2. CONTENTS TO BE STUDIED • Introduction to Python Programming • Python for Machine Learning • Python Libraries used in Machine Learning • NumPy • NumPy Questions • References
  • 3. PYTHON FOR MACHINE LEARNING (ML) • A Python framework is an interface or tool that allows developers to build ML models easily. • without getting into the depth of the underlying algorithms. • Python libraries are specific files containing pre-written code that can be imported into your code base by using Python’s import feature. • This increases your code reusability. 3
  • 4. PYTHON FOR MACHINE LEARNING (ML) • A Python framework can be a collection of libraries intended to build a model (e.g., machine learning) easily, • without having to know the details of the underlying algorithms. • An ML developer, however, must at least know how the algorithms work in order to know what results to expect, as well as how to validate them. 4
  • 5. FEATURES OF PYTHON PROGRAMMING • Used in Various Domains ( Artificial Intelligence, Machine Learning, Deep Learning ) • Python is Object Oriented • Python is Open source • Shift from one system to another 5
  • 6. INSTALLATION OF ANACONDA • Visit Anaconda.com/downloads • Select Windows • Download the .exe installer • Open and run the .exe installer • Open the Anaconda Prompt and run some Python code 6 Figure- 1 Anaconda Distribution [1]
  • 7. PYTHON LIBRARIES USED IN MACHINE LEARNING • NumPy • SciPy • Scikit – Learn • Pandas • Matplotlib • TensorFlow 7
  • 8. NUMPY • NumPy is a well known general-purpose array-processing package. • An extensive collection of high complexity mathematical functions make NumPy powerful to process large multi-dimensional arrays and matrices. • NumPy is very useful for handling linear algebra, Fourier transforms, and random numbers. • Define arbitrary data types and easily integrate with most databases. • NumPy can also serve as an efficient multi-dimensional container for any generic data that is in any datatype. 8
  • 9. OPERATIONS USING NUMPY 9 Using NumPy, a developer can perform the following operations − Mathematical and logical operations on arrays. Fourier transforms and routines for shape manipulation. Developer can perform Operations related to linear algebra. NumPy has in-built functions for linear algebra and random number generation. Installation of NumPy pip install numpy
  • 10. 10 • Object defined in NumPy is an N-dimensional array type called ndarray. • It describes the collection of items of the same type. • Items in the collection can be accessed using a zero-based index. • Every item in an ndarray takes the same size of block in the memory. • Each element in ndarray is an object of data-type object (called dtype). • Any item extracted from ndarray object (by slicing) is represented by a Python object of one of array scalar types. Figure-1.2 Relationship between ndarray, data type object (dtype) and array scalar type [6]
  • 11. PROGRAM TO PRINT FIRST 25 PRIME NUMBER 11 • def isPrime(num): for i in range(2,num): if (num % i) == 0: return False else: return True print("prime numbers") count, num=0, 2 while count<25: if isPrime(num): print(num) count+=1 num+=1 • Output-Prime Numbers • 2 • 3 • 5 • 7 • 11 • 13 • 17 • 19 • 23 • 29 • 31 • 37 • 41 • 47 • 53 • 59
  • 12. NUMPY(ONE DIMENSIONAL) 12 # this is one dimensional array import numpy as np a = np.arange(24) #Function return the number of dimensions of an array. a.ndim # now reshape it b = a.reshape(2,4,3) b #print b # b is having three dimensions Result- $python main.py [[[ 0 1 2] [ 3 4 5] [ 6 7 8] [ 9 10 11]] [[12 13 14] [15 16 17] [18 19 20] [21 22 23]]]
  • 13. NUMPY-QUESTIONS 13 • Write a Python program to print Factorial of given numbers. • Write a Python program to print all Prime numbers in an Interval. • Write a python program to sort the elements of an Array in Ascending order. • Write a python program to print the Fibonacci series. • Write a Python program to copy all elements of one array into another array. • Write a Python program to print the elements of an array present on even position
  • 14. PYTHON PROGRAMMING- ANACONDA 14 • Anaconda is a free and open source distribution of the Python and R programming languages for large-scale data processing, predictive analytics, and scientific computing. • The advantage of Anaconda is that you have access to over 720 packages that can easily be installed with Anaconda's Conda, a package, dependency, and environment manager. • Anaconda distribution is available for installation at https://www.anaconda.com/download/. For installation on Windows, 32 and 64 bit binaries are available −
  • 16. PYTHON PROGRAMMING 16 E Books- • Peter Harrington “Machine Learning In Action”, DreamTech Press • Ethem Alpaydın, “Introduction to Machine Learning”, MIT Press Video Links- • https://www.youtube.com/watch?v=BRMS3T11Cdw&list=PL3pGy4HtqwD2a 57wl7Cl7tmfxfk7JWJ9Y • https://www.youtube.com/watch?v=EWmCkVfPnJ8&list=PL3pGy4HtqwD2a 57wl7Cl7tmfxfk7JWJ9Y&index=3