Starting from:
$30

$24

Homework 7



    4. Programming Assignment: Parkinsons Telemonitoring

        (a) Download the Parkinsons Telemonitoring Data Set from: http://archive.ics. uci.edu/ml/datasets/Parkinsons+Telemonitoring. Choose 70% of the data randomly as the training set.

        (b) Use metric learning with Gaussian kernels1 to estimate each of the outputs mo-tor UPDRS and total UPDRS from the features. As metric learning uses a low dimensional transformation of the features except the non-predictive feature subject#, use 5-fold cross-validation to decide the number of components form M = 5, 10, 15, p, where p is the number of all predictive features you can use. Initialize the linear transformation with PCA features for M = 5, 10, 15 and with original features for M = p. This corresponds to setting init as (default=‘auto’). Remember to standardize your features. Report the R2 on training and test sets for each of the outputs. (30 pts)

        (c) Use sklearn’s neural network implementation to train a neural network with two outputs that predicts motor UPDRS and total UPDRS. Use a single layer. You are responsible to determine other architectural parameters of the network, including the number of neurons in the hidden and output layers, method of optimization, type of activation functions, and the L2 “regularization” parameter etc. You should determine the design parameters via trial and error, by testing your trained network on the test set and choosing the architecture that yields the smallest test error. For this part, set early-stopping=False. Remember to standardize your features. Report your R2 on both training and test sets. (20 pts)


 
        (d) Use the design parameters that you chose in the first part and train a neural network, but this time set early-stopping=True. Research what early stopping is, and compare the performance of your network on the test set with the previous network. You can leave the validation-fraction as the default (0.1) or change it to see whether you can obtain a better model. Remember to standardize your features. Report your R2 on both training and test sets. (10 pts)

Note: there are a lot of design parameters in a neural network. If you are not sure how they work, just set them as the default of sklearn, but if you use them masterfully, you can have better models.

    5. Optional Programming Assignment: (Deep) CNNs for Image Colorization. This part will not be graded.

        (a) This assignment uses a convolutional neural network for image colorization which turns a grayscale image to a colored image.2 By converting an image to grayscale, we loose color information, so converting a grayscale image back to a colored version is not an easy job. We will use the CIFAR-10 dataset. Downolad the dataset from http://www.cs.toronto.edu/~kriz/cifar-10-python.tar.gz.

        (b) From the train and test dataset, extract the class birds. We will focus on this class, which has 6000 members.

        (c) Those 6000 images have 6000 ⇥ 32 ⇥ 32 pixels. Choose at least 10% of the pixels randomly. It is strongly recommended that you choose a large number or all of the pixels. You will have between P = 614400 and P = 6144000 pixels. Each pixel is an RGB vector with three elements.

        (d) Run k-means clustering on the P vectors using k = 4. The centers of the clusters will be your main colors. Convert the colored images to k-color images by con-verting each pixel’s value to the closest main color in terms of Euclidean distance. These are the outputs of your network, whose each pixel falls in one of those k classes.3

        (e) Use any tool (e.g., openCV or scikit-learn) to obtain grayscale 32 ⇥ 32 ⇥ 1 images from the original 32 ⇥ 32 ⇥ 3 images. The grayscale images are inputs of your network.

        (f) Set up a deep convolutional neural network with two convolution layers (or more) and two (or more) MLP layers. Use 5 ⇥ 5 filters and a softmax output layer. Determine the number of filters, strides, and whether or not to use padding your-self. Use a minimum of one max pooling layer. Use a classification scheme, which means your output must determine one of the k = 4 color classes for each pixel in

  
your grayscale image. Your input is a grayscale version of an image (32 ⇥ 32 ⇥ 1) and the output is 32 ⇥ 32 ⇥ 4. The output assigns one of the k = 4 colors to each of the 32 ⇥ 32 pixels; therefore, each of the pixels is classified into one of the classes [1 0 0 0], [0 1 0 0], [0 0 1 0], [0 0 0 1]. After each pixel is classified into one of the main colors, the RGB code of that color can be assigned to the pixel. For example, if the third main color 4 is [255 255 255] and pixel (32,32) of an image has the one-hot encoded class [0 0 1 0], i.e it was classified as the third color, the (32,32) place in the output can be associated with [255 255 255]. The size of the output of the convolutional part, c1 ⇥ c2 depends on the size of the convolutional layers you choose and is a feature map, which is a matrix. That matrix must be flattened or reshaped, i.e. must be turned into a vector of size c1c2 ⇥1, before it is fed to the MLP part. Choose the number of neurons in the first layer of the MLP (and any other hidden layers, if you are willing to have more than one hidden layer) yourself, but the last layer must have 32 ⇥ 32 ⇥ 4 = 4096 neurons, each of which represents a pixel being in one of the k = 4 classes. Add a softmax layer5 which will choose the highest value out of its k = 4 inputs for each of the 1024 pixels; therefore, the output of the MLP has to be reshaped into a 32 ⇥ 32 ⇥ 4 matrix, and to get the colored image, the RGB vector of each of the k = 4 classes has to be converted to the RGB vector, so an output image will be 32 ⇥ 32 ⇥ 3. Train at least for 5 epochs (30 epochs is strongly recommended). Plot training, (validation), and test errors in each epoch. Report the train and test errors and visually compare the artificially colored versions of the first 10 images in the test set with the original images.6

    (g) Extra Practice: Repeat the whole exercise with k = 16, 24, 32 colors if your computer can handle the computations.











 

More products