SlideShare a Scribd company logo
1 of 15
ATNW-4118
Artificial Neural Networks
BSCS-8 / BSSE-8
Lecture # 2
Python Introduction
• Interpreted high-level programming language for general-purpose programming
• Developed by Guido van Rossum
• First released in 1991
• Free ware
• Determines variable types implicitly
• Relies on indentation as a control structure
• Developer is not forced to define classes
• By default installed on Mac OS X and Linux
• Using Windows, download the latest version of Python from:
• http://www.python.org
• For Jupyter notebook:
• https://jupyter.org/install
Instructor: Tanzila Kehkashan
2
Python IDEs
• Spyder
• Open source cross-platform IDE for data science
• Integrates the essentials libraries for data science, such as NumPy, SciPy,
Matplotlib and IPython
• Jupyter Notebook
• It is a web application based on the server-client structure, and it allows you to
create and manipulate notebook documents - or just “notebooks”.
• RStudio
• IDE for R, a programming language for statistical computing and graphics
• Orange
• Open-source data visualization, machine learning and data mining toolkit
• VSCode
• Includes support for debugging, embedded Git control and GitHub, syntax
highlighting, intelligent code completion, snippets, and code refactoring
Instructor: Tanzila Kehkashan
3
Python Libraries
1. TensorFlow
• developed by Google
• Is used in almost every Google application for machine learning
• For writing new algorithms that involve a large number of tensor operations
• Easily Trainable on CPU as well as GPU for distributed computing
• You can train multiple neural networksand multiple GPUs which makes the models
very efficient on large-scale systems
2. Scikit-Learn
• Associated with NumPy and SciPy
• Contains a numerous number of algorithms for implementing standard machine
learning and data mining tasks like reducing dimensionality, classification,
regression, clustering, and model selection.
• Cross-validation: There are various methods to check the accuracy of supervised
models on unseen data
• Offers many unsupervised learning algorithms e.g; clustering, factor analysis,
principal component analysis to unsupervised neural networks.
Instructor: Tanzila Kehkashan
4
Python Libraries
• Useful for Feature Extraction from images and text (e.g. Bag of words)
3. Numpy
• TensorFlow and other libraries uses Numpy internally for performing multiple
operations on Tensors.
• Array interface is the best and the most important feature of Numpy.
• Can be utilized for expressing images, sound waves, and other binary raw streams
as an array of real numbers in N-dimensional.
4. Keras
• Provides some of the best utilities for compiling models, processing data-sets,
visualization of graphs, and much more
• Keras is comparatively slow
• runs smoothly on both CPU and GPU
• In use at Netflix, Uber, Yelp, Instacart, Zocdoc, Square, and many others.
• Popular among startups that place deep learning at the core of their products.
• provides many pre-processed data-sets and pre-trained models like MNIST, VGG,
Inception, SqueezeNet, ResNet etc
Instructor: Tanzila Kehkashan
5
Python Libraries
5. PyTorch
• primarily used for applications such as NLP
• It is primarily developed by Facebook’s artificial-intelligence research group and
Uber’s “Pyro” software for probabilistic programming is built on it.
6. LightGBM, XGBoost, and CatBoost
• helps developers in building new algorithms by using redefined elementary
models and namely decision trees.
7. Eli5
• Mathematical applications which requires a lot of computation in a short time
8. SciPy
• SciPy library contains modules for optimization, linear algebra, integration, and
statistics
• Solving mathematical functions
• Tasks including linear algebra, integration (calculus), ordinary differential equation
solving and signal processing
Instructor: Tanzila Kehkashan
6
Python Libraries
9. Theano
• For computing multidimensional arrays
• Can also be used on a distributed or parallel environments just similar to
TensorFlow
10.Pandas
• Have so many inbuilt methods for grouping, combining data, and filtering, as
well as time-series functionality
• Re-indexing, Iteration, Sorting, Aggregations, Concatenations and
Visualizations
11.NLTK
• Natural language toolkit and commonly called the mother of all NLP libraries.
• It is one of the mature primary resources when it comes to Python and NLP.
Instructor: Tanzila Kehkashan
7
Python Commands
Arithmetic Operators
• +, - , /, *, **
Comments
• # this is single line comments
• “““ this is
multiline comments”””
Instructor: Tanzila Kehkashan
8
range() Function
• Generates arithmetic progressions
Control Flow – for statement
Instructor: Tanzila Kehkashan
9
Control Flow – for statement
Sr.No. Control
Statement
Description
1 break statement Terminates loop statement and transfers execution to statement immediately
following loop.
2 continue
statement
Causes loop to skip remainder of its body and immediately retest its
condition prior to reiterating.
3 pass statement Pass statement in Python is used when a statement is required syntactically
but you do not want any command or code to execute.
Instructor: Tanzila Kehkashan
10
Defining Functions
>>> def f(x):
... return x*x
...
Function header
Function body
>>> f(2)
4
>>> f(2.5)
6.25
Function call
def function-name(Parameter list):
statements, i.e. the function body
• Syntax
• Example
• Arbitrary Number of Parameters
def arbitrary(x, y, *more):
print "x=", x, ", y=", y
print "arbitrary: ", more
>>> arbitrary(3,4)
x= 3 , y= 4
arbitrary: ()
>>> arbitrary(3,4, "Hello World", 3 ,4)
x= 3 , y= 4
arbitrary: ('Hello World', 3, 4)
Instructor: Tanzila Kehkashan
11
Defining Functions
Instructor: Tanzila Kehkashan
12
Modules (files)
• Use any text editor to type the code into a file with extension .py
• To test the code, import it into a Python session and try to run it
• indentation is still important
• Syntax
• File’s extension (.py) is omitted in the import command
from file-name import function-name
Instructor: Tanzila Kehkashan
13
Python Built-in Data Structures
• Lists are enclosed in brackets. Tuples are enclosed in parentheses. Dictionaries are
built with curly brackets.
l = [1, 2, "a"]
t = (1, 2, "a")
d = {"a":1, "b":2}
Data Structure Sequence Data Can Contain
1 Lists Ordered Mutable Any type of objects
2 Tuples Ordered Immutable Any type of objects
3 Strings Ordered Mutable Only characters
4 Dictionaries Unordered Keys immutable Any type of objects
5 Sets Unordered Mutable Any type of unique
objects
6 Frozensets Unordered Immutable Any type of unique
objects
Instructor: Tanzila Kehkashan
14
Instructor: Tanzila Kehkashan
15

More Related Content

Similar to ANN-Lecture2-Python Startup.pptx

3 python packages
3 python packages3 python packages
3 python packagesFEG
 
Hot to build continuously processing for 24/7 real-time data streaming platform?
Hot to build continuously processing for 24/7 real-time data streaming platform?Hot to build continuously processing for 24/7 real-time data streaming platform?
Hot to build continuously processing for 24/7 real-time data streaming platform?GetInData
 
Machine learning from software developers point of view
Machine learning from software developers point of viewMachine learning from software developers point of view
Machine learning from software developers point of viewPierre Paci
 
Introduction to Jupyter notebook and MS Azure Machine Learning Studio
Introduction to Jupyter notebook and MS Azure Machine Learning StudioIntroduction to Jupyter notebook and MS Azure Machine Learning Studio
Introduction to Jupyter notebook and MS Azure Machine Learning StudioMuralidharan Deenathayalan
 
Introduction to Jupyter notebook and MS Azure Machine Learning Studio
Introduction to Jupyter notebook and MS Azure Machine Learning StudioIntroduction to Jupyter notebook and MS Azure Machine Learning Studio
Introduction to Jupyter notebook and MS Azure Machine Learning StudioMuralidharan Deenathayalan
 
Python For Audio Signal Processing ( PDFDrive ).pdf
Python For Audio Signal Processing ( PDFDrive ).pdfPython For Audio Signal Processing ( PDFDrive ).pdf
Python For Audio Signal Processing ( PDFDrive ).pdfshaikriyaz89
 
A Deeper Dive into Apache MXNet - March 2017 AWS Online Tech Talks
A Deeper Dive into Apache MXNet - March 2017 AWS Online Tech TalksA Deeper Dive into Apache MXNet - March 2017 AWS Online Tech Talks
A Deeper Dive into Apache MXNet - March 2017 AWS Online Tech TalksAmazon Web Services
 
A Deeper Dive into Apache MXNet - March 2017 AWS Online Tech Talks
A Deeper Dive into Apache MXNet - March 2017 AWS Online Tech TalksA Deeper Dive into Apache MXNet - March 2017 AWS Online Tech Talks
A Deeper Dive into Apache MXNet - March 2017 AWS Online Tech TalksAmazon Web Services
 
Fast and Scalable Python
Fast and Scalable PythonFast and Scalable Python
Fast and Scalable PythonTravis Oliphant
 
2018 03 25 system ml ai and openpower meetup
2018 03 25 system ml ai and openpower meetup2018 03 25 system ml ai and openpower meetup
2018 03 25 system ml ai and openpower meetupGanesan Narayanasamy
 

Similar to ANN-Lecture2-Python Startup.pptx (20)

3 python packages
3 python packages3 python packages
3 python packages
 
Python libraries
Python librariesPython libraries
Python libraries
 
PyData Boston 2013
PyData Boston 2013PyData Boston 2013
PyData Boston 2013
 
Hot to build continuously processing for 24/7 real-time data streaming platform?
Hot to build continuously processing for 24/7 real-time data streaming platform?Hot to build continuously processing for 24/7 real-time data streaming platform?
Hot to build continuously processing for 24/7 real-time data streaming platform?
 
Python ml
Python mlPython ml
Python ml
 
python ppt.pptx
python ppt.pptxpython ppt.pptx
python ppt.pptx
 
Machine learning from software developers point of view
Machine learning from software developers point of viewMachine learning from software developers point of view
Machine learning from software developers point of view
 
Introduction to Jupyter notebook and MS Azure Machine Learning Studio
Introduction to Jupyter notebook and MS Azure Machine Learning StudioIntroduction to Jupyter notebook and MS Azure Machine Learning Studio
Introduction to Jupyter notebook and MS Azure Machine Learning Studio
 
Introduction to Jupyter notebook and MS Azure Machine Learning Studio
Introduction to Jupyter notebook and MS Azure Machine Learning StudioIntroduction to Jupyter notebook and MS Azure Machine Learning Studio
Introduction to Jupyter notebook and MS Azure Machine Learning Studio
 
Python For Audio Signal Processing ( PDFDrive ).pdf
Python For Audio Signal Processing ( PDFDrive ).pdfPython For Audio Signal Processing ( PDFDrive ).pdf
Python For Audio Signal Processing ( PDFDrive ).pdf
 
A Deeper Dive into Apache MXNet - March 2017 AWS Online Tech Talks
A Deeper Dive into Apache MXNet - March 2017 AWS Online Tech TalksA Deeper Dive into Apache MXNet - March 2017 AWS Online Tech Talks
A Deeper Dive into Apache MXNet - March 2017 AWS Online Tech Talks
 
A Deeper Dive into Apache MXNet - March 2017 AWS Online Tech Talks
A Deeper Dive into Apache MXNet - March 2017 AWS Online Tech TalksA Deeper Dive into Apache MXNet - March 2017 AWS Online Tech Talks
A Deeper Dive into Apache MXNet - March 2017 AWS Online Tech Talks
 
Python for ML
Python for MLPython for ML
Python for ML
 
Python PPT 50.pptx
Python PPT 50.pptxPython PPT 50.pptx
Python PPT 50.pptx
 
Large Data Analyze With PyTables
Large Data Analyze With PyTablesLarge Data Analyze With PyTables
Large Data Analyze With PyTables
 
Py tables
Py tablesPy tables
Py tables
 
PyTables
PyTablesPyTables
PyTables
 
Fast and Scalable Python
Fast and Scalable PythonFast and Scalable Python
Fast and Scalable Python
 
Python with dataScience
Python with dataSciencePython with dataScience
Python with dataScience
 
2018 03 25 system ml ai and openpower meetup
2018 03 25 system ml ai and openpower meetup2018 03 25 system ml ai and openpower meetup
2018 03 25 system ml ai and openpower meetup
 

Recently uploaded

Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfJayanti Pande
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfagholdier
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdfSoniaTolstoy
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxVishalSingh1417
 
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...fonyou31
 
General AI for Medical Educators April 2024
General AI for Medical Educators April 2024General AI for Medical Educators April 2024
General AI for Medical Educators April 2024Janet Corral
 
Disha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdfDisha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdfchloefrazer622
 
Arihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfArihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfchloefrazer622
 
Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3JemimahLaneBuaron
 
9548086042 for call girls in Indira Nagar with room service
9548086042  for call girls in Indira Nagar  with room service9548086042  for call girls in Indira Nagar  with room service
9548086042 for call girls in Indira Nagar with room servicediscovermytutordmt
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Sapana Sha
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Celine George
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfsanyamsingh5019
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeThiyagu K
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactPECB
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13Steve Thomason
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...EduSkills OECD
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxiammrhaywood
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfAdmir Softic
 

Recently uploaded (20)

Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdf
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptx
 
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
 
General AI for Medical Educators April 2024
General AI for Medical Educators April 2024General AI for Medical Educators April 2024
General AI for Medical Educators April 2024
 
Disha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdfDisha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdf
 
Arihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfArihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdf
 
Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3
 
9548086042 for call girls in Indira Nagar with room service
9548086042  for call girls in Indira Nagar  with room service9548086042  for call girls in Indira Nagar  with room service
9548086042 for call girls in Indira Nagar with room service
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
 
Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdf
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and Mode
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global Impact
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdf
 

ANN-Lecture2-Python Startup.pptx

  • 2. Python Introduction • Interpreted high-level programming language for general-purpose programming • Developed by Guido van Rossum • First released in 1991 • Free ware • Determines variable types implicitly • Relies on indentation as a control structure • Developer is not forced to define classes • By default installed on Mac OS X and Linux • Using Windows, download the latest version of Python from: • http://www.python.org • For Jupyter notebook: • https://jupyter.org/install Instructor: Tanzila Kehkashan 2
  • 3. Python IDEs • Spyder • Open source cross-platform IDE for data science • Integrates the essentials libraries for data science, such as NumPy, SciPy, Matplotlib and IPython • Jupyter Notebook • It is a web application based on the server-client structure, and it allows you to create and manipulate notebook documents - or just “notebooks”. • RStudio • IDE for R, a programming language for statistical computing and graphics • Orange • Open-source data visualization, machine learning and data mining toolkit • VSCode • Includes support for debugging, embedded Git control and GitHub, syntax highlighting, intelligent code completion, snippets, and code refactoring Instructor: Tanzila Kehkashan 3
  • 4. Python Libraries 1. TensorFlow • developed by Google • Is used in almost every Google application for machine learning • For writing new algorithms that involve a large number of tensor operations • Easily Trainable on CPU as well as GPU for distributed computing • You can train multiple neural networksand multiple GPUs which makes the models very efficient on large-scale systems 2. Scikit-Learn • Associated with NumPy and SciPy • Contains a numerous number of algorithms for implementing standard machine learning and data mining tasks like reducing dimensionality, classification, regression, clustering, and model selection. • Cross-validation: There are various methods to check the accuracy of supervised models on unseen data • Offers many unsupervised learning algorithms e.g; clustering, factor analysis, principal component analysis to unsupervised neural networks. Instructor: Tanzila Kehkashan 4
  • 5. Python Libraries • Useful for Feature Extraction from images and text (e.g. Bag of words) 3. Numpy • TensorFlow and other libraries uses Numpy internally for performing multiple operations on Tensors. • Array interface is the best and the most important feature of Numpy. • Can be utilized for expressing images, sound waves, and other binary raw streams as an array of real numbers in N-dimensional. 4. Keras • Provides some of the best utilities for compiling models, processing data-sets, visualization of graphs, and much more • Keras is comparatively slow • runs smoothly on both CPU and GPU • In use at Netflix, Uber, Yelp, Instacart, Zocdoc, Square, and many others. • Popular among startups that place deep learning at the core of their products. • provides many pre-processed data-sets and pre-trained models like MNIST, VGG, Inception, SqueezeNet, ResNet etc Instructor: Tanzila Kehkashan 5
  • 6. Python Libraries 5. PyTorch • primarily used for applications such as NLP • It is primarily developed by Facebook’s artificial-intelligence research group and Uber’s “Pyro” software for probabilistic programming is built on it. 6. LightGBM, XGBoost, and CatBoost • helps developers in building new algorithms by using redefined elementary models and namely decision trees. 7. Eli5 • Mathematical applications which requires a lot of computation in a short time 8. SciPy • SciPy library contains modules for optimization, linear algebra, integration, and statistics • Solving mathematical functions • Tasks including linear algebra, integration (calculus), ordinary differential equation solving and signal processing Instructor: Tanzila Kehkashan 6
  • 7. Python Libraries 9. Theano • For computing multidimensional arrays • Can also be used on a distributed or parallel environments just similar to TensorFlow 10.Pandas • Have so many inbuilt methods for grouping, combining data, and filtering, as well as time-series functionality • Re-indexing, Iteration, Sorting, Aggregations, Concatenations and Visualizations 11.NLTK • Natural language toolkit and commonly called the mother of all NLP libraries. • It is one of the mature primary resources when it comes to Python and NLP. Instructor: Tanzila Kehkashan 7
  • 8. Python Commands Arithmetic Operators • +, - , /, *, ** Comments • # this is single line comments • “““ this is multiline comments””” Instructor: Tanzila Kehkashan 8
  • 9. range() Function • Generates arithmetic progressions Control Flow – for statement Instructor: Tanzila Kehkashan 9
  • 10. Control Flow – for statement Sr.No. Control Statement Description 1 break statement Terminates loop statement and transfers execution to statement immediately following loop. 2 continue statement Causes loop to skip remainder of its body and immediately retest its condition prior to reiterating. 3 pass statement Pass statement in Python is used when a statement is required syntactically but you do not want any command or code to execute. Instructor: Tanzila Kehkashan 10
  • 11. Defining Functions >>> def f(x): ... return x*x ... Function header Function body >>> f(2) 4 >>> f(2.5) 6.25 Function call def function-name(Parameter list): statements, i.e. the function body • Syntax • Example • Arbitrary Number of Parameters def arbitrary(x, y, *more): print "x=", x, ", y=", y print "arbitrary: ", more >>> arbitrary(3,4) x= 3 , y= 4 arbitrary: () >>> arbitrary(3,4, "Hello World", 3 ,4) x= 3 , y= 4 arbitrary: ('Hello World', 3, 4) Instructor: Tanzila Kehkashan 11
  • 13. Modules (files) • Use any text editor to type the code into a file with extension .py • To test the code, import it into a Python session and try to run it • indentation is still important • Syntax • File’s extension (.py) is omitted in the import command from file-name import function-name Instructor: Tanzila Kehkashan 13
  • 14. Python Built-in Data Structures • Lists are enclosed in brackets. Tuples are enclosed in parentheses. Dictionaries are built with curly brackets. l = [1, 2, "a"] t = (1, 2, "a") d = {"a":1, "b":2} Data Structure Sequence Data Can Contain 1 Lists Ordered Mutable Any type of objects 2 Tuples Ordered Immutable Any type of objects 3 Strings Ordered Mutable Only characters 4 Dictionaries Unordered Keys immutable Any type of objects 5 Sets Unordered Mutable Any type of unique objects 6 Frozensets Unordered Immutable Any type of unique objects Instructor: Tanzila Kehkashan 14