Warning: Declaration of action_plugin_tablewidth::register(&$controller) should be compatible with DokuWiki_Action_Plugin::register(Doku_Event_Handler $controller) in /s/bach/b/class/cs545/public_html/fall16/lib/plugins/tablewidth/action.php on line 93
assignments:assignment3 [CS545 fall 2016]

User Tools

Site Tools


assignments:assignment3

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
Next revision Both sides next revision
assignments:assignment3 [2016/09/15 14:55]
asa [Part 3]
assignments:assignment3 [2016/09/19 12:12]
asa [Part 3]
Line 3: Line 3:
 ====== Assignment 3 ====== ====== Assignment 3 ======
  
-**Due:** 10/at 11pm.+**Due:** 10/at 11:59pm.
  
 ===== Preliminaries ===== ===== Preliminaries =====
Line 11: Line 11:
 The wine data is composed of two datasets - one for white wines, and one for reds.  In this assignment perform all your analyses on just the red wine data. The wine data is composed of two datasets - one for white wines, and one for reds.  In this assignment perform all your analyses on just the red wine data.
  
-The features for the wine dataset are not standardized,​ so make sure you do this, especially since we are going to consider the magnitude of the weight vector (recall that standardization entails subtracting the mean and then dividing by the standard deviation for each feature; you can use the [[http://​docs.scipy.org/​doc/​numpy/​reference/​routines.statistics.html | Numpy statistics module]] to perform the required calculations). ​ +The features for the wine dataset are not standardized,​ so make sure you do this, especially since we are going to consider the magnitude of the weight vector (recall that standardization entails subtracting the mean and then dividing by the standard deviation for each feature; you can use the [[http://​docs.scipy.org/​doc/​numpy/​reference/​routines.statistics.html | Numpy statistics module]] to perform the required calculations). 
 ==== Part 1 ==== ==== Part 1 ====
  
-Implement ridge regression ​keeping ​the same API you used in implementing ​the classifiers in assignment ​2, and functions for computing the following measures of error:+Implement ridge regression ​in a class called RidgeRegression that implements ​the classifier ​API, i.e. ``fit`` and ``predict`` methods with the same signature as the Perceptron class you implemented ​in the previous ​assignment.  Also implement ​functions for computing the following measures of error:
  
   * The Root Mean Square Error (RMSE).   * The Root Mean Square Error (RMSE).
Line 30: Line 31:
 With the code you just implemented,​ your next task is to explore the dependence of error on the value of the regularization parameter, $\lambda$. With the code you just implemented,​ your next task is to explore the dependence of error on the value of the regularization parameter, $\lambda$.
 In what follows set aside 30% of the data as a test-set, and compute the in-sample error, and the test-set error as a function of the parameter $\lambda$ on the red wine data.  Choose the values of $\lambda$ on a logarithmic scale with values 0.01, 0.1, 1, 10, 100, 1000 and plot the RMSE only. In what follows set aside 30% of the data as a test-set, and compute the in-sample error, and the test-set error as a function of the parameter $\lambda$ on the red wine data.  Choose the values of $\lambda$ on a logarithmic scale with values 0.01, 0.1, 1, 10, 100, 1000 and plot the RMSE only.
-Repeat the same experiment where instead of using all the training data, choose 20 random training examples.+Repeat the same experiment where instead of using all the training data, choose 20 random ​examples out of the training ​set, and train your model using those 20 examples.
  
 Now answer the following: Now answer the following:
Line 52: Line 53:
 We will explore the relationship between the magnitude of weight vector components and their relevance to the classification task in several ways. We will explore the relationship between the magnitude of weight vector components and their relevance to the classification task in several ways.
 Each feature is associated with a component of the weight vector. ​ It can also be associated with the correlation of that feature with the vector of labels. Each feature is associated with a component of the weight vector. ​ It can also be associated with the correlation of that feature with the vector of labels.
-Create ​a scatter plot of the weight vector ​component ​against the [[https://​en.wikipedia.org/​wiki/​Pearson_product-moment_correlation_coefficient | Pearson correlation coefficient]] of feature ​against ​the labels (again, you can use the [[http://​docs.scipy.org/​doc/​numpy/​reference/​routines.statistics.html | Numpy statistics module]] to compute it).+As we discussed in class, the magnitude of the weight vector can give an indication of feature relevance; another measure of relevance of a feature is its correlation with the labels. ​ To compare the two,  
 +create ​a scatter plot of weight vector ​components ​against the [[https://​en.wikipedia.org/​wiki/​Pearson_product-moment_correlation_coefficient | Pearson correlation coefficient]] of the corresponding ​feature ​with the labels (again, you can use the [[http://​docs.scipy.org/​doc/​numpy/​reference/​routines.statistics.html | Numpy statistics module]] to compute it).
 What can you conclude from this plot? What can you conclude from this plot?
 The paper ranks features according to their importance using a different approach. ​ Compare your results with what they obtain. The paper ranks features according to their importance using a different approach. ​ Compare your results with what they obtain.
assignments/assignment3.txt · Last modified: 2016/09/20 09:34 by asa