Docsity
Docsity

Prepara i tuoi esami
Prepara i tuoi esami

Studia grazie alle numerose risorse presenti su Docsity


Ottieni i punti per scaricare
Ottieni i punti per scaricare

Guadagna punti aiutando altri studenti oppure acquistali con un piano Premium


Guide e consigli
Guide e consigli


Machine and Deep Learning, Dispense di Tecniche Di Intelligenza Artificiale

Documento scritto da me in inglese sull'intelligenza artificiale. Partendo dal machine learning al deep learning, algoritmi di classificazione, clustering, regressione, reti neurali, detection, attention. Tutte le basi del machine e deep learning fino ad argomenti avanzati di computer vision sono affrontati con esercizi svolti per comprendere meglio gli argomenti. Spiegazioni tecniche sono corredate: Python, Pandas, Numpy, Torch, PIL, installazione di Python. Il documento è adatto per ogni università che tratti esami di intelligenza artificiale/machine learning/deep learning.

Tipologia: Dispense

2024/2025

In vendita dal 13/12/2024

giulio_russo
giulio_russo 🇮🇹

4.8

(42)

111 documenti

1 / 383

Toggle sidebar

Questa pagina non è visibile nell’anteprima

Non perderti parti importanti!

bg1
MACHINE AND DEEP LEARNING NOTES
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19
pf1a
pf1b
pf1c
pf1d
pf1e
pf1f
pf20
pf21
pf22
pf23
pf24
pf25
pf26
pf27
pf28
pf29
pf2a
pf2b
pf2c
pf2d
pf2e
pf2f
pf30
pf31
pf32
pf33
pf34
pf35
pf36
pf37
pf38
pf39
pf3a
pf3b
pf3c
pf3d
pf3e
pf3f
pf40
pf41
pf42
pf43
pf44
pf45
pf46
pf47
pf48
pf49
pf4a
pf4b
pf4c
pf4d
pf4e
pf4f
pf50
pf51
pf52
pf53
pf54
pf55
pf56
pf57
pf58
pf59
pf5a
pf5b
pf5c
pf5d
pf5e
pf5f
pf60
pf61
pf62
pf63
pf64

Anteprima parziale del testo

Scarica Machine and Deep Learning e più Dispense in PDF di Tecniche Di Intelligenza Artificiale solo su Docsity!

MACHINE AND DEEP LEARNING NOTES

INTRO

  • Artificial Intelligence
  • Python
  • Install Python
  • Install Packages
  • Virtual Environment
  • Miniconda
  • Numpy
  • Pandas
  • PIL
  • Scikit-learn
  • PyTorch
  • Machine Learning categories MACHINE LEARNING
  • Workflow
  • Feature engineering
  • Training and Evaluation
  • Performance evaluation
  • Bayesian learning
  • Non parametric learning
  • Density estimation
  • KNN
  • Decision tree
  • Linear models
  • LDA
  • Logistic regression
  • SVM
  • SVR
  • Ensemble Method
  • Bagging
  • Boosting
  • Multiclass decomposition
  • Unsupervised learning
  • Artificial Neural Network DEEP LEARNING
  • How a Neural Network work
  • Backpropagation
  • History of Neural Networks
  • Neuron
  • Learning slowdown
  • Vanishing gradient
  • Overfitting
  • Covariate shift
  • Multilayer perceptron
  • Convolutional Neural Network
  • Backbone history
  • Transfer learning
  • Segmentation
  • Object detection
  • Generative Adversarial Network
  • Recurrent Neural Network
  • Attention
  • Transformers
  • Bibliography

1.Artificial Intelligence (AI):

AI is a broad field of computer science focused on creating systems or machines that can

perform tasks that typically require human intelligence. AI systems can be rule-based or data-

driven and aim to replicate human-like decision-making and problem-solving abilities.

2.Machine Learning (ML):

ML is a subset of AI that focuses on developing algorithms and models that allow computers

to learn and make predictions or decisions from data without being explicitly programmed.

ML models improve their performance through experience and exposure to training data.

3.Deep Learning (DL):

DL is a subfield of ML that uses artificial neural networks, inspired by the structure and

function of the human brain, to solve complex problems.

Example:

1. AI: distinguish fruits

2. ML: feed the computer with a dataset of various fruits with labeled names and features, and

the machine learns patterns to identify fruits based on this input

3. DL: creating a complex neural network that can automatically extract hierarchical features

from the fruit images, improving accuracy without explicit programming for each feature

Artificial Intelligence

Scripting language, not typed

  • value1, value2, ...: The values or expressions to be printed.
  • sep=' ' (optional): The separator between the values. The default is a space.
  • end='\n' (optional): The end character at the end of the print statement. The default is a newline.
  • file=sys.stdout (optional): Specifies the file where the output will be written. The default is the console.
  • flush=False (optional): If True, the output is forcibly flushed. The default is False.
  • prompt=None (optional): The message to display before the user input. Python

Main types :

I/
  • def: Keyword used to declare a function.
  • function_name: The name of the function.
  • (parameter1, parameter2, ...): Parameters are inputs to the function. They are optional.
  • : : Colon indicates the start of the function’s code block.
  • Docstring: Optional documentation string enclosed in triple-quotes. It provides information about the
function’s purpose, parameters, and return values.
  • return result: Optional statement that specifies the value to be returned by the function.
Call a function:
Using placeholder to ignore the value:
In case of more argument return:

Functions :

  • class MyClass:: Define a class named MyClass.
  • Attributes: Variables that store data related to the class.
  • Methods: Functions that define behaviors associated with the class. The first parameter of a method is
usually self, which refers to the instance of the class.
Initialize class:
Access attributes and methods:
The init method is a special method (constructor) that is called when an object is created. It initializes the
attributes of the object.
Classes can inherit attributes and methods from other classes. The super() function is often used to call methods
from the parent class.
You can use underscores to indicate private attributes and methods. Private members should not be accessed
directly from outside the class.

Classi

Doest Python do all the job? No. Python is used together with:

  • modules: piece of code that may be built upon
  • packages: collection of modules
  • Importing the entire package/module:
  • Importing with an alias:
  • Importing specific items from a package/module:
  • Importing all items from a package/module (not recommended for large packages):

In this way we can call the functions and modules to be used in our code.

Packages are installed with the package installer for Python (pip command). After the

installation via python.org they will be stored in /usr/local/bin. If a package is installed with

pip before the installation of python, they will be stored in the system python path /usr/

bin.

Install (^) packages

The Virtual environment (venv) is a space where all the package we install are visibile.

When a project is created we have to choose the relative venv in order to define which

packages can be used in our application. At the beginning with only Python installed we

should have this situation

Example of selection of the venv in Visual Studio Code:

*IMPORTANT: the venv of the operating system will be ever visible, and after the

installation of Python will be no longer usable to install packages. This is a correct thing,

but if for any strange reason it is needed to install something on the /usr/bin/python3, it is

possible to create a symbolic link with the command:

sudo ln -sf /usr/bin/python3 /usr/local/bin/python Virtual environment

The new environment will be visible and can be chooses in your different projects:

Example of creation of the venv:

The Python version of the venv will be the same installed via python.org.

We can see that a specific venv is active because before the name in the terminal we

have the venv name surrounded by brackets.

Once activated, every package will be installed into the activated venv.

In order to launch a python script with a specific venv, this specific venv have to be

activated before launching the script.

Miniconda is a convenient venv manager. It is the essential part of the bigger Anaconda

venv manager that is included with a GUI.

When Miniconda is installed, a default venv is created. Once the terminal is running, the

conda environment is the default environment running.

Example checking venv from Visual Studio Code:

Minicando

NumPy is a powerful numerical computing library in Python, providing support for large, multi- dimensional arrays and matrices, along with a collection of mathematical functions to operate on these arrays. The main structure in NumPy is the ndarray (n-dimensional array). The ndarray (n-dimensional array) is the core data structure in NumPy, a numerical computing library in Python. The ndarray is a powerful, flexible, and efficient container for large datasets and numerical operations. Numpy

Pandas is a powerful open-source data manipulation and analysis library for Python. It provides data structures for efficiently storing and manipulating large datasets. The name “Pandas” is derived from the term “Panel Data,” an econometrics term for multidimensional structured data sets. Two primary data structures in Pandas are the DataFrame and the Series. DataFrame:

  • A DataFrame is a two-dimensional, labeled data structure with columns that can be of different data types. It can be thought of as an Excel spreadsheet or SQL table.
  • Each column in a DataFrame is a Pandas Series, and they share the same index.
  • You can perform various operations on a DataFrame, such as filtering, grouping, merging, and reshaping data. Series:
  • A Series is a one-dimensional labeled array capable of holding any data type.
  • It is essentially a single column of a DataFrame.
  • Series can be created from various data types, such as lists, arrays, or even other Series. Pandas