First time here? Checkout the FAQ!
x
+3 votes
4.5k views
asked in Machine Learning by (115k points)  

The dataset of pass/fail in an exam for 5 students is given in the table below. If we use Logistic Regression as the classifier and assume the model suggested by the optimizer will become the following for Odds of passing a course:

$\log_e(Odds) = -64 + 2 \times hours$

1) How to calculate the loss of model for the student who studied 33 hours? 

2) What is the total loss of the model given in equation below? 

$Logloss = -\frac{1}{N} \sum_{i=1}^N(y_i\log_e(p_i) + (1 - y_i)\log_e(1 - p_i))$

  

1 Answer

+2 votes
answered by (550 points)  
selected by
 
Best answer

Answer#2: Total Loss of the model

first we have to find all the probability of the student passing the course

lets i is representing the sampling index of the student

P1:

Z=-64+(2*29)=-6

P=1/(1+e^6)=0.0024

P2:

Z=-64+(2*15)=-34

P=1/(1+e^34)=0 (THE VALUE IS SO SMALL)

P3: ALREADY KNOW = 0.88

P4:

Z=-64+(2*28)=-8

P=1/(1+e^8)=0.00033

P5:

Z=-64+(2*39)=14

P=1/(1+e^-14)=0.999

 

THE TOTAL LOSS OF THE MODEL IS CALCULATED BELOW, BY USING THE FORMULA

Log-loss= -(yi*ln(P1)+(1-yi)ln(1-P1))

LOG-LOSS 1= -2.4E-3

LOG-LOSS 2= 0

LOG-LOSS 3= - 0.128

LOG-LOSS 4= -8.0164

LOG-LOSS 5= -0.001

TOTAL LOSS OF THE MODEL= LOG-LOSS= - (1/5)(-2.4E-3+0- 0.128-8.0164-0.001) = 1.6296

 

Answer 1:the loss of model for the student who studied 33 hours

Step 1: we have to find the probability to passing the course

P=1/(1+e^-z)

where z= odd= -64+(2*33)=2

after putting the values... P=1/(1+e^-2)=0.88

 

Now, lets calculate the log-loss of the model for that particular student, has sample number 3 which is "i" the sampling index

 

Log-loss= (yi*ln(P1)+(1-yi)ln(1-P1))

Log-loss=[1*ln(0.88)+(1-1)ln(1-0.88)]

Answer#1: Log-loss= - 0.128 loss of model for the student

...