The ability of automatically extracting relevant patterns and information from data is probably the biggest challenge that awaits in the next future. Today, mature technologies and algorithms exists for successful data mining and machine learning, but the somewhat complicated theory behind them has hindered their application for everyday programmers and small companies.
In this talk we will introduce in a very gentle way the main concepts and goals of machine learning. We will then conclude by showing a realistic example, and point to dedicated material for the interested audience.
Edoardo Di Pietro – “Virtual Influencer vs Umano: Rubiamo il lavoro all’AI”
How to make smarter programs. A gentle introduction to Machine Learning by Simone Scardapane
1. How to make smarter programs.
A gentle introduction to Machine Learning
Simone Scardapane
simone.scardapane@uniroma1.it
2. Argomenti di oggi
Simone Scardapane
1. Il Machine Learning (ieri ed oggi)
2. Un esempio pratico: spam detection
3. Cenni su Weka
simone.scardapane@uniroma1.it
3. Cos’è il Machine Learning?
Simone Scardapane
«Estrazione automatica di conoscenza a
partire da un insieme di dati»
simone.scardapane@uniroma1.it
Dati «Learning» Conoscenza
4. Chi ci lavora?
Simone Scardapane
65 anni di ricerche da parte di:
• Ingegneri
• Informatici
• Statistici
• Matematici
• Fisici
• Neuroscienziati...
simone.scardapane@uniroma1.it
0
500
1000
1500
2000
2500
3000
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
Citazioni ML
Citazioni Scopus
7. Ma voi cosa potete farci?
Simone Scardapane
Possibili operazioni su una libreria musicale:
simone.scardapane@uniroma1.it
1. Classificazione del genere (o del mood)
2. Raggruppamento automatico (clustering)
3. Tagging
4. Ricerca per similitudini (association rule)
5. Predizione del prossimo ascolto
6. …
8. Il processo di Learning
Simone Scardapane simone.scardapane@uniroma1.it
Raccolta dati
Pre-
Processamento
Scelta modello
Allenamento
/ testing
Utilizzo
9. Variazioni
Simone Scardapane simone.scardapane@uniroma1.it
• Online Learning: l’algoritmo riceve dati in
real-time e si adatta di conseguenza.
• Active Learning: durante la fase di
learning, è possibile richiedere attivamente
nuove informazioni.
• Collaborative/Cooperative Learning…
10. Simone Scardapane simone.scardapane@uniroma1.it
Un esempio pratico
• Dati: insieme S di emails taggate come spam /
non spam.
• Obiettivo: metodo automatico per individuare
spam.
• Problemi:
1. Come rappresentare l’email?
2.Che modello utilizzare?
3.Come allenarlo?
14. Simone Scardapane simone.scardapane@uniroma1.it
Allenamento /2
Consideriamo l’algoritmo C4.5:
1. Scegliamo per il nodo l’attributo a che
«divide» meglio i dati.
2. Suddividiamo l’insieme lungo i nodi.
3. Ci fermiamo quando i dati sono
perfettamente divisi.
(Difficoltà: gestire dati continui, mancanti…)
17. Simone Scardapane simone.scardapane@uniroma1.it
Pruning
Possibile soluzione (per i decision trees):
• Si tiene da parte un insieme di dati.
• Si eliminano i rami non necessari (pruning)
in base a quei dati (error-based pruning).
Più generalmente si usano tecniche di cross-
validation.
18. Simone Scardapane simone.scardapane@uniroma1.it
Testare l’algoritmo
Possiamo tenere da parte un secondo insieme per
testare l’accuratezza dell’algoritmo.
Dividiamo quindi i nostri dati in tre parti:
Training Validation Testing
20. Simone Scardapane simone.scardapane@uniroma1.it
SpamBase
Usiamo il dataset SpamBase dal repository UCI:
http://archive.ics.uci.edu/ml/datasets/Spambase
4601 email rappresentate da 48 frequenze di parole (più
qualche informazione aggiuntiva).
I dati sono salvati in formato ARFF (file di testo):
1. Header con descrizione degli attributi.
2. Elenco delle email.
27. Simone Scardapane simone.scardapane@uniroma1.it
Letture consigliate
Programming Collective Intelligence, di Toby Segaran. Publisher:
O'Reilly Media (2007).
Data Mining: Practical Machine Learning Tools and Techniques, di
Witten, Frank et Hall. Publisher: Morgan Kaufmann (2011).
Introduction to Machine Learning, di Alpaydin. Publisher: the MIT
Press (2009).