# Difference between revisions of "Machine Learning Bio"

(Created page with "Work in progress, coming soon ...") |
|||

(141 intermediate revisions by the same user not shown) | |||

Line 1: | Line 1: | ||

− | + | __FORCETOC__ | |

+ | |||

+ | The following are last-minute news you should be aware of ;-) | ||

+ | * 11/09/2021: Grade of the [[Media:ML2021-Grades_210911.pdf|Summer session + homeworks]] | ||

+ | * 09/07/2021: Grade of the [[Media:ML2021-Grades_210624.pdf|24/06/2021 oral exams]] | ||

+ | * 09/07/2021: Updated Homework + Oral [[Media:ML2021-Conversion.pdf|conversion table]] | ||

+ | * 03/07/2021: Updated Homework available [[Media:ML2021-homework-new.zip|here!!!]] | ||

+ | * 08/06/2021: Updated all videos and all slides from the course. | ||

+ | * 02/06/2021: You can fin the 2020/2021 homework [[Media:ML2021-homework.zip|here!!!]] | ||

+ | * 26/05/2021: The link to the form to request an instance of remote examination for June and July is [https://forms.office.com/r/FUrVt8eZNx here]! | ||

+ | * 09/04/2021: From next week lectures will be back to presence (plus webex streaming) | ||

+ | * 22/03/2021: Added completed material from the last lab plus some exercises ... | ||

+ | * 17/03/2021: Added the material for the lab of today ... | ||

+ | * 10/03/2021: 11/03/2021 lecture has been canceled | ||

+ | * 06/03/2021: website update with linear algebra slides and (working) links to all lectures | ||

+ | * 05/03/2021: Since today we are moved fully online so lectures will happen in my webex room (same holds for labs) | ||

+ | * 24/02/2021: Lectures start today | ||

+ | |||

+ | <!-- | ||

+ | * 08/08/2020: Grading for all projects and first two calls [[Media:Grades_20200723.pdf|are here!!]] | ||

+ | * 22/06/2020: Grading mechanism explained, check [[Media:ML2020_grading_system.pdf|here a handy recap]] | ||

+ | * 14/06/2020: [[Media:ML2020_homework.zip |Here it come the 2020 homework!!!]] | ||

+ | * 03/06/2020: All slides updated | ||

+ | * 02/05/2020: Updated course schedule and added videos to the previous lectures | ||

+ | * 04/04/2020: Updated schedule and added videos of previous lectures | ||

+ | * 31/03/2020: Updated schedule and added material on linear algebra | ||

+ | * 19/03/2020: Added lab material, both with empty notebooks and final result | ||

+ | * 11/03/2020: Added today's lecture videos and planned next week schedule (To Be Completed) | ||

+ | * 11/03/2020: The course starts today! | ||

+ | * 03/03/2020: The course is going to start soon ... | ||

+ | --> | ||

+ | |||

+ | ==Course Aim & Organization== | ||

+ | |||

+ | The objective of the Machine Learning course is to give an in-depth presentation of the techniques most used for pattern recognition, knowledge discovery, and data analysis/modeling. These techniques are presented both from a theoretical (i.e., statistics and information theory) perspective and a practical one (i.e., coding examples) through the descriptions of algorithms and their implementations in a general-purpose programming language (i.e., python). | ||

+ | |||

+ | The course presents the classical supervised and unsupervised learning paradigms described and discussed presenting regression, classification, and clustering problems in Bioinformatics. The course is composed of a set of lectures on specific machine learning techniques (e.g., generalized linear regression, logistic regression, linear and quadratic discriminant analysis, support vector machines, k-nearest-neighborhood, clustering, etc.) preceded by the introduction of the Statistical Learning framework which acts as a common reference framework for the entire course. | ||

+ | |||

+ | ===Teachers=== | ||

+ | |||

+ | The course is composed of a blending of lectures and exercises by the course teacher and a teaching assistant. | ||

+ | |||

+ | * [http://www.deib.polimi.it/ita/personale/dettagli/267262 Matteo Matteucci]: the course teacher and here it is his [http://politecnicomilano.webex.com/join/matteo.matteucci webex room] | ||

+ | * [http://www.deib.polimi.it/ita/personale/dettagli/910274 Marco Cannici]: the teaching assistant and here it is his [http://politecnicomilano.webex.com/join/marco.cannici webex room] | ||

+ | |||

+ | ===Course Program=== | ||

+ | |||

+ | The course mostly follows the following book which is also available for download in pdf | ||

+ | |||

+ | * [http://www-bcf.usc.edu/~gareth/ISL/ An Introduction to Statistical Learning with Applications in R] by Gareth James, Daniela Witten, Trevor Hastie, and Robert Tibshirani | ||

+ | |||

+ | The course lectures will present the theory and practice of the following: | ||

+ | * Machine Learning and Pattern Classification: the general concepts of Machine Learning and Pattern Recognition are introduced within the framework of Statistical Decision Theory with reference to the bias-variance trade-off and the Bayes classifier; | ||

+ | * Generalized Linear Regression: linear methods for regression will be presented and discussed introducing different techniques (e.g., Linear Regression, Ridge Regression, K-Nearest Neighbors Regression, Non-Linear Regression, etc.) and the most common methodologies for model validation and selection (e.g., AIC, BIC, cross-validation, stepwise feature selection, Lasso, etc.). | ||

+ | * Linear and Non-Linear Classification: generative and discriminative techniques for classification will be described and discussed (e.g., Logistic Regression, Linear and Quadratic Discriminant Analysis, K-Nearest Neighbors, Perceptron Rule, and Support Vector Machines, etc.). Metrics for classifiers evaluation and comparison are presented in this part of the course (e.g., accuracy, precision, recall, ROC, AUC, F-measure, Matthew coefficient). | ||

+ | * Unsupervised Learning: the most common approaches to unsupervised learning are described mostly focusing on clustering methods such as hierarchical clustering, k-means, k-medoids, Mixture of Gaussians, DBSCAN, etc | ||

+ | |||

+ | These topics will be presented both from a theoretical perspective and a practical one via implementations in the general-purpose programming language python. | ||

+ | |||

+ | ===Detailed course schedule=== | ||

+ | |||

+ | A detailed schedule of the course can be found here; topics are just indicative while days and teachers are correct up to some last-minute change (I will notify you by email). Please note that not all days we have lectures!! | ||

+ | |||

+ | Note: Lecture timetable interpretation | ||

+ | * On Wednesday, in room B.6.1, starts at 14:15 (cum tempore), ends at 18:15 (but more likely at 17:15) | ||

+ | * On Thursday, in room B.6.1, starts at 08:15 (cum tempore), ends at 10:15 | ||

+ | |||

+ | {| border="1" align="center" style="text-align:center;" | ||

+ | |- | ||

+ | |Date || Day || Time || Room || Teacher || Type || Topic | ||

+ | |- | ||

+ | |24/02/2021 || Wednesday || 15:15-18:15 || B.6.1 || Matteo Matteucci || Lecture || [https://politecnicomilano.webex.com/politecnicomilano/ldr.php?RCID=4d25d6ca96674b84a7a94e991387b458 Course Intro] + [https://politecnicomilano.webex.com/politecnicomilano/ldr.php?RCID=68982651c3704bb0a2e5c25ff1cfe70c Machine Learning Intro] | ||

+ | |- | ||

+ | |25/02/2021 || Thursday || 08:15-10:15 || B.6.1 || Matteo Matteucci || Lecture || [https://politecnicomilano.webex.com/politecnicomilano/ldr.php?RCID=4c08d5e9abe442b9b872403b2ac43eaf Statistical Learning Theory] (Ch. 1 ISL) | ||

+ | |- | ||

+ | |03/03/2021 || Wednesday || 14:15-18:15 || B.6.1 || Matteo Matteucci || Lecture || [https://politecnicomilano.webex.com/politecnicomilano/ldr.php?RCID=7aa687ab4a874b86a3cda60a6f76e8fc Statistical Learning Theory - Bias/Variance Trade-off] (Ch. 2 ISL) | ||

+ | |- | ||

+ | |04/03/2021 || Thursday || 08:15-10:15 || B.6.1 || Matteo Matteucci || Lecture || [https://politecnicomilano.webex.com/politecnicomilano/ldr.php?RCID=52a29db7ac824b27a78ee33c73b71f83 Introduction to Linear Algebra] | ||

+ | |- | ||

+ | |10/03/2021 || Wednesday || 14:15-18:15 || Matteucci webex room || Matteo Matteucci || Lecture || [https://politecnicomilano.webex.com/politecnicomilano/ldr.php?RCID=0f8a69033d324e1d8601e02f4e3e7df1 Simple Linear Regression] (Ch. 2 ISL + Ch. 3 ISL) | ||

+ | |- | ||

+ | |11/03/2021 || Thursday || --- || --- || --- || ---|| --- No lecture --- | ||

+ | |- | ||

+ | |17/03/2021 || Wednesday || 14:15-18:15 || Cannici webex room || Marco Cannici || Python Laboratory || [https://politecnicomilano.webex.com/politecnicomilano/ldr.php?RCID=83b0b99a801d2079368067d0af5fac6b Python + Numpy + Bias/Variance] | ||

+ | |- | ||

+ | |18/03/2021 || Thursday || 08:15-10:15 || Matteucci webex room || Matteo Matteucci || Lecture || [https://politecnicomilano.webex.com/politecnicomilano/ldr.php?RCID=653ddf65302e4312bc7c532bfae4f720 Multi Variate Linear Regression] (Ch. 2 ISL + Ch. 3 ISL) | ||

+ | |- | ||

+ | |24/03/2021 || Wednesday || 14:15-18:15 || Cannici webex room || Marco Cannici || Python Laboratory || [https://politecnicomilano.webex.com/politecnicomilano/ldr.php?RCID=6a5da10f8b6fe5e8dab98d1f4726ced6 Multivariate Linear Regression Laboratory] | ||

+ | |- | ||

+ | |25/03/2021 || Thursday || 08:15-10:15 || Matteucci webex room || Matteo Matteucci || Lecture || [https://politecnicomilano.webex.com/politecnicomilano/ldr.php?RCID=9788f3a243f8496fb30f8bac9abf7ef4 Generalized Linear Regression] (Ch. 2 ISL + Ch. 3 ISL) | ||

+ | |- | ||

+ | |31/03/2021 || Wednesday || 14:15-18:15 || Matteucci webex room || Matteo Matteucci || Lecture || [https://politecnicomilano.webex.com/politecnicomilano/ldr.php?RCID=4d48804210294afabb1e1a3aa0f8913f Feature Selection and Model Assessment] (Ch. 3 + Ch. 6 ISL) | ||

+ | |- | ||

+ | |01/04/2021 || Thursday || 08:15-10:15 || Matteucci webex room || Matteo Matteucci || Lecture || [https://politecnicomilano.webex.com/politecnicomilano/ldr.php?RCID=592c0fd5e42a4b039ff228561aacedd1 Ridge Regression and Lasso] (Ch. 3 + Ch. 6 ISL) | ||

+ | |- | ||

+ | |07/04/2021 || Wednesday || 14:15-18:15 || Cannici webex room || Marco Cannici || Python Laboratory || [https://politecnicomilano.webex.com/politecnicomilano/ldr.php?RCID=bd67b7220eb4bd6997ccd034b229b9a8 Generalized Linear Regression and Feature Selection Laboratory] | ||

+ | |- | ||

+ | |08/04/2021 || Thursday || 08:15-10:15 || Matteucci webex room || Matteo Matteucci || Lecture || [https://politecnicomilano.webex.com/politecnicomilano/ldr.php?RCID=34633f7cadfb49c6ba8b4b1dc4467646 Classification: KNN and Logistic Regression] (Ch. 4 ISL + Ch. 4 ESL) | ||

+ | |- | ||

+ | |14/04/2021 || Wednesday || '''15:15-18:15''' || B.6.1 ||Matteo Matteucci || Lecture || [https://politecnicomilano.webex.com/politecnicomilano/ldr.php?RCID=872ac30ecccb40eb9f62ec52e181d027 Classification: Logistic Regression] (Ch. 4 ISL + Ch. 4 ESL) | ||

+ | |- | ||

+ | |15/04/2021 || Thursday || 08:15-10:15 || B.6.1 || Matteo Matteucci || Lecture || [https://politecnicomilano.webex.com/politecnicomilano/ldr.php?RCID=d2ddca82f5ab4de98bda786e6eb2e9b9 Classification: Linear Discriminanr Analysis] (Ch. 4 ISL) | ||

+ | |- | ||

+ | |22/04/2021 || Wednesday || --- || --- || --- || --- || --- No Lecture --- | ||

+ | |- | ||

+ | |23/04/2021 || Thursday || --- || --- || --- || --- || --- No Lecture --- | ||

+ | |- | ||

+ | |28/04/2021 || Wednesday || --- || --- || --- || --- || --- No Lecture --- | ||

+ | |- | ||

+ | |29/04/2021 || Thursday || 08:15-10:15 || B.6.1 || Matteo Matteucci || Lecture || [https://politecnicomilano.webex.com/politecnicomilano/ldr.php?RCID=76439012d78a425eab1ab550601c4700 Evaluation methods for classification] | ||

+ | |- | ||

+ | |05/05/2021 || Wednesday || 14:15-18:15 || B.6.1 || Marco Cannici || Python Laboratory || [https://politecnicomilano.webex.com/politecnicomilano/ldr.php?RCID=93b1acdb8065b22c92d00f9539563a83 Logistic Regression and LDA Laboratory (Part 1)][https://politecnicomilano.webex.com/politecnicomilano/ldr.php?RCID=f691eb71b3ce81c735a440871f2a635b (Part 2)] | ||

+ | |- | ||

+ | |06/05/2021 || Thursday || 08:15-10:15 || B.6.1 || Matteo Matteucci || Lecture || [https://politecnicomilano.webex.com/politecnicomilano/ldr.php?RCID=ca8305b65ee247e28d8cae0dc6c8582f The Perceptron] (Ch. 4 ESL, Ch. 9 ISL, Ch. 12 ESL) | ||

+ | |- | ||

+ | |12/05/2021 || Wednesday || 14:15-18:15 || B.6.1 ||Matteo Matteucci || Lecture || [https://politecnicomilano.webex.com/politecnicomilano/ldr.php?RCID=fec02aafdb55405ca03dc756e2b95a47 Support Vector Machines] (Ch. 4 ESL, Ch. 9 ISL, Ch. 12 ESL) | ||

+ | |- | ||

+ | |13/05/2021 || Thursday || 08:15-10:15 || B.6.1 || Matteo Matteucci || Lecture || [https://politecnicomilano.webex.com/politecnicomilano/ldr.php?RCID=cf975d329332417582e0383d2f3bbc67 Unsupervised Learning and Clustering] (Ch. 10 ISL) | ||

+ | |- | ||

+ | |19/05/2021 || Wednesday || 14:15-18:15 || B.6.1 || Marco Cannici || Python Laboratory || [https://politecnicomilano.webex.com/politecnicomilano/ldr.php?RCID=ad0c6db58013cc99272e921facb51b57 SVM and Classifiers Evaluation Laboratory] | ||

+ | |- | ||

+ | |20/05/2021 || Thursday || 08:15-10:15 || B.6.1 || Matteo Matteucci || Lecture || [https://politecnicomilano.webex.com/politecnicomilano/ldr.php?RCID=d0a9deddbd2d4cf8a30c74159ba453cb Clustering] (Ch. 10 ISL) | ||

+ | |- | ||

+ | |26/05/2021 || Wednesday || 14:15-18:15 || B.6.1 || Marco Cannici || Python Laboratory || [https://politecnicomilano.webex.com/politecnicomilano/ldr.php?RCID=cd817e862eb56acf02c09be413f915a1 Clustering Laboratory] | ||

+ | |- | ||

+ | |27/05/2021 || Thursday || 08:15-10:15 || B.6.1 || Matteo Matteucci || Lecture || [https://politecnicomilano.webex.com/politecnicomilano/ldr.php?RCID=dfbeb4acf10b418a8fdc18cbd79ac742 Clustering] (Ch. 10 ISL) | ||

+ | |- | ||

+ | |02/06/2021 || Wednesday || --- || --- || --- || --- || --- No Lecture --- | ||

+ | |- | ||

+ | |03/06/2021 || Thursday || 08:15-11:15 || B.6.1 || Matteo Matteucci || Lecture || [https://politecnicomilano.webex.com/politecnicomilano/ldr.php?RCID=26d10f88d441aa3f499d99f0e9c1b82d Clustering Evaluation] (Ch. 10 ISL) | ||

+ | |- | ||

+ | |04/06/2021 || Friday || 14:15-17:15 || B.6.1 || Matteo Matteucci || Lecture || [https://politecnicomilano.webex.com/politecnicomilano/ldr.php?RCID=31466d593b12e2239a65f45841ab71d4 Principal Component Analysis] (Ch. 10 ISL) | ||

+ | |} | ||

+ | |||

+ | <!-- | ||

+ | {| border="1" align="center" style="text-align:center;" | ||

+ | |- | ||

+ | |Date || Day || Time || Room || Teacher || Type || Topic | ||

+ | |- | ||

+ | |11/03/2020 || Wednesday || 14:15 - 18:15 || Teams Virtual Class || Theory || Matteo Matteucci || [https://web.microsoftstream.com/video/3565a411-bed7-4b20-9dd6-00ee8b9ddd54 Course Introduction], [https://web.microsoftstream.com/video/4a702565-386d-4bed-a0c1-9d1daa015703 Introduction to Machine Learning], and [https://web.microsoftstream.com/video/cef9a912-ee47-4254-8f26-318a6a014424 Statistical Machine Learning] (Ch. 1 ISL) | ||

+ | |- | ||

+ | |12/03/2020 || Thursday || 08:15 - 10:15 || Teams Virtual Class || Theory || Matteo Matteucci || [https://web.microsoftstream.com/video/389145d3-c3e5-48c2-bf82-d7877bf14b8c Statistical Decision Theory and Bias-Variance trade off] (Ch. 2 ISL) | ||

+ | |- | ||

+ | |18/03/2020 || Wednesday || 14:15 - 17:15 || Teams Virtual Class || Practice || Marco Cannici || [https://web.microsoftstream.com/video/bb2155d6-a6f2-4f82-af48-3ceb22951c4b Python + Numpy + Bias/Variance] Laboratory | ||

+ | |- | ||

+ | |19/03/2020 || Thursday || 08:15 - 10:15 || Teams Virtual Class || Theory || Matteo Matteucci || [https://web.microsoftstream.com/video/b0359dad-971c-412d-8508-fde45e1dc3fe Statistical Decision Theory and Bias-Variance trade off (continued)] (Ch. 2 ISL) | ||

+ | |- | ||

+ | |25/03/2017 || Wednesday || 14:15 - 17:15 || Teams Virtual Class || Theory || Matteo Matteucci || [https://web.microsoftstream.com/video/f88827c9-0994-4d3f-80bf-1c9b6637ba18 Simple Linear Regression and Multivariate Linear Regression] (Ch. 2 ISL + Ch. 3 ISL) | ||

+ | |- | ||

+ | |26/03/2017 || Thursday || 08:15 - 10:15 || Teams Virtual Class || Theory || Matteo Matteucci || [https://web.microsoftstream.com/video/deb2b3f5-d90d-47b8-b309-1ab88979f805 Multivariate Linear Regression (continued)] (Ch. 2 ISL + Ch. 3 ISL) | ||

+ | |- | ||

+ | |01/04/2020 || Wednesday || 14:15 - 17:15 || Teams Virtual Class || Practice || Marco Cannici || [https://web.microsoftstream.com/video/da0e35db-6995-412a-99ad-f409f0a6752d Multivariae Linear Regression (Part 1)] [https://web.microsoftstream.com/video/8defdff7-ae83-4753-a353-3d39194e63ac (Part 2)] Laboratory | ||

+ | |- | ||

+ | |02/04/2020 || Thursday || 08:15 - 10:15 || Teams Virtual Class || Theory || Matteo Matteucci || [https://web.microsoftstream.com/video/c81f59c8-7023-4206-a771-8be062b7cb21 Generalized Linear Regression] (Ch. 2 ISL + Ch. 3 ISL) | ||

+ | |- | ||

+ | |08/04/2020 || Wednesday || 14:15 - 17:15 || Teams Virtual Class || Theory || Matteo Matteucci || [https://web.microsoftstream.com/video/0255cfa0-98de-4465-a8bf-07c93e0974ee Issues with Linear Regression and Generalized Linear Regression] and [https://web.microsoftstream.com/video/e3392148-f1ee-426d-a271-3d8fcf11008a Feature Selection] (Ch. 3 + Ch. 6 ISL) | ||

+ | |- | ||

+ | |09/04/2020 || Thursday || 08:15 - 10:15 || Teams Virtual Class || Theory || Matteo Matteucci || [https://web.microsoftstream.com/video/03656a6b-46c7-483e-9263-0036144adb00 Feature Selection (continued)] (Ch. 3 + Ch. 6 ISL) | ||

+ | |- | ||

+ | |15/04/2020 || Wednesday || 14:15 - 17:15 || Teams Virtual Class || Practice || Marco Cannici || [https://web.microsoftstream.com/video/58093db6-f365-4184-8ce0-c12c03a1589f Generalized Linear Regression and Feature Selection (Part1)] [https://web.microsoftstream.com/video/52b0d7f5-a725-4406-aab3-3be5145d950f (Part 2)] Laboratory | ||

+ | |- | ||

+ | |16/04/2020 || Thursday || 08:15 - 10:15 || Teams Virtual Class || Theory || Matteo Matteucci || [https://web.microsoftstream.com/video/1565c508-4448-4678-a9e4-4ff411684227 Feature Selection (LASSO)] (Ch. 3 + Ch. 6 ISL) | ||

+ | |- | ||

+ | |22/04/2020 || Wednesday || 14:15 - 17:15 || Teams Virtual Class || Theory || Matteo Matteucci || [https://web.microsoftstream.com/video/d04083a9-8961-4448-bcf2-0576d9dccf4c Classification by KNN (Part 1)] and [https://web.microsoftstream.com/video/c56ef675-486a-425c-819d-404868e07906 Logistic Regression (Part 2)] (Ch. 4 ISL + Ch. 4 ESL) | ||

+ | |- | ||

+ | |23/04/2020 || Thursday || 08:15 - 10:15 || Teams Virtual Class || Theory || Matteo Matteucci || [https://web.microsoftstream.com/video/3a5f66b1-80d2-4ee5-ba14-7757ae662c97 Classification by Logistic Regression (continued)] (Ch. 4 ISL + Ch. 4 ESL) | ||

+ | |- | ||

+ | |29/04/2020 || Wednesday || 14:15 - 17:15 || --- || --- || --- || --- No Lecture (Laurea) --- | ||

+ | |- | ||

+ | |30/04/2020 || Thursday || 08:15 - 10:15 || Teams Virtual Class || Theory || Matteo Matteucci || [https://web.microsoftstream.com/video/a171bc2a-35e7-42c7-bdd0-d295ecfd7e26 Classification by Linear Discriminant Analysis] (Ch. 4 ISL) | ||

+ | |- | ||

+ | |06/05/2020 || Wednesday || 14:15 - 17:15 || Teams Virtual Class || Practice || Marco Cannici || [https://web.microsoftstream.com/video/cef18863-e3fd-481e-bcad-a18455796fd7 Classification via Logistic Regression, and LDA Laboratory (Part 1)] and [https://web.microsoftstream.com/video/670b7f72-5b6b-4168-9f1c-211a9ad25f48 (Part 2)] | ||

+ | |- | ||

+ | |07/05/2020 || Thursday || 08:15 - 10:15 || Teams Virtual Class || Theory || Matteo Matteucci || [https://web.microsoftstream.com/video/b2ed8ca0-c0c0-4c1a-836d-b2ffee20d85e Evaluation Methods for Classification] | ||

+ | |- | ||

+ | |13/05/2020 || Wednesday || 14:15 - 17:15 || Teams Virtual Class || Theory || Matteo Matteucci || [https://web.microsoftstream.com/video/2b881d7d-d11e-4432-8873-973bc36eeb61 Perceptron Learning] and [https://web.microsoftstream.com/video/00564932-919a-49a1-9fa5-eb7706640781 Support Vector Machines] (Ch. 4 ESL, Ch. 9 ISL, Ch. 12 ESL) | ||

+ | |- | ||

+ | |14/05/2020 || Thursday || 08:15 - 10:15 || Teams Virtual Class || Theory || Matteo Matteucci || [https://web.microsoftstream.com/video/b72fa8de-f98d-43cf-9609-5833625a4b5c Support Vector Machines and Kernel Trick] (Ch. 4 ESL, Ch. 9 ISL, Ch. 12 ESL) | ||

+ | |- | ||

+ | |20/05/2020 || Wednesday || 14:15 - 17:15 || Teams Virtual Class || Practice || Marco Cannici || [https://web.microsoftstream.com/video/fab1f62e-cea0-4cc9-9366-0ccd6bcd161b Classification (SVM and classifiers evaluation) Laboratory (Part 1)] and [https://web.microsoftstream.com/video/130b806d-5390-4321-9d05-f63e079f30a1 (Part 2)] | ||

+ | |- | ||

+ | |21/05/2020 || Thursday || 08:15 - 10:15 || Teams Virtual Class || Theory || Matteo Matteucci || [https://web.microsoftstream.com/video/1125b85e-f4a1-49d1-991f-333fff893a1e Introduction to Unsupervised Learning] (Ch. 10 ISL) | ||

+ | |- | ||

+ | |27/05/2020 || Wednesday || 14:15 - 17:15 || Teams Virtual Class || Theory || Matteo Matteucci || [https://web.microsoftstream.com/video/d8d0efb5-adfb-4376-afe3-26afb7ffd664 Clustering: Hierachical, k-means, and DBSCAN (Part 1)] and [https://web.microsoftstream.com/video/b7307896-bff7-4fd0-973f-d37fd7f91e13 (Part 2)] (Ch. 10 ISL) | ||

+ | |- | ||

+ | |28/05/2020 || Thursday || 08:15 - 10:15 || Teams Virtual Class || Theory || Matteo Matteucci || [https://web.microsoftstream.com/video/3f2975c2-1143-4870-8aed-a1a06382be14 Clustering Evaluation] (Ch. 10 ISL) | ||

+ | |- | ||

+ | |03/06/2020 || Wednesday || 14:15 - 17:15 || Teams Virtual Class || Practice || Marco Cannici || [https://web.microsoftstream.com/video/0fa04b48-f8c3-488b-bfab-92547d3a9c38 Clustering Laboratory (Part 1)] and [https://web.microsoftstream.com/video/24a40515-afdd-4cca-9b62-19e544c7e12e (Part 2)] | ||

+ | |- | ||

+ | |04/06/2020 || Thursday || 08:15 - 10:15 || Teams Virtual Class || Theory || Matteo Matteucci || [https://web.microsoftstream.com/video/f58132ba-afd3-47ce-89c8-ba16782d8f37 Principal Component Analysis] (Ch. 10 ISL) | ||

+ | |} | ||

+ | --> | ||

+ | <!-- | ||

+ | |- | ||

+ | |27/11/2017 || Tuesday || 09:15 - 12:15 || V.S7-A || Matteo Matteucci || Classification by Linear Discriminant Analysis (Ch. 4 ISL) | ||

+ | |- | ||

+ | |03/12/2017 || Monday || 08:15 - 10:15 || V.S7-A || Davide Eynard || Exercises on Classification by Linear Discriminant Analysis | ||

+ | |- | ||

+ | |04/12/2017 || Tuesday || --- || --- || --- || No Lecture | ||

+ | |- | ||

+ | |10/12/2017 || Monday || 08:15 - 10:15 || V.S7-A || Davide Eynard || Clustering: Intro, k-means and the alike, GMM, and hierachical | ||

+ | |- | ||

+ | |11/12/2017 || Tuesday || 09:15 - 12:15 || V.S7-A || Davide Eynard || Clustering: Density-based, Spectral + Evaluation | ||

+ | |- | ||

+ | |14/12/2017 || Friday || 10:15 - 13:15 || TBD || Matteo Matteucci || Classification: from generative to discriminative approaches (Ch. 4 ISL + Ch. 4 ESL) | ||

+ | |- | ||

+ | |17/12/2017 || Monday || 08:15 - 10:15 || V.S7-A || Matteo Matteucci || Support Vector Machines (Ch. 4 ESL, Ch. 9 ISL, Ch. 12 ESL) | ||

+ | |- | ||

+ | |18/12/2017 || Tuesday || 09:15 - 12:15 || V.S7-A || Matteo Matteucci || Support Vector Machines (Ch. 4 ESL, Ch. 9 ISL, Ch. 12 ESL) | ||

+ | |- | ||

+ | |} | ||

+ | --> | ||

+ | Chapters are intended as complete except for | ||

+ | * Ch.4 ESL: Section 4.5 | ||

+ | * Ch.12 ESL: Sections 12.1, 12.2, 12.3 | ||

+ | * Ch.9 ISL: Sections 9.1, 9.2, 9.3 | ||

+ | |||

+ | ===Course Evaluation=== | ||

+ | |||

+ | The course evaluation is composed by two parts: | ||

+ | |||

+ | * HW: Homework with exercises covering the whole program (up to 6 points) | ||

+ | * WE: A written examination covering the whole program (up to 26 points) | ||

+ | |||

+ | the final score will be the sum of HW (not compulsory) and WE scores. | ||

+ | |||

+ | Due to the COVID-19 situation the written exam for the 2019/2020 edition has been turned into an oral examination: | ||

+ | |||

+ | * You will get the oral grade as a mark in the scale of 30 up to 32/30 which you have to multiply by 0.8125 and then you add to it the score of the project. For your convenience here it is [[Media:ML2021-Conversion.pdf|a conversion table]] with the final mark in case you do not turn in the project or you get the whole 6 marks in the project. | ||

+ | |||

+ | ==Teaching Material (the textbook)== | ||

+ | |||

+ | Lectures will be based on material taken from the book. | ||

+ | |||

+ | * [http://www-bcf.usc.edu/~gareth/ISL/ An Introduction to Statistical Learning with Applications in R] by Gareth James, Daniela Witten, Trevor Hastie and Robert Tibshirani | ||

+ | |||

+ | If you are interested in a more deep treatment of the topics you can refer to the following book from the same authors | ||

+ | |||

+ | * [http://www-stat.stanford.edu/~tibs/ElemStatLearn/index.html The Elements of Statistical Learning: Data Mining, Inference, and Prediction.] by Trevor Hastie, Robert Tibshirani, and Jerome Friedman. | ||

+ | |||

+ | Some additional material that could be used to prepare the oral examination will be provided together with the past homeworks. | ||

+ | |||

+ | ===Teacher Slides === | ||

+ | |||

+ | In the following you can find the lecture slides used by the teacher and the teaching assistants during classes. | ||

+ | |||

+ | * [[Media:ML-2020-A0-LinearAlgebraBasics.pdf | [2020/2021] Linear Algebra Basics]]: Basic elements of linear algebra, e.g., vectors, matrices, basis, span, etc. | ||

+ | * [[Media:ML-2021-00-Intro.pdf | [2020/2021] Course introduction]]: introductory slides of the course with useful information about the grading, and the course logistics. Some examples from supervised and unsupervised learning. Regression, classification, clustering terminology and examples. | ||

+ | * [[Media:ML-2021-01-StatisticalLearning.pdf | [2020/2021] Statistical Learning Introduction]]: Statistical Learning definition, rationale, and trade-offs (e.g., prediction vs. inference, parametric vs non parametric models, flexibility vs. interpretability, etc.) | ||

+ | * [[Media:ML-2021-02-LinearRegression.pdf | [2020/2021] Linear Regression]]: Simple Linear Regression and Multiple Linear Regression. Generalized Linear models. Cross-validation techniques. Feature selection. Ridge Regression and Lasso. | ||

+ | * [[Media:ML-2021-03-LinearClassification.pdf | [2020/2021] Linear Classification]]: From Linear Regression to Logistic Regression. Linear Discriminant Analysis and Quadratic Discriminant Analysis. Comparison between linear classification methods. Discriminative vs. generative methods. Support Vector Machines. | ||

+ | * [[Media:ML-2021-04-Clustering.pdf | [2020/2021] Clustering]]: Introduction to unsupervised learning and clustering, hierarchical clustering, k-means, DBSCNA, indexes for clustering evaluation. | ||

+ | * [[Media:ML-2021-05-PrincipalComponentAnalysis.pdf | [2020/2021] Principal Component Analysis]]: Principal Component Analysis, Geometric Interpretation, Singular Values Decomposition. | ||

+ | |||

+ | ===Laboratories=== | ||

+ | |||

+ | We will use Python (with Jupyter notebooks) throughout the course, thus we kindly ask you to install the "Anaconda" package to be ready for the labs. Here are the [https://www.anaconda.com/products/individual download links]. You can find a simple Jupyter notebook [[Media:ML2021-test.zip | HERE]] to test if the installation succeeded. | ||

+ | |||

+ | To open the notebook | ||

+ | * launch the "Anaconda Navigator" app | ||

+ | * launch the "jupyter Notebook" app within the navigator, it should automatically open a webpage (it may take a while) | ||

+ | * on the webpage, navigate on the folder where you downloaded the "lab01.00-TestEnvironment.ipynb" file, and press on the file to open it | ||

+ | * then follow the instruction within the notebook | ||

+ | |||

+ | If you didn't install anaconda but just jupyter, or if you can't find Anaconda Navigator | ||

+ | * open a shell ("Anaconda Prompt" if you are using Windows) | ||

+ | * move on to the folder where you downloaded "lab01.00-TestEnvironment.ipynb" | ||

+ | * run the "jupyter notebook" command, it should automatically open a webpage | ||

+ | * then on the webpage press on the "lab01.00-TestEnvironment.ipynb" file and follow the instructions within the notebook | ||

+ | |||

+ | The following are the notebook used in the labs: | ||

+ | *[[Media:ML2021-lab01.zip | [2020/2021] Material for the first lab session]]: some useful jupiter notebooks which will be used during the first lab session ([[Media:ML2021-lab01_solutions.zip |complete version]]) | ||

+ | *[[Media:ML2021-lab02.zip | [2020/2021] Material for the second lab session]]: some useful jupiter notebooks which will be used during the second lab session ([[Media:ML2021-lab02_solutions.zip |complete version]]) | ||

+ | *[[Media:ML2021-lab03.zip | [2020/2021] Material for the third lab session]]: some useful jupiter notebooks which will be used during the third lab session ([[Media:ML2021-lab03_solutions_tmp.zip |complete version]]) | ||

+ | *[[Media:ML2021-lab04.zip | [2020/2021] Material for the fourth lab session]]: some useful jupiter notebooks which will be used during the fourth lab session ([[Media:ML2021-lab04_solutions.zip |complete version]]) | ||

+ | *[[Media:ML2021-lab05.zip | [2020/2021] Material for the fifth lab session]]: some useful jupiter notebooks which will be used during the fourth lab session ([[Media:ML2021-lab05_solutions.zip |complete version]]) | ||

+ | *[[Media:ML2021-lab06.zip | [2020/2021] Material for the sixth lab session]]: some useful jupiter notebooks which will be used during the fourth lab session ([[Media:ML2021-lab06_solutions.zip |complete version]]) | ||

+ | <!-- | ||

+ | * [[Media:ML-2016-03-AssessingModelAccuracy.pdf | [2016] Statistical Learning and Model Assessment]]: Model Assessment for Regression and Classification, Bias-Variance trade-off, Model complexity and overfitting, K-Nearest Neighbors Classifier vs. Bayes Classifier. | ||

+ | * [[Media:ML-2016-05-LinearClassification.pdf | [2016] Linear Classification]]: From Linear Regression to Logistic Regression. Linear Discriminant Analysis and Quadratic Discriminant Analysis. Comparison between linear classification methods. | ||

+ | * [[Media:ML-2016-06-SupportVectorMachines.pdf | [2016] Support Vector Machines]]: Discriminative vs. generative methids. Hyperplanes learning and Perceptron. Maximum Margin Classifiers. The Kernel trick and Support Vector Machines. | ||

+ | For exercises and lab material please refer to [http://davide.eynard.it/pattern-analysis-and-machine-intelligence-2015-2016/ Davide Eynard website]. | ||

+ | --> | ||

+ | |||

+ | ===Additional Resources=== | ||

+ | Papers and links useful to integrate the textbook | ||

+ | |||

+ | * [http://www.ekof.bg.ac.rs/wp-content/uploads/2016/09/Ponavljanje-matematike-Wayne-Winston-Operations-Research-Applications-and-Algorithms-4-edition.pdf Basic Linear Algebra]: "Basic Linear Algebra" chapter from Wayne Winston book "Operations Research Applications and Algorithms (4th ed.)" | ||

+ | * [http://scott.fortmann-roe.com/docs/BiasVariance.html Bias vs. Variance]: "Understanding the Bias-Variance Tradeoff" essay by Scott Fortmann-Roe | ||

+ | * [http://www.onmyphd.com/?p=kkt.karush.kuhn.tucker Karush Kuhn Tucker Conditions]: a short note on their meaning with references to relevant wikipedia pages | ||

+ | * [http://students.brown.edu/seeing-theory/ Seeing Theory]: a website where the basic concepts of probability and statistics are explained in a visual way. | ||

+ | |||

+ | Python examples to better practice with numpy library | ||

+ | * [https://github.com/Kyubyong/numpy_exercises Some numpy exercises], we did roughly 1, 2, 4, 6, 9, 10, 13 | ||

+ | * [https://github.com/rougier/numpy-100 Othen numpy exercises] from simple to complex | ||

+ | * [https://www.w3resource.com/python-exercises/numpy/index-array.php More numpy exercises] from simple to complex | ||

+ | <!-- | ||

+ | ===Past Exams and Sample Questions=== | ||

+ | For some samples of exams you can check the last year PAMI ones | ||

+ | |||

+ | * [[Media:2016_02_03_PAMI.pdf |03/02/2016 PAMI Exam]] | ||

+ | * [[Media:2016_02_19_PAMI.pdf |19/02/2016 PAMI Exam]] | ||

+ | * [[Media:2016_07_06_PAMI.pdf |06/07/2016 PAMI Exam]] | ||

+ | * [[Media:2016_09_09_PAMI.pdf |09/09/2016 PAMI Exam]] | ||

+ | * [[Media:2016_09_28_PAMI.pdf |28/09/2016 PAMI Exam]] | ||

+ | --> | ||

+ | |||

+ | ===Online Resources=== | ||

+ | |||

+ | The following are links to online sources which might be useful to complement the material above | ||

+ | * [https://www.r-bloggers.com/in-depth-introduction-to-machine-learning-in-15-hours-of-expert-videos/ Statistical Learning MOOC] covering the entire ISL book offered by Trevor Hastie and Rob Tibshirani. Start anytime in self-paced mode. | ||

+ | * [http://math.arizona.edu/~hzhang/math574m.html MATH 574M] University of Arizona Course on ''Statistical Machine Learning and Data Mining''; here you can find slides covering part of the course topics (the reference book for this course is again ''The Elements of Statistical Learning'') | ||

+ | |||

+ | <!-- | ||

+ | == 2013-2014 Homework == | ||

+ | |||

+ | The 2013 Homework (alike the 2012 one) is organized as an octave series of tutorials. You are requested to go through the tutorials and practice with the algorithms that have been presented in class. To prove us you have done it and that you have understood the code you will be requested to solve few exercises and provide us a pdf report by email | ||

+ | |||

+ | === Part 1: Linear Classification Methods === | ||

+ | |||

+ | * [[Media:homework_pami_classification_2013_2014.pdf | Homework 2013-2014 on Classification]]: this is the text of the first part of the homework; it has been intentionally edited not to allow cut and paste. '''This part of the homework will contribute to the 10% of the grade and the deadline to submit the solution by Sunday 17/11 23:59''' | ||

+ | ** [[Media:SAheart.data | SAheart.data]]: the dataset used for the homework | ||

+ | ** [[Media:SAheart.info | SAheart.info]]: the dataset used for the homework | ||

+ | |||

+ | '''Note 1:''' Submit the solution by loading it on www.dropitto.me/matteucci (pwd is dropittome) | ||

+ | |||

+ | '''Note 2:''' please name your pdf as pami_SURNAME_STUDENTID_classification.pdf; if you submit a homework for different people, please pick one of the names for the file but PUT ALL THE NAMES IN THE COVER PAGE!! | ||

+ | |||

+ | === Part 2: Regression === | ||

+ | * [[Media:homework_pami_regression_2013_2014.pdf | Homework 2013-2014 Regression]]: this is the text of the second part of the homework; it has been intentionally edited not to allow cut and paste. '''This part of the homework will contribute to the 10% of the grade and the deadline to submit the solution by email to malago@di.unimi.it (cc to matteo.matteucci@polimi.it) is Friday 20/12 23:59''' | ||

+ | ** [[Media:prostate.data | prostate.data]]: the dataset used for the homework | ||

+ | ** [[Media:prostate.info | prostate.info]]: the dataset used for the homework | ||

+ | ** [[Media:diabete.mat | diabete.mat]]: the dataset used for the homework | ||

+ | ** [[Media:textread.m | textread.m]]: (optional) function which might be useful depending on your octave version | ||

+ | ** [[Media:strread.m | strread.m]]: (optional) function which might be useful depending on your octave version | ||

+ | |||

+ | For any question or doubt please sen us an email as soon as possible. | ||

+ | |||

+ | '''Note 1:''' for some strange reason the CSM of the website has decided to rename the files with capitals, please save them in lower case :-( | ||

+ | |||

+ | <strike>'''Note 2:''' rename the file Diabete.data into diabete.mat ... still fighting with the CSM :-)</strike> | ||

+ | |||

+ | '''Note 3:''' the code has been tested with octave under linux, we suggest to use it not to spend too much time with installing it under windows or using matlab. If you do not have linux installed, try using a live CD as the ubuntu 13.04 live distro ;-) | ||

+ | |||

+ | === Part 3: Clustering === | ||

+ | |||

+ | The code and the text of the third part of the homework are available online at this post | ||

+ | |||

+ | * [http://davide.eynard.it/2013/12/30/octave-clustering-demo-part-6-more-evaluation/ Homework 2013-2014 on clustering evaluation] | ||

+ | |||

+ | As usual, '''this part of the homework will contribute to the 10% of the grade'''; the deadline to submit the solution is the end of the course. You have to '''send it to davide.eynard_at_gmail.com Friday 24/01 23:59'''. | ||

+ | |||

+ | '''Note 1:''' for any doubt or question send an email, as soon as possible, to Davide Eynard so to have a prompt reply and not get stuck during homework execution. | ||

+ | |||

+ | '''Note 2:''' you have to turn in only the solution of "Ocatave clustering demo part 6", while the other parts can be used as reference to improve your understanding in basic clustering algorithms. | ||

+ | |||

+ | === Part 2: Classification === | ||

+ | |||

+ | * [[Media:homework_pami_classification_2013.pdf | Homework 2013 Classification]]: this is the text of the second part of the homework; it has been intentionally edited not to allow cut and paste. '''This part of the homework will contribute to the 10% of the grade and the deadline to submit the solution by Sunday 23/06 23:59''' | ||

+ | ** [[Media:SAheart.data | SAheart.data]]: the dataset used for the homework | ||

+ | ** [[Media:SAheart.info | SAheart.info]]: the dataset used for the homework | ||

+ | |||

+ | '''Note 1:''' Submit the solution by loading it on www.dropitto.me/matteucci (pwd is dropittome) | ||

+ | |||

+ | '''Note 2:''' please name your pdf as pami_SURNAME_STUDENTID_classification.pdf; if you submit a homework for different people, please pick one of the names for the file but PUT ALL THE NAMES IN THE COVER PAGE!! | ||

+ | |||

+ | |||

+ | |||

+ | '''Errata Corrige''': there were a few bugs in the homework text. I have updated the pdf and they were: | ||

+ | |||

+ | In the computation of feature projection, the code for the maximization of a'B*a via SVD should be changed as it follows | ||

+ | % maximization of a'*B*a / a'*w*a via SVD | ||

+ | [Vw, Dw, Vw] = svd(W); | ||

+ | Whalf = Vw * sqrt(Dw) * Vw'; % Whalf'*Whalf == W | ||

+ | Wminushalf = inv(Whalf); | ||

+ | Mstar = M*Wminushalf; | ||

+ | % Add this variable for computing Mstar mean | ||

+ | meanMstar = mean(Mstar); | ||

+ | for i=1:size(M,1) | ||

+ | % Remove the mean saved before the loop | ||

+ | Mstar(i,:) = Mstar(i,:)-meanMstar; | ||

+ | end | ||

+ | Bstar = Mstar'*Mstar; | ||

+ | [Vstar, Db, Vstar] = svd(Bstar); | ||

+ | |||

+ | In the Fisher projection it is more correct to use only the training data to learn the projection and then we can train and test on the corresponding subsets | ||

+ | |||

+ | a = FisherProjection(X(training,:),Y(training,:)); | ||

+ | reducedX = X*a(:,1); | ||

+ | [mu_0, mu_1, sigma, p_0, p_1] = linearDiscriminantAnalysis_train(reducedX(training), Y(training)) | ||

+ | |||

+ | I forgot to filter for just the training samples when performing Quadratic Discriminant Analysis | ||

+ | |||

+ | quadX = expandToQuadraticSpace(X); | ||

+ | %check this out! | ||

+ | size(quadX) | ||

+ | beta = linearRegression_train(quadX(training), Y(training)); | ||

+ | |||

+ | And in general you should always train on the training data and test on the testing data ;-). | ||

+ | |||

+ | === Part 3: Clustering === | ||

+ | |||

+ | The code and the text of the third part of the homework are available online at these posts | ||

+ | |||

+ | * [http://davide.eynard.it/2013/06/18/octave-clustering-demo-part-4-k-medoids/ Homework 2013 on k-medoids] | ||

+ | * [http://davide.eynard.it/2013/06/18/octave-clustering-demo-part-5-hierarchical-clustering/ Homework 2013 on hierarchical clustering] | ||

+ | |||

+ | As usual, '''this part of the homework will contribute to the 10% of the grade'''; the deadline to submit the solution is '''before the you take the exam''' sending it to davide.eynard_at_gmail.com. | ||

+ | |||

+ | * [http://davide.eynard.it/2012/06/05/octave-clustering-demo-part-0-introduction-and-setup/ Homework 2012 part 3:] follow this tutorial and answer the questions from all 5 sub-tutorials. | ||

+ | |||

+ | == 2012 Homework == | ||

+ | |||

+ | |||

+ | The Homework of 2012 organized like an octave/matlab series of tutorials. You are requested to go through the tutorials and practice with the algorithms that have been presented in class. To prove us you have done it and that you have understood the code you will be requested to solve few exercises and provide us a pdf report by email | ||

+ | |||

+ | * [[Media:PAMI_homework_2012_1.pdf | Homework 2012 part 1]]: this is the text of the first part of the homework; it has been intentionally edited not to allow cut and paste. '''This part of the homework will contribute to the 10% of the grade and the deadline to submit the solution by email to matteucci@elet.polimi.it and malago@elet.polimi.it is Tuesday 5/6 23:59''' | ||

+ | ** [[Media:prostate.data | prostate.data]]: the dataset used for the homework | ||

+ | ** [[Media:prostate.info | prostate.info]]: the dataset used for the homework | ||

+ | ** [[Media:textread.m | textread.m]]: (optional) function which might be useful depending on your octave version | ||

+ | ** [[Media:strread.m | strread.m]]: (optional) function which might be useful depending on your octave version | ||

+ | |||

+ | '''Note:''' for some strange reason the CSM of the website has decided to rename the files with capitals, please save them in lower case :-( | ||

+ | |||

+ | * [[Media:PAMI_homework_2012_2.pdf | Homework 2012 part 2]]: this is the text of the second part of the homework; it has been intentionally edited not to allow cut and paste. '''This part of the homework will contribute to the 10% of the grade; the deadline to submit the solution by email to matteucci@elet.polimi.it is the day before the exam you decide to attend''' (e.g., if you decide to take the exam on the 26/6 then you need to turn it in by 25/6). | ||

+ | ** [[Media:SAheart.data | SAheart.data]]: the dataset used for the homework | ||

+ | ** [[Media:SAheart.info | SAheart.info]]: the dataset used for the homework | ||

+ | |||

+ | '''Errata Corrige''': there were a few bugs a bug in the homework text. I have updated the pdf and they were: | ||

+ | In the code for loading the data I forgot to remove the first column which you do not need | ||

+ | data = dlmread('SAheart.data',',',1,1); | ||

+ | X = data(:,1:9); | ||

+ | Y = data(:,10); | ||

+ | |||

+ | In the StratifiedSampling function the sorted verctors should be assigned | ||

+ | % just an ahestetic sorting | ||

+ | testing = sort(testing); | ||

+ | training = sort(training); | ||

+ | |||

+ | In the computation of feature projection, the code for the maximization of a'B*a via SVD should be changed as it follows | ||

+ | % maximization of a'*B*a / a'*w*a via SVD | ||

+ | [Vw, Dw, Vw] = svd(W); | ||

+ | Whalf = Vw * sqrt(Dw) * Vw'; % Whalf'*Whalf == W | ||

+ | Wminushalf = inv(Whalf); | ||

+ | Mstar = M*Wminushalf; | ||

+ | % Add this variable for computing Mstar mean | ||

+ | meanMstar = mean(Mstar); | ||

+ | for i=1:size(M,1) | ||

+ | % Remove the mean saved before the loop | ||

+ | Mstar(i,:) = Mstar(i,:)-meanMstar; | ||

+ | end | ||

+ | Bstar = Mstar'*Mstar; | ||

+ | [Vstar, Db, Vstar] = svd(Bstar); | ||

+ | |||

+ | In the expansion to quadratic space the starting index for the inner loop should i and not 1. Moreover in some cases it might be possible to have columns which are duplicated (e.g., with boolean attribute); in this case you should not need the robust version of linear regression. | ||

+ | function extendedX = expandToQuadraticSpace(X) | ||

+ | % adds new columns to extendedX; keeps X for other calculations | ||

+ | extendedX = X; | ||

+ | for i=1:size(X, 2) | ||

+ | for j=i:size(X, 2) | ||

+ | newColumn = X(:, i) .* X(:, j); | ||

+ | extendedX = [extendedX newColumn]; | ||

+ | end | ||

+ | end | ||

+ | % remove duplicated columns | ||

+ | duplicates = []; | ||

+ | for i=1:size(extendedX, 2) | ||

+ | for j=i+1:size(extendedX, 2) | ||

+ | if(sum(extendedX(:,i)==extendedX(:,j)) == size(X,1)) | ||

+ | duplicates = [duplicates j]; | ||

+ | end | ||

+ | end | ||

+ | end | ||

+ | extendedX(:,duplicates) = []; | ||

+ | end | ||

+ | |||

+ | * [http://davide.eynard.it/2012/06/05/octave-clustering-demo-part-0-introduction-and-setup/ Homework 2012 part 3]: the third part of the homework is '''optional''', so you are not required to complete it. However, if you want to give it a try and use it to understand the topics covered by Davide Eynard in his lectures you are welcome. As usual, the questions in this homework are very close to the ones you will find in classworks, so we suggest to have a look at hose anyway! '''In case you decide to turn it in and have it contribute with a 10% to the grade, the deadline to submit the solution by email to matteucci@elet.polimi.it and davide.eynard@polimi.it is the day before you decide to take the exam''' (e.g., if you decide to take the exam on the 10/7 then you need to turn it in by 9/7) | ||

+ | |||

+ | '''Note:''' homeworks are meant to let you see (and practice) a little bit with the topics presented during the course. They are evaluated because you spent some time on those and thus you deserve some credit for that ;-) | ||

+ | |||

+ | == 2011 Homework == | ||

+ | |||

+ | Here you can find the homework for the year 2011 and the material you need to complete it. Please read the F.A.Q. below and for any unsolved doubt contact the teachers of the course. | ||

+ | |||

+ | * [[Media:PAMI_homework_2011_v02.pdf | Homework 2011 v02]] a minor change in the signature of the logistic regression function | ||

+ | * [[Media:PAMI_homework_2011_v01.pdf | Homework 2011 v01]] text with questions and exercises | ||

+ | * [[Media:dataset.txt | Dataset]] for the clustering exercise in csv format | ||

+ | |||

+ | '''Frequently Asked Questions''' | ||

+ | |||

+ | * '''''How do I take the square root of a matrix?''''': check the diagonalization approach from [http://en.wikipedia.org/wiki/Square_root_of_a_matrix]. | ||

+ | |||

+ | * '''''How do I compute the chi square statistics?'''': in the slide there is a cut and paste error since e_ij=R_it*C_tj as described here [http://en.wikipedia.org/wiki/Pearson's_chi-square_test] | ||

+ | |||

+ | * '''''When it is due? In which format?''''': The homework is due on the 29/06 and should be delivered by email. Send us (all the course teachers) the .m files in a zip archive attached to this email and a link to the pdf with the written part (not to flood our mailboxes). | ||

+ | |||

+ | * '''''Can we do that in groups? How many people per group?''''': Yes, you can work on the homework in groups, but no more than 3 people per group are allowed. Put the names of all homework authors in the pdf and in all the .m files. If you discuss something with other people, w.r.t. the people in your group, point it out in the pdf file as well. | ||

+ | |||

+ | * '''''Can we ask questions about the exercises or the code?''''': Yes you should! First of all, there might be unclear things in the exercise descriptions and those should be clarified as soon as possible for all (this is why the homework is versioned). But you could ask for help as well, our goal is to have you all solving all the questions and get a high grade ... but we will not do the homework on you behalf ;-) | ||

+ | |||

+ | * '''''How the optional questions are graded?''''': They compensate for possible errors in the other questions; we suggest to work on them anyway to be sure you get the maximum grading. | ||

+ | |||

+ | * '''''How the homework will be graded?''''': we are interested in understanding if you understood or not; thus we are not interested in the result, but we want to check how you get to the result. So please: 1) clarify all the assumptions and all the steps in your exercises 2) comment as much as possible your .m files! | ||

+ | |||

+ | --> |

## Revision as of 16:28, 11 September 2021

The following are last-minute news you should be aware of ;-)

* 11/09/2021: Grade of the Summer session + homeworks * 09/07/2021: Grade of the 24/06/2021 oral exams * 09/07/2021: Updated Homework + Oral conversion table * 03/07/2021: Updated Homework available here!!! * 08/06/2021: Updated all videos and all slides from the course. * 02/06/2021: You can fin the 2020/2021 homework here!!! * 26/05/2021: The link to the form to request an instance of remote examination for June and July is here! * 09/04/2021: From next week lectures will be back to presence (plus webex streaming) * 22/03/2021: Added completed material from the last lab plus some exercises ... * 17/03/2021: Added the material for the lab of today ... * 10/03/2021: 11/03/2021 lecture has been canceled * 06/03/2021: website update with linear algebra slides and (working) links to all lectures * 05/03/2021: Since today we are moved fully online so lectures will happen in my webex room (same holds for labs) * 24/02/2021: Lectures start today

## Contents

## Course Aim & Organization

The objective of the Machine Learning course is to give an in-depth presentation of the techniques most used for pattern recognition, knowledge discovery, and data analysis/modeling. These techniques are presented both from a theoretical (i.e., statistics and information theory) perspective and a practical one (i.e., coding examples) through the descriptions of algorithms and their implementations in a general-purpose programming language (i.e., python).

The course presents the classical supervised and unsupervised learning paradigms described and discussed presenting regression, classification, and clustering problems in Bioinformatics. The course is composed of a set of lectures on specific machine learning techniques (e.g., generalized linear regression, logistic regression, linear and quadratic discriminant analysis, support vector machines, k-nearest-neighborhood, clustering, etc.) preceded by the introduction of the Statistical Learning framework which acts as a common reference framework for the entire course.

### Teachers

The course is composed of a blending of lectures and exercises by the course teacher and a teaching assistant.

- Matteo Matteucci: the course teacher and here it is his webex room
- Marco Cannici: the teaching assistant and here it is his webex room

### Course Program

The course mostly follows the following book which is also available for download in pdf

- An Introduction to Statistical Learning with Applications in R by Gareth James, Daniela Witten, Trevor Hastie, and Robert Tibshirani

The course lectures will present the theory and practice of the following:

- Machine Learning and Pattern Classification: the general concepts of Machine Learning and Pattern Recognition are introduced within the framework of Statistical Decision Theory with reference to the bias-variance trade-off and the Bayes classifier;
- Generalized Linear Regression: linear methods for regression will be presented and discussed introducing different techniques (e.g., Linear Regression, Ridge Regression, K-Nearest Neighbors Regression, Non-Linear Regression, etc.) and the most common methodologies for model validation and selection (e.g., AIC, BIC, cross-validation, stepwise feature selection, Lasso, etc.).
- Linear and Non-Linear Classification: generative and discriminative techniques for classification will be described and discussed (e.g., Logistic Regression, Linear and Quadratic Discriminant Analysis, K-Nearest Neighbors, Perceptron Rule, and Support Vector Machines, etc.). Metrics for classifiers evaluation and comparison are presented in this part of the course (e.g., accuracy, precision, recall, ROC, AUC, F-measure, Matthew coefficient).
- Unsupervised Learning: the most common approaches to unsupervised learning are described mostly focusing on clustering methods such as hierarchical clustering, k-means, k-medoids, Mixture of Gaussians, DBSCAN, etc

These topics will be presented both from a theoretical perspective and a practical one via implementations in the general-purpose programming language python.

### Detailed course schedule

A detailed schedule of the course can be found here; topics are just indicative while days and teachers are correct up to some last-minute change (I will notify you by email). Please note that not all days we have lectures!!

Note: Lecture timetable interpretation * On Wednesday, in room B.6.1, starts at 14:15 (cum tempore), ends at 18:15 (but more likely at 17:15) * On Thursday, in room B.6.1, starts at 08:15 (cum tempore), ends at 10:15

Date | Day | Time | Room | Teacher | Type | Topic |

24/02/2021 | Wednesday | 15:15-18:15 | B.6.1 | Matteo Matteucci | Lecture | Course Intro + Machine Learning Intro |

25/02/2021 | Thursday | 08:15-10:15 | B.6.1 | Matteo Matteucci | Lecture | Statistical Learning Theory (Ch. 1 ISL) |

03/03/2021 | Wednesday | 14:15-18:15 | B.6.1 | Matteo Matteucci | Lecture | Statistical Learning Theory - Bias/Variance Trade-off (Ch. 2 ISL) |

04/03/2021 | Thursday | 08:15-10:15 | B.6.1 | Matteo Matteucci | Lecture | Introduction to Linear Algebra |

10/03/2021 | Wednesday | 14:15-18:15 | Matteucci webex room | Matteo Matteucci | Lecture | Simple Linear Regression (Ch. 2 ISL + Ch. 3 ISL) |

11/03/2021 | Thursday | --- | --- | --- | --- | --- No lecture --- |

17/03/2021 | Wednesday | 14:15-18:15 | Cannici webex room | Marco Cannici | Python Laboratory | Python + Numpy + Bias/Variance |

18/03/2021 | Thursday | 08:15-10:15 | Matteucci webex room | Matteo Matteucci | Lecture | Multi Variate Linear Regression (Ch. 2 ISL + Ch. 3 ISL) |

24/03/2021 | Wednesday | 14:15-18:15 | Cannici webex room | Marco Cannici | Python Laboratory | Multivariate Linear Regression Laboratory |

25/03/2021 | Thursday | 08:15-10:15 | Matteucci webex room | Matteo Matteucci | Lecture | Generalized Linear Regression (Ch. 2 ISL + Ch. 3 ISL) |

31/03/2021 | Wednesday | 14:15-18:15 | Matteucci webex room | Matteo Matteucci | Lecture | Feature Selection and Model Assessment (Ch. 3 + Ch. 6 ISL) |

01/04/2021 | Thursday | 08:15-10:15 | Matteucci webex room | Matteo Matteucci | Lecture | Ridge Regression and Lasso (Ch. 3 + Ch. 6 ISL) |

07/04/2021 | Wednesday | 14:15-18:15 | Cannici webex room | Marco Cannici | Python Laboratory | Generalized Linear Regression and Feature Selection Laboratory |

08/04/2021 | Thursday | 08:15-10:15 | Matteucci webex room | Matteo Matteucci | Lecture | Classification: KNN and Logistic Regression (Ch. 4 ISL + Ch. 4 ESL) |

14/04/2021 | Wednesday | 15:15-18:15 |
B.6.1 | Matteo Matteucci | Lecture | Classification: Logistic Regression (Ch. 4 ISL + Ch. 4 ESL) |

15/04/2021 | Thursday | 08:15-10:15 | B.6.1 | Matteo Matteucci | Lecture | Classification: Linear Discriminanr Analysis (Ch. 4 ISL) |

22/04/2021 | Wednesday | --- | --- | --- | --- | --- No Lecture --- |

23/04/2021 | Thursday | --- | --- | --- | --- | --- No Lecture --- |

28/04/2021 | Wednesday | --- | --- | --- | --- | --- No Lecture --- |

29/04/2021 | Thursday | 08:15-10:15 | B.6.1 | Matteo Matteucci | Lecture | Evaluation methods for classification |

05/05/2021 | Wednesday | 14:15-18:15 | B.6.1 | Marco Cannici | Python Laboratory | Logistic Regression and LDA Laboratory (Part 1)(Part 2) |

06/05/2021 | Thursday | 08:15-10:15 | B.6.1 | Matteo Matteucci | Lecture | The Perceptron (Ch. 4 ESL, Ch. 9 ISL, Ch. 12 ESL) |

12/05/2021 | Wednesday | 14:15-18:15 | B.6.1 | Matteo Matteucci | Lecture | Support Vector Machines (Ch. 4 ESL, Ch. 9 ISL, Ch. 12 ESL) |

13/05/2021 | Thursday | 08:15-10:15 | B.6.1 | Matteo Matteucci | Lecture | Unsupervised Learning and Clustering (Ch. 10 ISL) |

19/05/2021 | Wednesday | 14:15-18:15 | B.6.1 | Marco Cannici | Python Laboratory | SVM and Classifiers Evaluation Laboratory |

20/05/2021 | Thursday | 08:15-10:15 | B.6.1 | Matteo Matteucci | Lecture | Clustering (Ch. 10 ISL) |

26/05/2021 | Wednesday | 14:15-18:15 | B.6.1 | Marco Cannici | Python Laboratory | Clustering Laboratory |

27/05/2021 | Thursday | 08:15-10:15 | B.6.1 | Matteo Matteucci | Lecture | Clustering (Ch. 10 ISL) |

02/06/2021 | Wednesday | --- | --- | --- | --- | --- No Lecture --- |

03/06/2021 | Thursday | 08:15-11:15 | B.6.1 | Matteo Matteucci | Lecture | Clustering Evaluation (Ch. 10 ISL) |

04/06/2021 | Friday | 14:15-17:15 | B.6.1 | Matteo Matteucci | Lecture | Principal Component Analysis (Ch. 10 ISL) |

Chapters are intended as complete except for

- Ch.4 ESL: Section 4.5
- Ch.12 ESL: Sections 12.1, 12.2, 12.3
- Ch.9 ISL: Sections 9.1, 9.2, 9.3

### Course Evaluation

The course evaluation is composed by two parts:

- HW: Homework with exercises covering the whole program (up to 6 points)
- WE: A written examination covering the whole program (up to 26 points)

the final score will be the sum of HW (not compulsory) and WE scores.

Due to the COVID-19 situation the written exam for the 2019/2020 edition has been turned into an oral examination:

- You will get the oral grade as a mark in the scale of 30 up to 32/30 which you have to multiply by 0.8125 and then you add to it the score of the project. For your convenience here it is a conversion table with the final mark in case you do not turn in the project or you get the whole 6 marks in the project.

## Teaching Material (the textbook)

Lectures will be based on material taken from the book.

- An Introduction to Statistical Learning with Applications in R by Gareth James, Daniela Witten, Trevor Hastie and Robert Tibshirani

If you are interested in a more deep treatment of the topics you can refer to the following book from the same authors

- The Elements of Statistical Learning: Data Mining, Inference, and Prediction. by Trevor Hastie, Robert Tibshirani, and Jerome Friedman.

Some additional material that could be used to prepare the oral examination will be provided together with the past homeworks.

### Teacher Slides

In the following you can find the lecture slides used by the teacher and the teaching assistants during classes.

- [2020/2021] Linear Algebra Basics: Basic elements of linear algebra, e.g., vectors, matrices, basis, span, etc.
- [2020/2021] Course introduction: introductory slides of the course with useful information about the grading, and the course logistics. Some examples from supervised and unsupervised learning. Regression, classification, clustering terminology and examples.
- [2020/2021] Statistical Learning Introduction: Statistical Learning definition, rationale, and trade-offs (e.g., prediction vs. inference, parametric vs non parametric models, flexibility vs. interpretability, etc.)
- [2020/2021] Linear Regression: Simple Linear Regression and Multiple Linear Regression. Generalized Linear models. Cross-validation techniques. Feature selection. Ridge Regression and Lasso.
- [2020/2021] Linear Classification: From Linear Regression to Logistic Regression. Linear Discriminant Analysis and Quadratic Discriminant Analysis. Comparison between linear classification methods. Discriminative vs. generative methods. Support Vector Machines.
- [2020/2021] Clustering: Introduction to unsupervised learning and clustering, hierarchical clustering, k-means, DBSCNA, indexes for clustering evaluation.
- [2020/2021] Principal Component Analysis: Principal Component Analysis, Geometric Interpretation, Singular Values Decomposition.

### Laboratories

We will use Python (with Jupyter notebooks) throughout the course, thus we kindly ask you to install the "Anaconda" package to be ready for the labs. Here are the download links. You can find a simple Jupyter notebook HERE to test if the installation succeeded.

To open the notebook

- launch the "Anaconda Navigator" app
- launch the "jupyter Notebook" app within the navigator, it should automatically open a webpage (it may take a while)
- on the webpage, navigate on the folder where you downloaded the "lab01.00-TestEnvironment.ipynb" file, and press on the file to open it
- then follow the instruction within the notebook

If you didn't install anaconda but just jupyter, or if you can't find Anaconda Navigator

- open a shell ("Anaconda Prompt" if you are using Windows)
- move on to the folder where you downloaded "lab01.00-TestEnvironment.ipynb"
- run the "jupyter notebook" command, it should automatically open a webpage
- then on the webpage press on the "lab01.00-TestEnvironment.ipynb" file and follow the instructions within the notebook

The following are the notebook used in the labs:

- [2020/2021] Material for the first lab session: some useful jupiter notebooks which will be used during the first lab session (complete version)
- [2020/2021] Material for the second lab session: some useful jupiter notebooks which will be used during the second lab session (complete version)
- [2020/2021] Material for the third lab session: some useful jupiter notebooks which will be used during the third lab session (complete version)
- [2020/2021] Material for the fourth lab session: some useful jupiter notebooks which will be used during the fourth lab session (complete version)
- [2020/2021] Material for the fifth lab session: some useful jupiter notebooks which will be used during the fourth lab session (complete version)
- [2020/2021] Material for the sixth lab session: some useful jupiter notebooks which will be used during the fourth lab session (complete version)

### Additional Resources

Papers and links useful to integrate the textbook

- Basic Linear Algebra: "Basic Linear Algebra" chapter from Wayne Winston book "Operations Research Applications and Algorithms (4th ed.)"
- Bias vs. Variance: "Understanding the Bias-Variance Tradeoff" essay by Scott Fortmann-Roe
- Karush Kuhn Tucker Conditions: a short note on their meaning with references to relevant wikipedia pages
- Seeing Theory: a website where the basic concepts of probability and statistics are explained in a visual way.

Python examples to better practice with numpy library

- Some numpy exercises, we did roughly 1, 2, 4, 6, 9, 10, 13
- Othen numpy exercises from simple to complex
- More numpy exercises from simple to complex

### Online Resources

The following are links to online sources which might be useful to complement the material above

- Statistical Learning MOOC covering the entire ISL book offered by Trevor Hastie and Rob Tibshirani. Start anytime in self-paced mode.
- MATH 574M University of Arizona Course on
*Statistical Machine Learning and Data Mining*; here you can find slides covering part of the course topics (the reference book for this course is again*The Elements of Statistical Learning*)