CS 66 Lab 1

Due Monday, 09/05/2022, by midnight (23:59, EST)

Announcements

Goals

The goals for this lab assignment are:

  • Install the python packages required for machine learning programming

  • Get familiar with LDA

  • Get familiar with SVM

1. Run the time() function (10 min)

  • Get your programming environment settings, for example:

OS: Ubuntu 16.04.3
GPU: Geforce 1080 Ti or Tesla P100
Memory: 16 GB
Python: 3.10
Scikit-learn: 1.1
  • Review how to get the execution time of a Python program

import time

start = time.time()
print("hello")
end = time.time()
print(end - start)

2. LDA (10 min)

  • Example 1: 'Normal, Ledoit-Wolf …​'

    1. Download Python source code: plot_lda.py

  • Example 2: 'Comparison of LDA and PCA ..'

    1. Download Python source code: plot_pca_vs_lda.py'

  • For both of the two examples above:

    1. Download the existing code

    2. Set up the coding environment, help your classmates with this Python and Scikit-learn installation.

    3. Run the existing code

    4. Track the execution time and write them down in your notes.txt file.

    5. Take the screenshots of your results after running the code.

  • Write in your own words what LDA is, in four to five sentences, in your notes.txt file.

3. SVM (10 min)

  • Example 1: 'SVM: Maximum margin …​'

    1. Download Python source code: plot_separating_hyperplane.py

  • Example 2: 'Plot different SVM …​'

    1. Download Python source code: plot_iris_svc.py

  • For both of the two examples above:

    1. Download the existing code

    2. Set up the coding environment

    3. Run the existing code

    4. Track the execution time and write them down in your notes.txt file.

    5. Take the screenshots of your results after running the code.

  • Write in your own words what SVM is, in four to five sentences, in your notes.txt file.

  • You may use the two above examples' dataset related sections as references.

4. Self-evaluation about Machine learning

4.2. Math: calculus, linear algebra, probability and statistics.

5. Submission Guide

  • Each student only submits one file, lab_1_lastname.zip, including

    1. notes_lab_1_lastname.txt for your notes, including the code run time.

    2. A screenshot folder for all the screenshots files (PNG or JPEG), total size less than 5 M.

6. Notes

  • Email 'xqu1@swarthmore.edu' your zip file for lab 1.

  • Lab assignments will typically be released on Tuesday and will be due by midnight on the following Monday.