This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision Next revision Both sides next revision | ||
cs501r_f2016:lab2 [2016/09/02 04:39] wingated |
cs501r_f2016:lab2 [2016/09/02 04:44] wingated |
||
---|---|---|---|
Line 97: | Line 97: | ||
You should also test different step sizes. Wikipedia doesn't discuss how to do this, but it should be straightforward for you to figure out; the algorithm description in the lecture notes includes the step size. (But try to figure it out: consider the update equation for a weight, and ask yourself: where should I put a stepsize parameter, to be able to adjust the magnitude of the weight update?) | You should also test different step sizes. Wikipedia doesn't discuss how to do this, but it should be straightforward for you to figure out; the algorithm description in the lecture notes includes the step size. (But try to figure it out: consider the update equation for a weight, and ask yourself: where should I put a stepsize parameter, to be able to adjust the magnitude of the weight update?) | ||
- | For the Iris dataset, you should test ''c=1'', ''c=0.1'', ''c=0.01''. | + | For the Iris dataset, you should test at least ''c=1'', ''c=0.1'', ''c=0.01''. |
- | For the CIFAR-10 dataset, you should test ''c=0.001'', ''c=0.00001''. | + | For the CIFAR-10 dataset, you should test at least ''c=0.001'', ''c=0.00001''. |
Line 107: | Line 107: | ||
This should only take a single line of code. Hint: can you rewrite the l2 norm in terms of dot products? | This should only take a single line of code. Hint: can you rewrite the l2 norm in terms of dot products? | ||
+ | |||
+ | ** Plotting results ** | ||
+ | |||
+ | You may use any notebook compatible plotting function you like, but I recommend ''matplotlib''. This is commonly imported as | ||
+ | |||
+ | <code python> | ||
+ | import matplotlib.pyplot as plt | ||
+ | </code> | ||
+ | |||
+ | To create a new figure, call ''plt.figure''. To plot a line, call ''plt.plot''. Note that if you pass a matrix into ''plt.plot'', it will plot multiple lines at once, each with a different color; each column will generate a new line. | ||
+ | |||
+ | Note that if you use matplotlib, you may have to call ''plt.show'' to actually construct and display the plot. | ||
+ | |||
+ | Don't forget to label your axes! | ||
---- | ---- | ||
Line 122: | Line 136: | ||
plt.figure | plt.figure | ||
+ | plt.plot | ||
plt.xlabel | plt.xlabel | ||
plt.ylabel | plt.ylabel |