SlideShare a Scribd company logo
1 of 30
INTRODUCTION
TO
PYTHON FOR AI
By: Ms.Sarah Ahmed
Email id:
sara.ahmed@nu.edu.pk
ssarahahmedd@gmail.com
NOTE
Being disciplined shows self-respect and a commitment to your
education.
If anything I've shared doesn't click, please feel free to ask! I'm always
happy to clarify and can be reached via email at
sara.ahmed@nu.edu.pk
KEY TERMS
Packages:
Definition: A package is a collection of related files (code, data,
configuration) that are bundled together for distribution and reuse. It
acts as a container for other components like libraries and modules.
Example: NumPy, a package for scientific computing in Python,
includes modules for arrays, matrices, and random number
generation.
Key points:
 Provide organization and ease of distribution for related code.
 Can include various components like libraries, modules, data files, and
documentation.
 Often managed through package managers like pip.
KEY TERMS
KEY TERMS
Libraries:
Definition: A library is a collection of pre-written code that provides
specific functions and functionalities for developers to use in their
programs. It acts as a building block for higher-level applications.
Example: TensorFlow, a library for machine learning in Python, offers
functions for building and training neural networks.
Key points:
 Offer reusable code blocks for specific tasks.
 Improve development efficiency by avoiding writing common code from scratch.
 Can be included within packages or exist independently.
KEY TERMS
KEY TERMS
APIs (Application Programming Interfaces):
Definition: An API is a set of defined methods and protocols that
allow different software programs to communicate and exchange
data. It acts as a bridge between systems.
Example: The Google Maps API allows developers to integrate maps
and directions functionalities into their applications.
Key points:
 Define how programs interact and share data.
 Enable building applications on top of existing platforms and services.
 Can be internal (within a system) or external (exposed for other developers to use).
KEY TERMS:
Both pip and PyPI are essential parts of the Python package
ecosystem, but they serve different purposes:
PyPI (Python Package Index):
A repository containing thousands of open-source Python packages
for various tasks like data science, web development, machine
learning, and more.
Think of it as a library or app store for Python code.
Packages are uploaded and maintained by individual developers or
organizations.
Users can browse, search, and download packages from PyPI.
KEY TERMS:
pip (Package Installer for Python): Use pip if you're working with
Python code and need packages for scientific computing, data
analysis, machine learning, or general Python development.
A tool used to install, uninstall, and manage packages from PyPI.
Think of it as a package manager similar to apt in Linux or npm in
JavaScript.
Allows you to specify packages by name and version, and pip takes
care of downloading, installing, and resolving dependencies.
Integrates with virtual environments to isolate project dependencies.
KEY TERMS:
Frameworks:
Definition: A structured and pre-written codebase that defines an
overall application architecture and provides specific functionality.
Think of it as: A blueprint for building an application within a specific
architecture.
Examples: Django for web development, Flask for
microservices, TensorFlow for machine learning.
Key features:
 Define application structure and workflows.
 Come with ready-made components and functionalities.
WHEN TO USE:
Use packages for modularity and organizing related code.
Use libraries for specific functionalities within your projects.
Use frameworks for building entire applications within a pre-defined
structure.
Use APIs for interacting with external programs or platforms.
SIMULATION VS PROGRAMMING
Simulation: Focuses on modeling and understanding the behavior of a
system or process. It's about how things interact and change over time.
It's the entire experience of setting up the model, defining the
parameters, and analyzing the generated data. Think of it as the "experiment"
conducted using the simulator.
Programming: Focuses on creating instructions for a computer to perform
specific tasks. It's about defining operations and algorithms to achieve a
desired outcome.
Approach:
Simulation: Often uses mathematical models, equations, and rules to define
the behavior of individual elements and their interactions.
Programming: Uses code and data structures to define specific steps and
procedures for the computer to execute.
SIMULATOR
Simulator:
Refers to the tool or software used to run a simulation. It's the
platform that implements the model, defines the rules, and executes
the interactions between elements. Think of it as the "engine" driving
the simulation.
Can be a specific program or a general-purpose platform. Examples
include flight simulators or traffic simulators
HOW DOES PYTHON HELP TO BUILD AI
THINKING HUMANLY, RATIONALLY, AND
ACTING ACCORDINGLY?
Python plays a crucial role in the quest to build AI that thinks and acts
like humans. Here's how it contributes to each aspect:
Thinking Humanly:
Natural Language Processing (NLP): Python libraries like NLTK and
spaCy facilitate text analysis, sentiment detection, and dialogue
generation, allowing AI to understand and respond to human
language nuances like context and emotions.
Machine Learning (ML): Libraries like scikit-learn and TensorFlow
enable building AI models that learn from vast amounts of
data, mimicking human-like knowledge acquisition and adaptation.
Symbolic AI: Libraries like PySymbolics allow manipulating symbols
and building knowledge graphs, essential for simulating human
reasoning and inferential thinking.
HOW DOES PYTHON HELP TO BUILD AI
THINKING HUMANLY, RATIONALLY, AND
ACTING ACCORDINGLY?
Thinking Rationally:
Logic Programming: Package like PySWI-Prolog enable AI to express
reasoning rules and problem-solving strategies, promoting
logical, deductive thinking.
SWI-Prolog is a free implementation of the programming language
Prolog, commonly used for semantic web applications.
Planning and Scheduling: Packages like PyPlanning and ai2 planning
allow building AI agents that make decisions and perform actions
based on logical constraints and goals, mimicking rational planning
and execution.
Probabilistic Reasoning: Libraries like NumPy and SciPy enable
building AI models that reason with uncertainty and handle
incomplete information, mimicking human decision-making under
limited knowledge.
HOW DOES PYTHON HELP TO BUILD AI
THINKING HUMANLY, RATIONALLY, AND
ACTING ACCORDINGLY?
Acting Humanly:
Computer Vision (CV): Libraries like OpenCV and PyTorch allow
building AI models that interpret visual information and extract
meaning from images and videos, simulating human visual
perception.
Robotics: Libraries like Pyrobot and RobotPy enable programming
robot movements and interactions with the physical world, leading to
AI that can act and manipulate objects human-like.
Reinforcement Learning (RL): Libraries like Gym and Stable
Baselines3 allow building AI agents that learn through trial-and-
error, gradually developing human-like skills and strategies for
achieving goals.
HOW DOES PYTHON HELP TO BUILD AI
THINKING HUMANLY, RATIONALLY, AND
ACTING ACCORDINGLY?
Acting Rationally:
Optimization: Libraries like SciPy and Optuna enable AI to find
optimal solutions to complex problems with numerous constraints,
mimicking rational decision-making and resource allocation.
Game Playing: Libraries like PySC2 and DeepMind Lab provide
platforms for building AI agents that learn to play games
strategically, requiring rational planning and action selection.
Agent Simulation: Libraries like Mesa and RLlib allow building and
simulating multi-agent systems, enabling the study of AI interactions
and the emergence of collective intelligence, promoting rational
coordination and behavior.
PYTHON
Python is a high-level, general-purpose programming language.
Key Characteristics:
Readability: Python's syntax is remarkably clear and resembles natural English, making it easy to learn and
comprehend, even for those new to programming.
Versatility: Python empowers you to tackle a wide array of tasks across diverse fields, including:
 Web development: Build dynamic websites and web applications using frameworks like Django and Flask.
 Data science: Analyze and visualize data effectively with libraries like NumPy, Pandas, and Matplotlib.
 Machine learning: Develop intelligent systems capable of learning from data using libraries like
TensorFlow and scikit-learn.
 Automation: Streamline repetitive tasks and workflows, saving time and effort.
 Scientific computing: Perform complex mathematical computations and simulations.
PYTHON
Open-source and free: Python is freely available for anyone to
use, modify, and distribute, fostering a vibrant community of
developers.
Extensive libraries and frameworks: Python boasts a rich ecosystem
of pre-written code modules that extend its functionality, saving you
time and effort.
Cross-platform compatibility: Python code can run smoothly on
Windows, macOS, Linux, and even embedded systems, ensuring
flexibility.
PYTHON DISTRIBUTIONS
Imagine them as pre-packaged bundles of the Python interpreter, essential
libraries, and tools, tailored for specific needs and purposes. They simplify setup
and provide a ready-to-use environment for developers. They also provide at
least one integrated development environment (IDE).
Anaconda: Anaconda is a powerhouse for data science and scientific
computing.
ActivePython: A commercial distribution focusing on security and
stability, popular for enterprise use.
Miniconda: A smaller version of Anaconda, ideal for lighter deployments or
embedding Python in other applications.
PyPy: A just-in-time (JIT) compiled Python interpreter offering faster execution
speed compared to the standard CPython interpreter.
MicroPython: Designed for running Python on microcontrollers and embedded
systems.
Windows 10/11 built-in Python: A basic Python installation included in recent
Windows versions.
PLATFORMS FOR PYTHON CODING
Integrated Development Environments (IDEs)- are like all-in-one toolboxes
for programmers, combining various functionalities within a single, unified
interface.
PyCharm: Powerful and feature-rich IDE with excellent Python support, code
completion, debugging, and project management tools. Excellent for
professional development.
Visual Studio Code: Highly customizable and lightweight code editor with
extensive Python extensions for debugging, linting, and code completion.
Offers great flexibility for individual preferences.
Spyder: Open-source scientific Python IDE with integrated tools for data
analysis, scientific computing, and interactive coding. Ideal for data
scientists and researchers.
Linting is the process of using a lint tool to automatically check source code
for errors. A lint tool, also known as a linter, is a basic static code analyzer.
PLATFORMS FOR PYTHON CODING
Code Editors:
Sublime Text: Powerful and fast code editor with a minimalist
interface and extensive plugin ecosystem. Great for experienced
developers who prefer customization.
Atom: Open-source hackable editor with an extensive package
manager offering various Python features and functionalities. Popular
choice for beginners and intermediate users.
Vim: short for Vi IMproved, is a configurable text editor often used
as a Python development environment.
PLATFORMS FOR PYTHON CODING
Online Platforms:
Repl.it: Online Python interpreter and coding environment.Perfect for
quick experimentation and learning the basics.
Google Colab: Free cloud-based Jupyter Notebook environment with
pre-installed libraries and GPUs for data science and machine
learning projects. Ideal for researchers and data enthusiasts.
Heroku: Cloud platform for deploying Python applications with one-
click deploys and automatic scaling. Ideal for web development and
deploying projects online.
PYTHON LIBRARIES
•NumPy: Scientific computing library for advanced array manipulation, linear
algebra, and random number generation.
•pandas: Data analysis library for importing, processing, manipulating, and
analyzing data in various formats.
•Matplotlib and Seaborn: Data visualization libraries for creating various types
of charts and plots.
•Scikit-learn: Machine learning library for building and evaluating various
machine learning models.
•Beautiful Soup: Web scraping library for extracting data from HTML websites.
•Requests: HTTP library for making web requests and downloading content.
•Django and Flask: Web development frameworks for building web
applications efficiently.
PYTHON FRAMEWORKS
Django: Full-stack web framework for building secure and scalable
web applications.
Flask: Lightweight web framework for building small to medium-
sized web applications rapidly.
Web2py: Rapid application development framework for building web
applications quickly and easily.
Kivy: Cross-platform framework for building desktop, mobile, and
web applications with a similar codebase.
PYTHON DEEP LEARNING
FRAMEWORKS
TensorFlow,
PyTorch,
 Keras
 Theano
When to use:
•Beginners: Keras or PyTorch are easier to learn with their concise APIs.
•Production deployment: TensorFlow has the most mature deployment tools and is widely
used in real-world applications.
•Research and experimentation: PyTorch's dynamic computation graph and flexibility make
it ideal for exploring new ideas.
•Scalability and large datasets: TensorFlow offers the best scalability and performance for
demanding projects.
•Scientific computing: Theano might be a good choice for its research focus and fast
computation.
OTHER FRAMEWORKS:
MXNet: Scalable and efficient framework favored for computer vision
and natural language processing.
Chainer: Flexible and easy-to-extend framework, popular among
researchers for its customizability.
CNTK: Microsoft's offering, known for its strong support for GPU
acceleration.
PYTHON APIS
REST APIs: Popular API architecture focused on stateless HTTP
requests and responses with resources identified by URIs.
GraphQL: API query language that allows fetching specific data
efficiently without requiring pre-defined endpoints.
OpenAI API: Provides access to powerful language models like GPT-
3 for generating text, translating languages, and writing different
kinds of creative content.
Twitter API: Allows access to Twitter data for analysis and research.
OPEN GOOGLECOLAB
Introduction to Python Programming Language For Artificial Intelligence

More Related Content

Similar to Introduction to Python Programming Language For Artificial Intelligence

What Is The Future of Data Science With Python?
What Is The Future of Data Science With Python?What Is The Future of Data Science With Python?
What Is The Future of Data Science With Python?SofiaCarter4
 
What is Python? An overview of Python for science.
What is Python? An overview of Python for science.What is Python? An overview of Python for science.
What is Python? An overview of Python for science.Nicholas Pringle
 
A Whirlwind Tour Of Python
A Whirlwind Tour Of PythonA Whirlwind Tour Of Python
A Whirlwind Tour Of PythonAsia Smith
 
Ways To Become A Good Python Developer
Ways To Become A Good Python DeveloperWays To Become A Good Python Developer
Ways To Become A Good Python DeveloperCodeMonk
 
Get Started With Python Language.pdf
Get Started With Python Language.pdfGet Started With Python Language.pdf
Get Started With Python Language.pdfCerebrum Infotech
 
Mastering the Interview: 50 Common Interview Questions Demystified
Mastering the Interview: 50 Common Interview Questions DemystifiedMastering the Interview: 50 Common Interview Questions Demystified
Mastering the Interview: 50 Common Interview Questions DemystifiedMalcolmDupri
 
The-Power-of-Python-Programming.pptx
The-Power-of-Python-Programming.pptxThe-Power-of-Python-Programming.pptx
The-Power-of-Python-Programming.pptxPreethyJemi
 
Top 11 python frameworks for machine learning and deep learning
Top 11 python frameworks for machine learning and deep learningTop 11 python frameworks for machine learning and deep learning
Top 11 python frameworks for machine learning and deep learningThinkTanker Technosoft PVT LTD
 
python programming.pptx
python programming.pptxpython programming.pptx
python programming.pptxKaviya452563
 
Python for Data Science: Trends and Tools
Python for Data Science: Trends and ToolsPython for Data Science: Trends and Tools
Python for Data Science: Trends and ToolsSaschayaPranev
 

Similar to Introduction to Python Programming Language For Artificial Intelligence (20)

Python Mastery Made Easy.pdf
Python Mastery Made Easy.pdfPython Mastery Made Easy.pdf
Python Mastery Made Easy.pdf
 
What Is The Future of Data Science With Python?
What Is The Future of Data Science With Python?What Is The Future of Data Science With Python?
What Is The Future of Data Science With Python?
 
What is Python? An overview of Python for science.
What is Python? An overview of Python for science.What is Python? An overview of Python for science.
What is Python? An overview of Python for science.
 
A Whirlwind Tour Of Python
A Whirlwind Tour Of PythonA Whirlwind Tour Of Python
A Whirlwind Tour Of Python
 
Ways To Become A Good Python Developer
Ways To Become A Good Python DeveloperWays To Become A Good Python Developer
Ways To Become A Good Python Developer
 
python programming.pdf
python programming.pdfpython programming.pdf
python programming.pdf
 
Python
PythonPython
Python
 
Python libraries
Python librariesPython libraries
Python libraries
 
Toolboxes for data scientists
Toolboxes for data scientistsToolboxes for data scientists
Toolboxes for data scientists
 
Get Started With Python Language.pdf
Get Started With Python Language.pdfGet Started With Python Language.pdf
Get Started With Python Language.pdf
 
AI & ML
AI & MLAI & ML
AI & ML
 
Mastering the Interview: 50 Common Interview Questions Demystified
Mastering the Interview: 50 Common Interview Questions DemystifiedMastering the Interview: 50 Common Interview Questions Demystified
Mastering the Interview: 50 Common Interview Questions Demystified
 
The-Power-of-Python-Programming.pptx
The-Power-of-Python-Programming.pptxThe-Power-of-Python-Programming.pptx
The-Power-of-Python-Programming.pptx
 
Top 11 python frameworks for machine learning and deep learning
Top 11 python frameworks for machine learning and deep learningTop 11 python frameworks for machine learning and deep learning
Top 11 python frameworks for machine learning and deep learning
 
Python
Python Python
Python
 
Python Development.pptx
Python Development.pptxPython Development.pptx
Python Development.pptx
 
Python
PythonPython
Python
 
ppt_template for EDA.pptx
ppt_template for EDA.pptxppt_template for EDA.pptx
ppt_template for EDA.pptx
 
python programming.pptx
python programming.pptxpython programming.pptx
python programming.pptx
 
Python for Data Science: Trends and Tools
Python for Data Science: Trends and ToolsPython for Data Science: Trends and Tools
Python for Data Science: Trends and Tools
 

Recently uploaded

How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17Celine George
 
Hierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of managementHierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of managementmkooblal
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxGaneshChakor2
 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon AUnboundStockton
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxpboyjonauth
 
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdfFraming an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdfUjwalaBharambe
 
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxOH TEIK BIN
 
भारत-रोम व्यापार.pptx, Indo-Roman Trade,
भारत-रोम व्यापार.pptx, Indo-Roman Trade,भारत-रोम व्यापार.pptx, Indo-Roman Trade,
भारत-रोम व्यापार.pptx, Indo-Roman Trade,Virag Sontakke
 
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...M56BOOKSTORE PRODUCT/SERVICE
 
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfEnzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfSumit Tiwari
 
Pharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdfPharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdfMahmoud M. Sallam
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...Marc Dusseiller Dusjagr
 
Meghan Sutherland In Media Res Media Component
Meghan Sutherland In Media Res Media ComponentMeghan Sutherland In Media Res Media Component
Meghan Sutherland In Media Res Media ComponentInMediaRes1
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Educationpboyjonauth
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdfssuser54595a
 
Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentAlper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentInMediaRes1
 
Capitol Tech U Doctoral Presentation - April 2024.pptx
Capitol Tech U Doctoral Presentation - April 2024.pptxCapitol Tech U Doctoral Presentation - April 2024.pptx
Capitol Tech U Doctoral Presentation - April 2024.pptxCapitolTechU
 

Recently uploaded (20)

TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdfTataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
 
How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17
 
Hierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of managementHierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of management
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptx
 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon A
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptx
 
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdfFraming an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
 
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptx
 
भारत-रोम व्यापार.pptx, Indo-Roman Trade,
भारत-रोम व्यापार.pptx, Indo-Roman Trade,भारत-रोम व्यापार.pptx, Indo-Roman Trade,
भारत-रोम व्यापार.pptx, Indo-Roman Trade,
 
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
 
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
 
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfEnzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
 
Pharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdfPharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdf
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
 
Meghan Sutherland In Media Res Media Component
Meghan Sutherland In Media Res Media ComponentMeghan Sutherland In Media Res Media Component
Meghan Sutherland In Media Res Media Component
 
OS-operating systems- ch04 (Threads) ...
OS-operating systems- ch04 (Threads) ...OS-operating systems- ch04 (Threads) ...
OS-operating systems- ch04 (Threads) ...
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Education
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
 
Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentAlper Gobel In Media Res Media Component
Alper Gobel In Media Res Media Component
 
Capitol Tech U Doctoral Presentation - April 2024.pptx
Capitol Tech U Doctoral Presentation - April 2024.pptxCapitol Tech U Doctoral Presentation - April 2024.pptx
Capitol Tech U Doctoral Presentation - April 2024.pptx
 

Introduction to Python Programming Language For Artificial Intelligence

  • 1. INTRODUCTION TO PYTHON FOR AI By: Ms.Sarah Ahmed Email id: sara.ahmed@nu.edu.pk ssarahahmedd@gmail.com
  • 2. NOTE Being disciplined shows self-respect and a commitment to your education. If anything I've shared doesn't click, please feel free to ask! I'm always happy to clarify and can be reached via email at sara.ahmed@nu.edu.pk
  • 3. KEY TERMS Packages: Definition: A package is a collection of related files (code, data, configuration) that are bundled together for distribution and reuse. It acts as a container for other components like libraries and modules. Example: NumPy, a package for scientific computing in Python, includes modules for arrays, matrices, and random number generation. Key points:  Provide organization and ease of distribution for related code.  Can include various components like libraries, modules, data files, and documentation.  Often managed through package managers like pip.
  • 5. KEY TERMS Libraries: Definition: A library is a collection of pre-written code that provides specific functions and functionalities for developers to use in their programs. It acts as a building block for higher-level applications. Example: TensorFlow, a library for machine learning in Python, offers functions for building and training neural networks. Key points:  Offer reusable code blocks for specific tasks.  Improve development efficiency by avoiding writing common code from scratch.  Can be included within packages or exist independently.
  • 7. KEY TERMS APIs (Application Programming Interfaces): Definition: An API is a set of defined methods and protocols that allow different software programs to communicate and exchange data. It acts as a bridge between systems. Example: The Google Maps API allows developers to integrate maps and directions functionalities into their applications. Key points:  Define how programs interact and share data.  Enable building applications on top of existing platforms and services.  Can be internal (within a system) or external (exposed for other developers to use).
  • 8. KEY TERMS: Both pip and PyPI are essential parts of the Python package ecosystem, but they serve different purposes: PyPI (Python Package Index): A repository containing thousands of open-source Python packages for various tasks like data science, web development, machine learning, and more. Think of it as a library or app store for Python code. Packages are uploaded and maintained by individual developers or organizations. Users can browse, search, and download packages from PyPI.
  • 9. KEY TERMS: pip (Package Installer for Python): Use pip if you're working with Python code and need packages for scientific computing, data analysis, machine learning, or general Python development. A tool used to install, uninstall, and manage packages from PyPI. Think of it as a package manager similar to apt in Linux or npm in JavaScript. Allows you to specify packages by name and version, and pip takes care of downloading, installing, and resolving dependencies. Integrates with virtual environments to isolate project dependencies.
  • 10. KEY TERMS: Frameworks: Definition: A structured and pre-written codebase that defines an overall application architecture and provides specific functionality. Think of it as: A blueprint for building an application within a specific architecture. Examples: Django for web development, Flask for microservices, TensorFlow for machine learning. Key features:  Define application structure and workflows.  Come with ready-made components and functionalities.
  • 11. WHEN TO USE: Use packages for modularity and organizing related code. Use libraries for specific functionalities within your projects. Use frameworks for building entire applications within a pre-defined structure. Use APIs for interacting with external programs or platforms.
  • 12. SIMULATION VS PROGRAMMING Simulation: Focuses on modeling and understanding the behavior of a system or process. It's about how things interact and change over time. It's the entire experience of setting up the model, defining the parameters, and analyzing the generated data. Think of it as the "experiment" conducted using the simulator. Programming: Focuses on creating instructions for a computer to perform specific tasks. It's about defining operations and algorithms to achieve a desired outcome. Approach: Simulation: Often uses mathematical models, equations, and rules to define the behavior of individual elements and their interactions. Programming: Uses code and data structures to define specific steps and procedures for the computer to execute.
  • 13. SIMULATOR Simulator: Refers to the tool or software used to run a simulation. It's the platform that implements the model, defines the rules, and executes the interactions between elements. Think of it as the "engine" driving the simulation. Can be a specific program or a general-purpose platform. Examples include flight simulators or traffic simulators
  • 14. HOW DOES PYTHON HELP TO BUILD AI THINKING HUMANLY, RATIONALLY, AND ACTING ACCORDINGLY? Python plays a crucial role in the quest to build AI that thinks and acts like humans. Here's how it contributes to each aspect: Thinking Humanly: Natural Language Processing (NLP): Python libraries like NLTK and spaCy facilitate text analysis, sentiment detection, and dialogue generation, allowing AI to understand and respond to human language nuances like context and emotions. Machine Learning (ML): Libraries like scikit-learn and TensorFlow enable building AI models that learn from vast amounts of data, mimicking human-like knowledge acquisition and adaptation. Symbolic AI: Libraries like PySymbolics allow manipulating symbols and building knowledge graphs, essential for simulating human reasoning and inferential thinking.
  • 15. HOW DOES PYTHON HELP TO BUILD AI THINKING HUMANLY, RATIONALLY, AND ACTING ACCORDINGLY? Thinking Rationally: Logic Programming: Package like PySWI-Prolog enable AI to express reasoning rules and problem-solving strategies, promoting logical, deductive thinking. SWI-Prolog is a free implementation of the programming language Prolog, commonly used for semantic web applications. Planning and Scheduling: Packages like PyPlanning and ai2 planning allow building AI agents that make decisions and perform actions based on logical constraints and goals, mimicking rational planning and execution. Probabilistic Reasoning: Libraries like NumPy and SciPy enable building AI models that reason with uncertainty and handle incomplete information, mimicking human decision-making under limited knowledge.
  • 16. HOW DOES PYTHON HELP TO BUILD AI THINKING HUMANLY, RATIONALLY, AND ACTING ACCORDINGLY? Acting Humanly: Computer Vision (CV): Libraries like OpenCV and PyTorch allow building AI models that interpret visual information and extract meaning from images and videos, simulating human visual perception. Robotics: Libraries like Pyrobot and RobotPy enable programming robot movements and interactions with the physical world, leading to AI that can act and manipulate objects human-like. Reinforcement Learning (RL): Libraries like Gym and Stable Baselines3 allow building AI agents that learn through trial-and- error, gradually developing human-like skills and strategies for achieving goals.
  • 17. HOW DOES PYTHON HELP TO BUILD AI THINKING HUMANLY, RATIONALLY, AND ACTING ACCORDINGLY? Acting Rationally: Optimization: Libraries like SciPy and Optuna enable AI to find optimal solutions to complex problems with numerous constraints, mimicking rational decision-making and resource allocation. Game Playing: Libraries like PySC2 and DeepMind Lab provide platforms for building AI agents that learn to play games strategically, requiring rational planning and action selection. Agent Simulation: Libraries like Mesa and RLlib allow building and simulating multi-agent systems, enabling the study of AI interactions and the emergence of collective intelligence, promoting rational coordination and behavior.
  • 18. PYTHON Python is a high-level, general-purpose programming language. Key Characteristics: Readability: Python's syntax is remarkably clear and resembles natural English, making it easy to learn and comprehend, even for those new to programming. Versatility: Python empowers you to tackle a wide array of tasks across diverse fields, including:  Web development: Build dynamic websites and web applications using frameworks like Django and Flask.  Data science: Analyze and visualize data effectively with libraries like NumPy, Pandas, and Matplotlib.  Machine learning: Develop intelligent systems capable of learning from data using libraries like TensorFlow and scikit-learn.  Automation: Streamline repetitive tasks and workflows, saving time and effort.  Scientific computing: Perform complex mathematical computations and simulations.
  • 19. PYTHON Open-source and free: Python is freely available for anyone to use, modify, and distribute, fostering a vibrant community of developers. Extensive libraries and frameworks: Python boasts a rich ecosystem of pre-written code modules that extend its functionality, saving you time and effort. Cross-platform compatibility: Python code can run smoothly on Windows, macOS, Linux, and even embedded systems, ensuring flexibility.
  • 20. PYTHON DISTRIBUTIONS Imagine them as pre-packaged bundles of the Python interpreter, essential libraries, and tools, tailored for specific needs and purposes. They simplify setup and provide a ready-to-use environment for developers. They also provide at least one integrated development environment (IDE). Anaconda: Anaconda is a powerhouse for data science and scientific computing. ActivePython: A commercial distribution focusing on security and stability, popular for enterprise use. Miniconda: A smaller version of Anaconda, ideal for lighter deployments or embedding Python in other applications. PyPy: A just-in-time (JIT) compiled Python interpreter offering faster execution speed compared to the standard CPython interpreter. MicroPython: Designed for running Python on microcontrollers and embedded systems. Windows 10/11 built-in Python: A basic Python installation included in recent Windows versions.
  • 21. PLATFORMS FOR PYTHON CODING Integrated Development Environments (IDEs)- are like all-in-one toolboxes for programmers, combining various functionalities within a single, unified interface. PyCharm: Powerful and feature-rich IDE with excellent Python support, code completion, debugging, and project management tools. Excellent for professional development. Visual Studio Code: Highly customizable and lightweight code editor with extensive Python extensions for debugging, linting, and code completion. Offers great flexibility for individual preferences. Spyder: Open-source scientific Python IDE with integrated tools for data analysis, scientific computing, and interactive coding. Ideal for data scientists and researchers. Linting is the process of using a lint tool to automatically check source code for errors. A lint tool, also known as a linter, is a basic static code analyzer.
  • 22. PLATFORMS FOR PYTHON CODING Code Editors: Sublime Text: Powerful and fast code editor with a minimalist interface and extensive plugin ecosystem. Great for experienced developers who prefer customization. Atom: Open-source hackable editor with an extensive package manager offering various Python features and functionalities. Popular choice for beginners and intermediate users. Vim: short for Vi IMproved, is a configurable text editor often used as a Python development environment.
  • 23. PLATFORMS FOR PYTHON CODING Online Platforms: Repl.it: Online Python interpreter and coding environment.Perfect for quick experimentation and learning the basics. Google Colab: Free cloud-based Jupyter Notebook environment with pre-installed libraries and GPUs for data science and machine learning projects. Ideal for researchers and data enthusiasts. Heroku: Cloud platform for deploying Python applications with one- click deploys and automatic scaling. Ideal for web development and deploying projects online.
  • 24. PYTHON LIBRARIES •NumPy: Scientific computing library for advanced array manipulation, linear algebra, and random number generation. •pandas: Data analysis library for importing, processing, manipulating, and analyzing data in various formats. •Matplotlib and Seaborn: Data visualization libraries for creating various types of charts and plots. •Scikit-learn: Machine learning library for building and evaluating various machine learning models. •Beautiful Soup: Web scraping library for extracting data from HTML websites. •Requests: HTTP library for making web requests and downloading content. •Django and Flask: Web development frameworks for building web applications efficiently.
  • 25. PYTHON FRAMEWORKS Django: Full-stack web framework for building secure and scalable web applications. Flask: Lightweight web framework for building small to medium- sized web applications rapidly. Web2py: Rapid application development framework for building web applications quickly and easily. Kivy: Cross-platform framework for building desktop, mobile, and web applications with a similar codebase.
  • 26. PYTHON DEEP LEARNING FRAMEWORKS TensorFlow, PyTorch,  Keras  Theano When to use: •Beginners: Keras or PyTorch are easier to learn with their concise APIs. •Production deployment: TensorFlow has the most mature deployment tools and is widely used in real-world applications. •Research and experimentation: PyTorch's dynamic computation graph and flexibility make it ideal for exploring new ideas. •Scalability and large datasets: TensorFlow offers the best scalability and performance for demanding projects. •Scientific computing: Theano might be a good choice for its research focus and fast computation.
  • 27. OTHER FRAMEWORKS: MXNet: Scalable and efficient framework favored for computer vision and natural language processing. Chainer: Flexible and easy-to-extend framework, popular among researchers for its customizability. CNTK: Microsoft's offering, known for its strong support for GPU acceleration.
  • 28. PYTHON APIS REST APIs: Popular API architecture focused on stateless HTTP requests and responses with resources identified by URIs. GraphQL: API query language that allows fetching specific data efficiently without requiring pre-defined endpoints. OpenAI API: Provides access to powerful language models like GPT- 3 for generating text, translating languages, and writing different kinds of creative content. Twitter API: Allows access to Twitter data for analysis and research.