{"cells": [{"cell_type": "markdown", "metadata": {"editable": true, "slideshow": {"slide_type": ""}, "tags": []}, "source": ["# Exercises for Lecture 18 (Dimensionality Reduction)"]}, {"cell_type": "markdown", "metadata": {"editable": true, "slideshow": {"slide_type": "slide"}, "tags": []}, "source": ["## Exercise 1\n", "\n", "- Load the MNIST dataset and split it into a training set and a test set (take the first 60,000 instances for training, and the remaining 10,000 for testing).\n", "- Train a Random Forest classifier on the dataset and time how long it takes.\n", "- Then evaluate the resulting model on the test set. \n", "- Next, use PCA to reduce the dataset\u2019s dimensionality, with an explained variance ratio of 95%. \n", "- Train a new Random Forest classifier on the reduced dataset and see how long it takes. \n", "- Was training much faster?\n", "- Next evaluate the classifier on the test set.\n", "- How well does it perform compare to the previous classifier?"]}, {"cell_type": "code", "execution_count": null, "metadata": {"editable": true, "slideshow": {"slide_type": ""}, "tags": []}, "outputs": [], "source": ["from sklearn.datasets import fetch_openml\n", "mnist = fetch_openml('mnist_784', version=1, cache=True)"]}], "metadata": {"celltoolbar": "Tags", "kernelspec": {"display_name": "Python 3 (ipykernel)", "language": "python", "name": "python3"}, "language_info": {"codemirror_mode": {"name": "ipython", "version": 3}, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.11.11"}}, "nbformat": 4, "nbformat_minor": 4}