Professional Documents
Culture Documents
Nouveau Document CT 1
Nouveau Document CT 1
Nouveau Document CT 1
Exercise 1:
Table1
Customers and sellers of used cars need a prediction system to predict x1 x2 x3 y
and determine the price of used cars effectively. For that gradient descent 10 4 2 1,45
10 3 1,7 1,5
algorithm is the heart of car price prediction systems, because it can
11 4 2,05 1,37
adjust the parameters (theta) of the model on which the prediction
12 4 2,3 1,22
system is based.
12 5 2,5 1,15
Table 1 shows data set for one car model, where, car price changes 14 8 2,95 1,02
x1: car age.
depending on different factors (features).
x2: transmission and number of
owners.
1 . Based on our case, Select true or false for each statement, and
x3: kilometres driven (x105 klm)
justify your choices. y: car price (x106 –Alg Dinar- ).
a . Car price prediction system uses technique from machine learning. (0,25+0,75 pt) False True
The system uses a dataset (train from the data).
Improve automatically the model (adjust model parameters) in order to make decisions and
predictions based on new data.
b. To predict price of new input car, The proposed problem is a classification. False True
(0,25+0,75 pt)
A classification problem is when the output variable is a category (discrete value).
The proposed problem is a regression problem because the output variable (price) is a real value
(continue value).
c . Regression is an unsupervised technique. (0,25+0,75 pt) False True
Regression is supervised technique because the data we need to have includes both the input and
output.
d . The independent variables are : x1 , y. (0,25+0,25 pt) False True
The independent variables are: x1, x2 and x3.
e . Number of training data (samples) is equal=3 (m=3). (0,25+0,25 pt) False True
Number of training data (samples) is equal 6 (m=6).
f . Number of features is equal=6 (n=6). (0,25+0,25 pt) False True
Number of features is equal 3 (n=3).
g. The hypothesis equation h(x) is: ℎ( ) = = + + . (0,25+0,75 pt) False True
The number of feature n=3 and j=n+1, so number of theta is 4 and they are ( , , ) . The
hypothesis written as follow: ℎ( ) = = + + + .
2. Using Gradient descent algorithm calculate theta (Ѳ) values (two iterations), where α=0.01 and initial
theta values are ones (Ѳ0,1,2,... =1).
1/3
2. Calculating of theta:
Preliminary data:
A. The formula has the form: //0,25 pt)
ℎ( ) = = + + + .
() () () 0.01
≔ − ((ℎ − ) )=1− × 108,79 = 0.8187
6
() () () 0.01
≔ − ((ℎ − ) )=1− × 1279,2 = −1.1319
6
() () () 0.01
≔ − ((ℎ − ) )=1− × 540,03 = 0.1
6
() () () 0.01
≔ − ((ℎ − ) )=1− × 252,9365 = 0.5784
6
2/3
Second iteration
A. Calculating of h(x): //0,75 pt
ℎ( ) =
01 01 01 01 01 01
10 10 11 12 12 14
ℎ( ) = [ . − . . . ] × 04 03 04 04 05 08
02 1,7 2,05 2,3 2,5 2,95
= [−8,944 − 9,2175 − 10,047 − 11,0343 − 10,8187 − 12,5224]
() () () 0.01
≔ − ((ℎ − ) )= . − × (−70,2938) = 0.9358
6
() () () 0.01
≔ − ((ℎ − ) )= − . − × (−816,9702) = 0.2297
6
() () () 0.01
≔ − ((ℎ − ) )= . − × (−336,5959) = 0.6609
6
() () () 0.01
≔ − ((ℎ − ) )= . − × (−160,4691) = 0.8459
6
3/3