DM825 - Introduction to Machine Learning
Sheet 1, Spring 2011 [pdf format]



Exercise 1

Consider the application of a perceptron in classification. For example, consider the application in medical diagnosis of diabetes. The features are blood sugar measurement and amount of fluid intake per day of different patients. These features are used to classify the symptoms sets into two different diagnosis categories, that is, presence or not of diabetes.

Table 1 reproduces some past measurements with the relative category. Here +1 means that the person had diabetes, while -1 that he/she did not. (data.txt)

Implement in R the Batch and Stochastic Gradient Algorithms to learn the weights for a perceptron with x1,x2 and bias as inputs and −1,+1 as output. Report the final regression coefficients (weights) and plot the points together with the linear separator provided by the perceptron.


x1x2Diabetes
1.01.01
9.46.4-1
2.52.11
8.07.7-1
0.52.21
7.98.4-1
7.07.0-1
2.80.81
1.23.01
7.86.1-1
Table 1: The data for Exercise 1.