Strumenti Utente

Strumenti Sito


Questa è una vecchia versione del documento!

Data Mining A.A. 2021/22

DM1 - Data Mining: Foundations (6 CFU)


Teaching Assistant

DM2 - Data Mining: Advanced Topics and Applications (6 CFU)


  • [14.10.2021] The class planned for Monday 18.10.2021 is cancelled for public ceremony.
  • [06.09.2021] The first lesson will be held on 16/09/2021.

Learning Goals

  • DM1
    • Fundamental concepts of data knowledge and discovery.
    • Data understanding
    • Data preparation
    • Clustering
    • Classification
    • Pattern Mining and Association Rules
    • Clustering
  • DM2
    • Outlier Detection
    • Regression and Forecasting
    • Advanced Classification
    • Time Series Analysis
    • Sequential Pattern Mining
    • Advanced Clustering
    • Transactional Clustering
    • Ethical Issues

Hours and Rooms



Day of Week Hour Room
Monday 11:00 - 13:00 Aula C / MS Teams
Thursday 11:00 - 13:00 Aula A1 / MS Teams

Office hours - Ricevimento:

  • Prof. Pedreschi: Monday 16:00 - 18:00, Online
  • Prof. Nanni: appointment by email, Online

DM 2


Day of Week Hour Room
Monday 14:00 - 16:00 MS Teams
Wednesday 16:00 - 18:00 MS Teams

Office Hours - Ricevimento:

  • Room 268 Dept. of Computer Science
  • Tuesday: 15-17, Room: MS Teams
  • Appointment by email

Learning Material -- Materiale didattico

Textbook -- Libro di Testo

  • Pang-Ning Tan, Michael Steinbach, Vipin Kumar. Introduction to Data Mining. Addison Wesley, ISBN 0-321-32136-7, 2006
  • Berthold, M.R., Borgelt, C., Höppner, F., Klawonn, F. GUIDE TO INTELLIGENT DATA ANALYSIS. Springer Verlag, 1st Edition., 2010. ISBN 978-1-84882-259-7
  • Laura Igual et al. Introduction to Data Science: A Python Approach to Concepts, Techniques and Applications. 1st ed. 2017 Edition.



  • Python - Anaconda (3.7 version!!!): Anaconda is the leading open data science platform powered by Python. Download page (the following libraries are already included)
  • Scikit-learn: python library with tools for data mining and data analysis Documentation page
  • Pandas: pandas is an open source, BSD-licensed library providing high-performance, easy-to-use data structures and data analysis tools for the Python programming language. Documentation page
  • KNIME The Konstanz Information Miner. Download page
  • WEKA Data Mining Software in JAVA. University of Waikato, New Zealand Download page
  • Didactic Data Mining DDM

Class Calendar (2021/2022)

First Semester (DM1 - Data Mining: Foundations)

Day Room Topic Learning material Recording Instructor
1. 16.09.2021 11:00-12:45 Aula Fib A1 Introduction. Introducing DM1 Project-work guidelines Lecture 1 Pedreschi
2. 20.09.2021 11:00-12:45 Aula Fib C Course overview Overview of contents Lecture 2 Pedreschi
3. 23.09.2021 11:00-12:45 Aula Fib A1 Data Understanding Slides Lecture 3 Pedreschi
4. 27.09.2021 11:00-12:45 Aula Fib C Data Preparation Slides Lecture 4 Pedreschi
5. 30.09.2021 11:00-12:45 Aula Fib A1 Lab: Data Understanding & Preparation – Python Python Introduction Dataset: Iris Hands-On Python (Iris) Lecture 5 Citraro
6. 04.10.2021 11:00-12:45 Aula Fib C Lab: Data Understanding & Preparation – Python (cont.) & KNIME Dataset: Titanic Hands-On Python (Titanic), Titanic DU+DP (complete) KMIME: Intro, KNIME DU+DP Lecture 6 Citraro
7. 07.10.2021 11:00-12:45 Aula Fib A1 Clustering: Intro & K-means Clustering intro and k-means [revised version] Lecture 7 Nanni
11.10.2021 11:00-12:45 Aula Fib C
8. 14.10.2021 11:00-12:45 Aula Fib A1 Clustering: k-means Lecture 8 Nanni
18.10.2021 11:00-12:45 Aula Fib C
9. 21.10.2021 11:00-12:45 Aula Fib A1 Clustering: Hierarchical methods Clustering: Hierarchical Methods Lecture 9 Nanni
10. 25.10.2021 11:00-12:45 Aula Fib C Clustering: density-base methods & exercises Clustering: Density-based methods Lecture 10 Nanni
11. 28.10.2021 11:00-12:45 Aula Fib A1 Lab: Clustering Python Hands-On Clust. (Iris) Python Titanic Knime Lecture 11 Citraro
12. 04.11.2021 11:00-12:45 Aula Fib A1 Classification: intro and decision trees Classification and decision trees (updated 11.11.2021) Lecture 12 Nanni
13. 08.11.2021 11:00-12:45 Aula Fib C Classification: decision trees/2 Lecture 13 Nanni
14. 11.11.2021 11:00-12:45 Aula Fib A1 Classification: decision trees/3 Lecture 14 Nanni

Second Semester (DM2 - Data Mining: Advanced Topics and Applications)

Day Room Topic Learning material Instructor Recordings
1. ??.02.2022 ??:00-??:00 link teams Introduction, CRIPS, KNN Intro, CRISP, KNN Guidotti link registrazione


Exam DM1

The exam is composed of two parts:

  • An oral exam , that includes: (1) discussing the project report; (2) discussing topics presented during the classes, including the theory and practical exercises.
  • A project, that consists in exercises requiring the use of data mining tools for analysis of data. Exercises include: data understanding, clustering analysis, frequent pattern mining, and classification (guidelines will be provided for more details). The project has to be performed by min 3, max 4 people. It has to be performed by using Knime, Python or a combination of them. The results of the different tasks must be reported in a unique paper. The total length of this paper must be max 20 pages of text including figures. The paper must be emailed to datamining [dot] unipi [at] gmail [dot] com. Please, use “[DM1 2021-2022] Project” in the subject.

Project 1

  1. Assigned: 30/09/2021
  2. MidTerm Deadline: 21/11/2021 (half project required, i.e., Data understanding & Preparation and at least 2 clustering algorithms)
  3. Final Deadline: TBD (complete project required)
  4. Data: choose between Glasgow Norms, Seismic Bumps

Exam DM part II (DMA)

Exam Rules

  • Rules for DM2 exam available here.

Exam Booking Periods

  • 3rd Appello: ??/??/2022 00:00 - ??/??/2022 23:59
  • 4th Appello: ??/??/2022 00:00 - ??/??/2022 23:59
  • 5th Appello: ??/??/2022 00:00 - ??/??/2022 23:59

Exam Booking Agenda

  • Agenda Link: ???
  • 3rd Appello: starts ??/??/2022
  • 4th Appello: starts ??/??/2022
  • 5th Appello: starts ??/??/2022
  • Important! if you book in the agenda in data in days between ??/??/2022 and ??/??/2022 you MUST be registered for the 3rd appello, if you book in the agenda in data in days between ??/??/2022 and ??/??/2022 you must be registered for the 4th appello, if you book in the agenda in data in days after ??/??/2022 you must be registered for the 5th appello.

The link to the agenda for booking a slot for the exam is displayed at the end of the registration. During the exam the camera must remain open and you must be able to share your screen. For the exam could be required the usage of the Miro platform (

The exam is composed of two parts:

  • A project, that consists in employing the methods and algorithms presented during the classes for solving exercises on a given dataset. The project has to be realized by max 3 people. The results of the different tasks must be reported in a unique paper. The total length of this paper must be max 30 pages (suggested 25) of text including figures + 1 cover page (minimum font 11, minimum interline 1). The project must be delivered at least 7 days before the oral exam. The project must be delivered to riccardo [dot] guidotti [at] unipi [dot] it AND francesco [dot] spinnato [at] sns [dot] it with subject “[DM2 Project]”
  • An oral exam, that includes: (1) discussing topics presented during the classes, including the theory of the parts already covered by the written exam; (2) resolving simple exercises using the Miro platform; (3) discussing the project report with a group presentation;
  • Dataset: the data is about ??? and can be downloaded here: ???
    • Data can be downloaded here ???
    • Submission Draft 1: ??/??/2022 23:59 Italian Time (we expect Module 1 and Module 2)
    • Submission Draft 2: ??/??/2022 23:59 Italian Time (we expect Module 3)
    • Final Submission: one week before the oral exam.

Project Guidelines

  • Module 1 - Introduction, Imbalanced Learning and Anomaly Detection
    1. Explore and prepare the dataset. You are allowed to take inspiration from the associated GitHub repository and figure out your personal research perspective (from choosing a subset of variables to the class to predict…). You are welcome in creating new variables and performing all the pre-processing steps the dataset needs.
    2. Define one or more (simple) classification tasks and solve it with Decision Tree and KNN. You decide the target variable.
    3. Identify the top 1% outliers: adopt at least three different methods from different families (e.g., density-based, angle-based… ) and compare the results. Deal with the outliers by removing them from the dataset or by treating the anomalous variables as missing values and employing replacement techniques. In this second case, you should check that the outliers are not outliers anymore. Justify your choices in every step.
    4. Analyze the value distribution of the class to predict with respect to point 2; if it is unbalanced leave it as it is, otherwise turn the dataset into an imbalanced version (e.g., 96% - 4%, for binary classification). Then solve the classification task using the Decision Tree or the KNN by adopting various techniques of imbalanced learning.
    5. Draw your conclusions about the techniques adopted in this analysis.
  • Module 2 - Advanced Classification Methods
    1. Solve the classification task defined in Module 1 (or define new ones) with the other classification methods analyzed during the course: Naive Bayes Classifier, Logistic Regression, Rule-based Classifiers, Support Vector Machines, Neural Networks, Ensemble Methods and evaluate each classifier with the techniques presented in Module 1 (accuracy, precision, recall, F1-score, ROC curve). Perform hyper-parameter tuning phases and justify your choices.
    2. Besides the numerical evaluation draw your conclusions about the various classifiers, e.g. for Neural Networks: what are the parameter sets or the convergence criteria which avoid overfitting? For Ensemble classifiers how the number of base models impacts the classification performance? For any classifier which is the minimum amount of data required to guarantee an acceptable level of performance? Is this level the same for any classifier? What is revealing the feature importance of Random Forests?
    3. Select two continuous attributes, define a regression problem and try to solve it using different techniques reporting various evaluation measures. Plot the two-dimensional dataset. Then generalize to multiple linear regression and observe how the performance varies.
  • Module 3 - Time Series Analysis
    1. Select the feature(s) you prefer and use it (them) as a time series. You can use the temporal information provided by the authors’ datasets, but you are also welcome in exploring the .mp3 files to build your own dataset of time series according to your purposes. You should prepare a dataset on which you can run time series clustering; motif/anomaly discovery and classification.
    2. On the dataset created, compute clustering based on Euclidean/Manhattan and DTW distances and compare the results. To perform the clustering you can choose among different distance functions and clustering algorithms. Remember that you can reduce the dimensionality through approximation. Analyze the clusters and highlight similarities and differences.
    3. Analyze the dataset for finding motifs and/or anomalies. Visualize and discuss them and their relationship with other features.
    4. Solve the classification task on the time series dataset(s) and evaluate each result. In particular, you should use shapelet-based classifiers. Analyze the shapelets retrieved and discuss if there are any similarities/differences with motifs and/or shapelets.
  • Module 4 - Sequential Patterns and Advanced Clustering
    1. Sequential Pattern Mining: Convert the time series into a discrete format (e.g., by using SAX) and extract the most frequent sequential patterns (of at least length 3/4) using different values of support, then discuss the most interesting sequences.
    2. Advanced Clustering: On a dataset already prepared for one of the previous tasks in Module 1 or Module 2, run at least one clustering algorithm presented in the advanced clustering lectures (e.g. X-Means, Bisecting K-Means, OPTICS). Discuss the results that you find analyzing the clusters and reporting external validation measures (e.g SSE, silhouette).
    3. Transactional Clustering: By using categorical features, or by turning a dataset with continuous variables into a dataset with categorical variables (e.g. by using binning), run at least one clustering algorithm presented in the transactional clustering lectures (e.g. K-Modes, ROCK). Discuss the results that you find analyzing the clusters and reporting external validation measures (e.g SSE, silhouette).
  • Module 5 - Explainability (optional)
    1. Try to use one or more explanation methods (e.g., LIME, LORE, SHAP, etc.) to illustrate the reasons for the classification in one of the steps of the previous tasks.

N.B. When “solving the classification task”, remember, (i) to test, when needed, different criteria for the parameter estimation of the algorithms, and (ii) to evaluate the classifiers (e.g., Accuracy, F1, Lift Chart) in order to compare the results obtained with an imbalanced technique against those obtained from using the “original” dataset.

Exam Dates

Exam Sessions

Session Date Time Room Notes Marks 14:00 - 18:00 MS Teams Please, use the system for registration:

Past Exams

  • Past exams texts can be found in old pages of the course. Please do not consider these exercises as a unique way of testing your knowledge. Exercises can be changed and updated every year and will be published together with the slides of the lectures.

Reading About the "Data Scientist" Job

… a new kind of professional has emerged, the data scientist, who combines the skills of software programmer, statistician and storyteller/artist to extract the nuggets of gold hidden under mountains of data. Hal Varian, Google’s chief economist, predicts that the job of statistician will become the “sexiest” around. Data, he explains, are widely available; what is scarce is the ability to extract wisdom from them.

Data, data everywhere. The Economist, Special Report on Big Data, Feb. 2010.

  • Data, data everywhere. The Economist, Feb. 2010 download
  • Data scientist: The hot new gig in tech, CNN & Fortune, Sept. 2011 link
  • Welcome to the yotta world. The Economist, Sept. 2011 download
  • Data Scientist: The Sexiest Job of the 21st Century. Harvard Business Review, Sept 2012 link
  • Il futuro è già scritto in Big Data. Il SOle 24 Ore, Sept 2012 link
  • Special issue of Crossroads - The ACM Magazine for Students - on Big Data Analytics download
  • Peter Sondergaard, Gartner, Says Big Data Creates Big Jobs. Oct 22, 2012: YouTube video
  • Towards Effective Decision-Making Through Data Visualization: Six World-Class Enterprises Show The Way. White paper at download

Previous years

dm/start.1636634651.txt.gz · Ultima modifica: 11/11/2021 alle 12:44 (19 mesi fa) da Mirco Nanni