## Algorithmic Methods of Data Mining (Sc.M. in Data Science)

## Academic year 2020–2021

"The success of companies like Google, Facebook, Amazon, and Netflix, not to mention Wall Street firms and industries from manufacturing and retail to healthcare, is increasingly driven by better tools for extracting meaning from very large quantities of data. 'Data Scientist' is now the hottest job title in Silicon Valley."– Tim O'Reilly

- Data Scientist: The Sexiest Job of the 21st Century (pdf)
- Find true love with data mining

The course will develop the basic algorithmic techniques for data analysis and mining, with emphasis on massive data sets such as large network data. It will cover the main theoretical and practical aspects behind data mining.

The goal of the course is twofold. First, it will present the main theory behind the analysis of data. Second, it will be hands-on and at the end students will become familiar with various state-of-the-art tools and techniques for analyzing data.

We will cover some very basic topics necessary for handling large data, such as hashing, sorting, graphs, data structures, and databases. We will then move to more advanced data mining topics: text mining, clustering, classification, mining of frequent itemsets, graph mining, visualization.

The theoretical part will be complemented by a laboratory where students will learn how to use tools for analyzing and mining large data. We will base it on Amazon's AWS. After finishing the course, the students will have a large part of the knowledge required to pursue (independently) for an Amazon AWS Certification.

### Announcements

Homework 5 is out; it is due on January 14.

Homework 4 is out; it is due on December 23.

Homework 3 is out; it is due on November 29.

The due date for Homework 2 is postponed to November 15.

Homework 2 is out; it is due on November 8.

We have created a slack account, which you can (and should) use for questions, discussions, and so on. If you have not registered, email Cristina.

Be careful for Monday's time-schedule change. New time: 15.00-17.00.

We start classes on October 5.

Homework 1 is out; it is due on October 25.

You **need to register to the class mailing list** to be able to do homeworks, be part of groups, receive announcements, etc.; if you don't have the link, email Aris.

### Instructors

Aris Anagnostopoulos, Sapienza University of Rome.

Ioannis Chatzigiannakis, Sapienza University of Rome.

### Teaching Assistants (TA)

The best way to ask any questions is through slack. If you are registered in the course mailing list and have not received an invitation from Cristina, email Cristina.

Cristina Menghini, Sapienza University of Rome.

Luca Maiano, Sapienza University of Rome.

This email address is being protected from spambots. You need JavaScript enabled to view it. , Sapienza University of Rome. (LinkedIn)

This email address is being protected from spambots. You need JavaScript enabled to view it. , Sapienza University of Rome.

Ali Reza Seifi Mojaddar, Sapienza University of Rome.

This email address is being protected from spambots. You need JavaScript enabled to view it. , Sapienza University of Rome.

This email address is being protected from spambots. You need JavaScript enabled to view it. , Sapienza University of Rome.

### When and where:

Monday 15.00–17.00, Via di Castro Laurenziano 7a, Room 9 (3rd floor)

Wednesday 16.00–18.00, Via di Castro Laurenziano 7a, Room 9 (3rd floor)

Friday 14.00–18.00, Via Tiburtina 205, Room 15

As per university's policy, students will need to register to follow each lecture physically: https://prodigit.uniroma1.it/

### Following online

We will use zoom for the lectures. To obtain the credentials you need to register your email information.

### Office hours

You can use the office hours for any question regarding the class material, past or current homeworks, general questions on data mining, the meaning of life, pretty much anything. Send an email to the instructors for arrangement.

### Textbook and references

We will use a variety of textbooks. Whenever we can, we will try to find books that are available online. As the course progresses, we will indicate what you should read. The main books that we will use are the:

- C. Aggarwal, "Data Mining: The Textbook," Springer (must be downloaded from Sapienza)
- M. J. Zaki and W. Meira, Jr., "Data Mining and Analysis: Fundamental Concepts and Algorithms," Cambridge University Press
- R. Zafarani, M. A. Abbasi, and H. Liu, "Social Media Mining: An Introduction," Cambridge University Press
- J. Leskovec, A. Rajaraman, and J. Ullman, "Mining of Massive Datasets," Cambridge University Press
- C. D. Manning, P. Raghavan and H. Schütze, "Introduction to Information Retrieval," Cambridge University Press
- J. Janssens, "Data Science at the Command Line", O'Reilly

In addition, we will cover material from various other sources, which we will post online as the course proceeds.

### Python resources

The main programming language that we will use in the course is Python 3.

To learn the language you can find a lot of material online. You can start from Python's documentation site: https://www.python.org/doc/.

If you would like to buy some books, you can check the

- "Learning Python, 5th edition," by Mark Lutz. It is a bit verbose, but it presents well the features of the language.
- "Python Pocket Reference, 5th edition," by Mark Lutz. It is usefull as a quick reference if you know more or less the language and you are searching for some information.

We will use several libraries in the class. For Windows users the Anaconda distribution has packaged all of them together and you can download it for free. For MAC/Linux users, all packages can be installed using the **pip3** tool.

We will also use Python (Jupyter) notebooks. You can find instructions for the installation at the Jupyter web site.

If you have problems with Python installation you can obtain an ubuntu virtual machine with Python preinstalled. Contact the instructor for more information.

### Syllabus

Chapters for which no book is mentioned refer to the "Mining of Massive Datasets" (see below). For the other textbooks, we refer to with the author initials: A, ZM, ZAL, MRS.

Date |
Topic |
Reading |

October 5 | Introduction to data science | Introduction to data science at Sapienza |

October 7 | Introduction to data mining | Introduction to data mining |

October 9 | Introduction to Laboratory Tools Introduction to AWS Educate Introduction to AWS S3 Open Datasets CSV and JSON in Python Pandas |
Laboratory Notes How to open an AWS Educate account How to Use Jupyter Notebook in 2020: A Beginner’s Tutorial Create and run your first Python project using pyCharm Free Educational Licenses Introduction to GitHub European Open Data Portal Kaggle eCommerce behavior dataset |

October 12 | Basic data types | |

October 14 | Basic algorithms concepts | Book chapter on function growth from the book "Introduction to Algorithms" by Cormern, Leiserson, Rivest, and Stein. Lecture notes on Big O notation from an old MIT course. |

October 16 | Introduction to Visualization | Laboratory 2: Data Visualization Pandas Documentation on Visualization Pandas Documentation on Grouping Python Plotting With Matplotlib (Guide) Grouping Data with Pandas (Guide) Cookbook Chapter 4 Cookbook Lesson 1 seaborn: statistical data visualization |

October 19 | Basic algorithmc concepts (cont.) | |

October 21 | Recursion | Analysis of recursive algorithms using backward substitution. (The third video in the series shows the analysis of binary search.) Code for binary search in Python. Lecture notes on P, NP, and NP-completenss from an old UCI course. (we did not talk about reductions in class, you can ignore this part if you want). Look also at the Wikipedia page on NP-completeness. |

October 23 | AWS Elastic Cloud Compute |
Laboratory 3: AWS EC2 & AWS CLI |

October 26 | NP-Completeness | Those who are more interested in learning about the concepts of P, NP, NP-completenss, can look at the chapter on NP completeness from the book "Algorithms" by Dasgupta, Papadimitriou, and Vazirani. This material is optional. |

October 28 | NP-Completeness (cont.), Distance measures | Chapter 3–3.4 |

October 30 | Linux Shell Programing Environment |
Laboratory 4: Linux Command Line |

November 2 | Distance measures (cont.) | A Chapter 3.4.2.1 |

November 4 | Distance measures (cont.) | |

November 6 | AWS DynamoDB: Key-Value and Document Databases |
Laboratory 5: AWS DynamoDB |

November 9 | Dynamic programming, and basic computer-architecture concepts | Book chapter on edit distance from the book "Algorithms" by Dasgupta, Papadimitriou, and Vazirani. |

November 11 | Discussion about multidimensional arrays, text preprocessing | Check the web page link here MRS Chapters 2.0–2.2 |

November 13 | Introduction to HTML Introduction to Web Scraping Introduction to NLP |
Laboratory 6: Web Scrapping Introduction to HTML5 Structuring the web with HTML Introduction to BeautifulSoup Selenium with Python Natural Language Processing with spaCy Use Sentiment Analysis with Python |

November 16 | Inverted indexes for Boolean queries | MRS Chapters 1.0–1.4 |

November 18 | Introduction to data structures, ADTs, linked lists, dictionaries, hashing | Wikipedia pages on data structures and linked lists, book chapter on heaps and heapsort from the book "Introduction to Algorithms" by Cormern, Leiserson, Rivest, and Stein. Book chapter on hashing from the book "Algorithms" by Dasgupta, Papadimitriou, and Vazirani. |

November 20 | TFIDF, scoring and term weighting, implementation with inverted indexes | MRS Chapters 6.2, 6.3.1–6.3.3, 7.1.0 |

November 23 | Sorting | Book chapters on insertion sort, mergesort, and quicksort from the book "Introduction to Algorithms" by Cormern, Leiserson, Rivest, and Stein. |

November 25 | Introduction to MapReduce, construction of large indexes | Most of the things we talked about can be found on this quick introduction |

November 27 | Introduction to Elastic Map Reduce | Laboratory 7: Elastic Map Reduce Big Data Analytics Options on AWS Bigtable: A Distributed Storage System for Structured Data Getting Started: Analyzing Big Data with Amazon EMR Using EMR Notebooks PySpark: the Python API for Spark |

November 30 | (Binary) heap, the ML/DM cycle | Book chapter on heaps and heapsort from the book "Introduction to Algorithms" by Cormern, Leiserson, Rivest, and Stein. |

December 2 | (Binary) heap (cont.) | |

December 4 | Introduction to Clustering in Python |
Laboratory 8: Clustering Clustering in Python K-Means in Python |

December 7 | Introduction to clustering, hierarchicla clustering, and k-means | MMD Chapter 7.2, Slides |

December 9 | Introduction to graphs, graph traversal | Notes on graphs, book chapter on graph-traversal from the book "Introduction to Algorithms" by Cormern, Leiserson, Rivest, and Stein |

December 14 | Shortest paths and minimum spanning treees | Book chapter on shortest paths and on minimum spanning trees from the book "Introduction to Algorithms" by Cormern, Leiserson, Rivest, and Stein |

December 16 | Centrality measures, PageRank | |

December 18 | Introduction to Graphs in Python Twitter API AWS SQS |
Laboratory 9: Graphs NetworkX: Network Analysis in Python Tweepy: An easy-to-use Python library for accessing the Twitter API Twitter API Documentation Amazon Simple Queue Service Python Code Samples for Amazon SQS |

December 21 | PageRank (cont.) | MMD Chapter 5.1 |

December 23 | Community detection, minimum cut, end of course | Book chapter on minimum cut from the book "Probability and Computation" by Mitzenmacher and Upfal |

### Homeworks

- Homework 1 (due on 25/10, 23.59)
- Homework 2 (due on 815/11, 23.59)
- Homework 3 (due on 29/11, 23.59)
- Homework 4 (due on 23/12, 23.59)
- Homework 5 (due on 14/1, 23.59)

** **

**Collaboration policy (read carefully!):** You can discuss with other students of the course about the projects. However, you must understand well your solutions and the final writeup must be yours and written in isolation. In addition, even though you may discuss about how you could implement an algorithm, what type of libraries to use, and so on, the final code must be yours. You may also consult the internet for information, as long as it does not reveal the solution. If a question asks you to design and implement an algorithm for a problem, it's fine if you find information about how to resolve a problem with character encoding, for example, but it is not fine if you search for the code or the algorithm for the problem you are being asked. For the projects, you can talk with other students of the course about questions on the programming language, libraries, some API issue, and so on, but both the solutions and the programming must be yours. **If we find out that you have violated the policy and you have copied in any way you will automatically fail.** If you have any doubts about whether something is allowed or not, ask the instructor.