Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
1. A test is used to predict if a person has a certain disease. The table below shows the test predictions
on 20 subjects. Based on the table, compute the following evaluation measures.
2. The table below shows the predictions made for a continuous target feature by two different
prediction models for a test set.
(a) Based on these predictions, calculate the sum of squared errors. Which model is better based
on this evaluation measure.
(b) Calculate the R2 measure. Which model is better based on the R2 measure.
(c) Based on the evaluation measures calculated, which model do you think is performing better
for this dataset?
3. A company develops two different models to predict the behavior of its stock in the market. The
tools predict whether the stock will rise or fall. They measure the true positive rate (TPR) and
false positive rate (FPR) based on the prediction scores and resulting predictions of the models.
The table below shows the TPR and FPR calculated at four threshold values. The threshold
values are different for each model.
Model 1 Model2
TPR 0.4 0.5 0.6 0.9 1 TPR 0.2 0.3 0.7 1 1
FPR 0.3 0.5 0.7 0.9 1 FPR 0.2 0.4 0.6 0.8 1
(a) Plot the ROC curve for each model. Assume the TPR value between two threshold values is
equal to the TPR value calculated at the higher threshold value. For example, for model 1,
TPR is 0.4 when FPR is 0.2 and TPR is 0.9 at FPR=0.8.
(b) Compute the area under the curve (AUC) for each model. Which model performs better?
(c) Compute the Gini coefficient for each model.
4. A news agency is using a model to predict the party affiliation of its subscribers. The table below
shows the prediction frequencies of the model at the time the model was built, for the month after
deployment, and for a month-long period one year after deployment.
(a) Draw the bar plots of these three sets of prediction frequencies. Does the model need to be
retrained at these points based on the frequency plots?
(b) Calculate the stability index for the periods of Sample 1 and Sample 2, and determine whether
the model should be retrained at these points. Does the change in the prediction distribution
indicate that the model does not work well anymore?