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

Machine Learning in Python

Python Master

Uploaded by

davidetorre92
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
14 views

Machine Learning in Python

Python Master

Uploaded by

davidetorre92
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 50

Executive Skill Lab

Machine Learning in Python

Monday, January 23, 2023


Meet the Instructor: Davide Torre
• Worked as a Data Analyst for Musicoff.com in the field of
advertisement

• Holds a degree in Theoretical Physics, with a thesis on


Quantum Monte Carlo method and Machine Learning on
many-body quantum mechanics systems

• Has experience in the field of computational epidemiology, • Contacts: [email protected]


with publications on graph generation

• Currently a PhD candidate in Artificial Intelligence: life


science, under the joint program of Campus Biomedico and
Luiss university

Monday,
January 23,
2023
Topics of the course
• The Python Language

• Machine Learning with Python

• Implement in technical detail the scripts needed to train and test a model

• Identify opportunities to apply Machine Learning

Monday,
January 23,
2023
What is Artificial Intelligence?
• The term Artificial Intelligence refers to the ability of a machine to
mimic human intelligence and perform tasks that would normally
require human intelligence
• Types of AI: Reactive Machines, Limited Memory, Theory of Mind and
Self-Aware
• Applications of AI: Healthcare, finance, transportation, and
manufacturing
• Advancements in AI: Deep Learning, Reinforcement Learning,
Natural Language Processing
• Challenges in AI: Data privacy, bias, interpretability
• Future of AI: Impact on society, economy and the future of work,
research, and development

Monday,
January 23,
2023
The evolution of AI
The evolution of AI
1943 – Warren McCulloch and Walter Pits published the paper “A Logical Calculus of Ideas Immanent in Nervous Activity” which was the first work on artificial
intelligence (AI) in 1943. They suggested an artificial neuron model.

1949 – Donald Hebb proposed the theory for modifying connection strength between neurons in his book The Organization of Behavior: A Neuropsychological
Theory

1950 – Alan Turing, an English mathematician published “Computing Machinery and Intelligence” in which he proposed a test to determine if a machine has the
ability to exhibit human behavior. This test is famously knows as the Turing Test.
In the same year, Harvard graduates Marvin Minsky and Dean Edmonds built the first neural network computer named SNARC.

1956 – The “first artificial intelligence program” named “Logic Theorist” was constructed by Allen Newell and Herbert A. Simon. This program verified 38 of 52
mathematical theorems, as well as discovering new and more elegant proofs for several of them.
In the same year, the word “Artificial Intelligence” was first adopted by John McCarthy, an American scientist at the Dartmouth Conference and was coined for the first
time as an academic field.

The enthusiasm towards Artificial Intelligence grew rapidly after this year.

1957 – Frank Rosenblatt presents "The Perceptron: A Probabilistic Model for Information Storage and Organization in the Brain".

1959 – Arthur Samuel coined the term machine learning while he was working at IBM.

1963 – John McCarthy started an Artificial Intelligence Lab at Stanford.

1966 – Joseph Weizenbaum created the first ever chatbot named ELIZA.

Monday,
January 23,
2023
The evolution of AI
1972 – The first humanoid robot was built in Japan named WABOT-1.

1974 to 1980 – This period is famously knows as the first AI winter period. Lot of scientists could not pursue/continue their research to the best extent
as they fell short of funding from the government and the interest towards AI gradually declined.

1980 – AI was back with a bang! Digital Equipment Corporations developed R1 which was the first successful commercial expert system and officially
ended the AI winter period.
In the same year, the first ever national conference of American Association of Artificial Intelligence was organized at Stanford University.

1987 to 1993 – With emerging computer technology and cheaper alternatives, many investors and the government stopped funding for AI research
leading to the second AI Winter period.

1997 – A computer beats human! IBM’s computer IBM Deep Blue defeated the then world chess champion, Gary Kasparov, and became the first
computer/machine to beat a world chess champion.

2002 – The inception of vacuum cleaners made AI enter homes.

2005 – The American military started investing in autonomous robots such as Boston Dynamics’ “Big Dog” and iRobot’s “PackBot.”

2006 – Companies like Facebook, Google, Twitter, Netflix started using AI.

Monday,
January 23,
2023
The evolution of AI
2008 – Google made a breakthroughs in speech recognition and introduced the speech recognition feature in the iPhone app.

2011 – Watson – an IBM computer, won Jeopardy in 2011, a game show in which it had to solve complicated questions and riddles. Watson had
demonstrated that it could comprehend plain language and solve complex problems fast.

2012 – Andrew Ng, the Google Brain Deep Learning project’s founder, fed 10 million YouTube videos into a neural network using deep learning
algorithms. The neural network learnt to recognise a cat without being informed what a cat is, which marked the beginning of a new era in deep
learning and neural networks.

2014 – Google made the first self-driving car which passed the driving test.

2014 – Amazon’s Alexa was released.

2016 – Hanson Robotics created the first “robot citizen,” Sophia, a humanoid robot capable of facial recognition, verbal conversation, and facial
emotion.

2020 – During the early phases of the SARS-CoV-2 pandemic, Baidu made its LinearFold AI algorithm available to scientific and medical teams
seeking to create a vaccine. The system could anticipate the virus’s RNA sequence in just 27 seconds, which was 120 times faster than prior methods.

Monday,
January 23,
2023
AI and their
applications

Monday, January 23, 2023


Types of
Artificial
Intelligence
Reactive Machines:
• AI systems that can react to
the environment, but they
can't form memories or use
past experiences to inform
future decisions.
• Examples: IBM's Deep Blue
chess-playing computer and
Google's AlphaGo.

Monday, January 23, 2023


Types of
Artificial
Intelligence
Limited Memory:
• AI systems that can make use
of past experiences to inform
present decisions, but they
can't form long-term
memories or generalize from
past experiences.
• Examples: Autonomous cars
that use sensors to detect
obstacles in their
environment and adjust their
driving accordingly.

Monday, January 23, 2023


Types of
Artificial
Intelligence
Theory of Mind:
• AI systems that can form a
model of other agents and
their mental states, such as
beliefs, intentions, and
emotions.
• Examples: AI-powered
virtual assistants that can
understand user's intent
and respond accordingly.

Monday, January 23, 2023


Types of
Artificial
Intelligence
Hybrid systems:
• AI systems that combine
elements of different
types.
• Examples: A self-driving car
that uses a combination of
reactive machines, limited
memory, and limited theory
of mind.

Monday, January 23, 2023


Types of
Artificial
Intelligence

BUT!
The development of AI is a
complex and evolving field and
there are different views on how to
categorize the different types of AI,
these are just some of them!

Monday, January 23, 2023


Healthcare
• Medical imaging analysis
• Disease diagnosis and treatment
planning
• Clinical decision support
• Patient monitoring and remote care

Clinic experimentation
• AI-powered drug discovery and
development
• AI-powered clinical trial matching and
patient recruitment
• AI-powered data analysis and insights
generation

Monday, January 23, 2023


Energy, Waste
and Water
Management:

• Smart grids that use AI to


optimize energy usage and
reduce waste
• AI-powered water
treatment plants that can
detect and prevent leaks
• AI-powered waste
management systems that
can sort and recycle
materials more efficiently

Monday, January 23, 2023


Digital
Marketing

• AI-powered chatbots that


can provide personalized
customer service
• AI-powered content
creation and optimization
for social media and
websites
• AI-powered analytics that
can track and analyze user
behavior on digital
platforms
Finance
• AI-powered fraud detection and
prevention systems
• AI-powered portfolio management and
risk assessment
• AI-powered financial forecasting and
prediction

HR, Organization,
Leadership:
• AI-powered fraud detection and
prevention systems
• AI-powered portfolio management and
risk assessment
• AI-powered financial forecasting and
prediction

Monday, January 23, 2023


Marketing &
Sales
• AI-powered personalization
and recommendations
• AI-powered marketing
automation
• AI-powered sales
forecasting

Monday, January 23, 2023


Fintech &
Banking

• AI-powered fraud detection


and prevention
• AI-powered customer
service and support
• AI-powered financial
forecasting and risk
management

Monday, January 23, 2023


Sustainable
Mobility

• AI-powered traffic
management and
optimization
• AI-powered logistics and
supply chain management
• AI-powered fleet
management

Monday, January 23, 2023


Real Estate
Finance

• AI-powered property
valuations and pricing
• AI-powered property
management
• AI-powered investment
analysis

Monday, January 23, 2023


Advancing AI:
The Latest
Techniques
Advancing AI:
The Latest
Techniques
Deep Learning:
•A subset of machine learning that
uses neural networks with multiple
layers to learn from data.
•Can be used for tasks such as
image recognition, natural
language processing, and speech
recognition.
•Examples: AlphaGo, Siri, Google
Translate

Monday, January 23, 2023


Advancing AI:
The Latest
Techniques
Reinforcement Learning:
•A type of machine learning that
involves training an agent to make
decisions by receiving rewards or
penalties for its actions.
•Can be used for tasks such as
game playing, robotics, and
autonomous vehicles.
•Examples: AlphaGo, self-driving
cars

Monday, January 23, 2023


Advancing AI:
The Latest
Techniques
Natural Language Processing
(NLP):
•A field of AI that focuses on the
interaction between computers
and human language.
•Can be used for tasks such as
language translation, sentiment
analysis, and text summarization.
•Examples: Google Translate, Siri,
Amazon Alexa, ChatGPT, BERT, T5

Monday, January 23, 2023


More on AI
Advances
ChatGPT
Generative
Language
Model
Chat GPT case of use: «Can you tell me more
about transformers?»

In the context of AI, transformers are a type of neural network architecture that have been used to achieve
state-of-the-art performance on a wide range of natural language processing (NLP) tasks. The transformer
architecture was introduced in a 2017 paper by Google researchers, "Attention is All You Need". The
transformer architecture is based on the idea of self-attention, which allows the model to weigh the importance
of different words in a sentence when making predictions. This contrasts with traditional RNN (recurrent neural
network) and CNN (convolutional neural network) architectures that process input sequences in a fixed order,
such as left-to-right or last-to-first. Transformers have been used to power many recent NLP models, such as
BERT, GPT-2, and T5, which have achieved state-of-the-art results on a wide range of natural language
understanding tasks, including question answering, language translation, and text summarization.

Monday,
January 23,
2023 Titolo della Presentazione/Sezione 29
• AI-powered image generation model developed by OpenAI.

• Based on the transformer architecture, which allows it to generate images from text descriptions by
attending to specific words in the description.
DALL·E 2 - • Pre-trained on a large dataset of images and their associated text descriptions, and can then generate new
images by conditioning on a new text description.
OpenAI • DALL-E generates images by sampling from a probability distribution over images, which is estimated
based on the input text and the model's pre-trained parameters. The model can generate new images that
are not present in the training set and also can generate images for texts that are not present in the
training set.
BERT (Bidirectional Encoder
Representations from Transformers)

BERT is a pre-trained language representation model developed by


Google.

BERT is based on the transformer architecture, which allows it to


understand the context of words in a sentence by looking at the
words that come before and after them.

BERT is pre-trained on a large corpus of text, and can then be


fine-tuned on specific tasks, such as sentiment analysis or question
answering.

BERT can be used for a variety of natural language processing


tasks, such as text classification, named entity recognition, and
question answering. With fine-tuning, BERT can achieve
state-of-the-art results on many NLP benchmarks.
ARIMA
Autoregressive Integrated
Moving Average
• ARIMA is a statistical model used for time series forecasting.

• ARIMA models the time series as a combination of three


components: the trend, the seasonal, and the residual
components.

• The model is specified by three parameters: the order of


differencing d, the order of the autoregression p, and the order of
the moving average q. These parameters are estimated using
techniques such as maximum likelihood estimation, and then used
to make predictions about future values of the time series.

• ARIMA can be used to identify patterns, trends, and seasonality in


a time series, and then use this information to make accurate
predictions about future values of the series, it's widely used in
economics, finance and many other fields where data is
generated over time.
A theoretical physicist
perspective

• Do we really have to forget models and hypothesis? Are ‘’smart’’


machines all we need?
• Chris Anderson’s 2008 article
• Big Data won’t make theoreticians jobless
• Big Data is a powerful tool for investigation when used in the
appropriate context, it can significantly enhance scientific
research.

Monday, January 23, 2023


Coding basics
Coding Basics
What is coding?

•Coding refers to the process of writing instructions for a computer to execute.


•Coding can be used to create a wide range of software applications and tools.
•Coding is a fundamental skill for anyone who wants to work in technology or
related fields.
•Coding requires knowledge of a specific programming language and its syntax.
•Coding can be challenging, but it is also very rewarding, as it allows you to create
things that can be used by others.
Monday,
January 23,
2023
Coding Basics
What it's important?
•Coding is the backbone of the digital age and the foundation of many industries.

•Coding skills are in high demand, and can lead to career opportunities in fields such as software
development, data science, and artificial intelligence.

•Coding allows you to automate repetitive tasks, making you more productive and efficient.

•Coding can also be used to create tools that can help solve real-world problems.

•Understanding how to code gives you a better understanding of how technology works, and how it
can be used to improve your life and the lives of others.

Monday,
January 23,
2023
Coding Basics
Flowchart: an ancient yet important tool
•Flowchart is a diagram that represents a process, a system or an algorithm

•Flowchart can help to visualize the steps of the process, the decisions to be made and the
possible outcomes.

•Flowchart can be a powerful tool to help you plan and organize your code, making it more
readable and maintainable.

•Flowchart is used in many fields such as software development, business, and engineering.

•Flowchart is a great tool for communicating with others, specially when working in a team.

Monday,
January 23,
2023
Coding Basics
Different types of programming languages
•There are many different types of programming languages, each with its own strengths and use cases.

•Some common types of programming languages include:


• Object-oriented languages, such as Java and C#, which are used to create complex software applications.
• Scripting languages, such as JavaScript and Python, which are used to create web applications and automate
tasks.
• Markup languages, such as HTML and XML, which are used to create and structure web content.
• Query languages, such as SQL, which are used to access and manipulate databases.

•Different types of programming languages are suited for different tasks, and it's important to choose the right language for
a specific project.

•Some languages are more popular and in-demand than others, and it's important to be aware of these trends when
choosing a language to learn.

Monday,
January 23,
2023
Machine Learning
What is Machine Learning?
• Machine learning is a subset of artificial intelligence that involves training computer models to
learn from data and make predictions or decisions without explicit instructions.

• Machine learning can be divided into supervised, unsupervised, and reinforcement


learning.

• The goal of machine learning is to build models that can learn from data and generalize to new
unseen data.

• Machine learning can be used to solve a wide range of problems, such as image recognition,
natural language processing, and predictive modeling.

Monday,
January 23,
2023
Machine Learning
The main mathematical tools to define and deal with ML
• Linear algebra: It's used to deal with matrices and vectors, which are the main data structures
used in ML.

• Calculus: It's used to optimize the parameters of ML models and also to understand the
behavior of the models.

• Probability and statistics: It's used to reason about the uncertainty of the data and the
models.

• Optimization: It's used to find the best parameters of the models.

• Information theory: It's used to understand the amount of information that a variable contains.

Monday,
January 23,
2023
Machine Learning
Some basics applications and projects to get started
• Image classification: Train a model to recognize different objects in images.

• Text classification: Train a model to classify text into different categories.

• Clustering: Group similar data points together.

• Recommender systems: Build a system that suggests items to users.

• Anomaly detection: Identify patterns or observations that do not conform to an expected


behavior.

Monday,
January 23,
2023
Machine Learning
How Python can help with our projects
• Python libraries such as scikit-learn, TensorFlow, and Keras make it easy to implement and
experiment with machine learning algorithms.

• Python's readability and simplicity make it easy to learn and understand the basics of machine
learning.

• Python libraries also provide pre-trained models and utilities to handle common machine
learning tasks such as data preprocessing and model evaluation.

• Python can be used for data visualization, data analysis, and data preprocessing making it a
great choice for end-to-end machine learning projects.

Monday,
January 23,
2023
Introduction
to Python
Python
Some words on Python
•Python is a high-level, general-purpose programming language that is widely used for web
development, data science and artificial intelligence.

•Python is known for its simplicity and readability, which makes it a great language for beginners.

•Python has a large and active community, which has created a wide range of libraries and
frameworks that can be used to solve a wide range of problems.

•Python is versatile and can be used for a wide range of tasks such as web scraping, automation,
data analysis, machine learning, and more.

•Python is one of the most popular programming languages and is in high demand in many
industries, making it a valuable skill to learn.
Monday,
January 23,
2023
Python
The main Python libraries for Machine Learning
• NumPy, for numerical computing

• SciPy, for scientific computing

• scikit-learn, for machine learning

• Pandas, for data analysis and manipulation

• Matplotlib, for data visualization

• TensorFlow, Keras, PyTorch, and other deep learning libraries for implementing and training
neural networks.

Monday,
January 23,
2023
Introduction to
Google
Colaboratory
Click me!

Monday,
January 23,
2023

You might also like