Last answered:

06 Mar 2024

Posted on:

05 Mar 2024

0

Practice Exam: Confusion matrix of Models 2,3 not exaclty matching with the solution

Hi Hristina,

Confusion matrix obtained by my code during the practice exam and the matrix displayed in the solution do not match for Models 2 & 3 while they matched for Model 1. The differences are not that great (alter only by a single integer) when compared to the solution. Please find attached the 2 matrices. Why could that have happened? Are the differences really that important?

1st image is for Model 2, 2nd is for Model 3.

3 answers ( 0 marked as helpful)
Instructor
Posted on:

06 Mar 2024

0

Hey Dhaivat,


Thank you for reaching out!


The results should, in fact, match the ones from the solution. When solving for Models 2 and 3, ensure that:

- first, the data is split into training and testing sets (20% of the data should be dedicated to testing, the random state should be 365, and the data should be stratified)

- and after that, the data is transformed (remember to apply the fit_transform method on the training set and the transform method on the test set.)


If the steps are applied in exactly this order and all parameters are set correctly, then the confusion matrices should match. Double-check your solution and if the issue persists, please attach a screenshot of your solution or alternatively, copy-paste it here inside a code block.


Kind regards,

365 Hristina

Posted on:

06 Mar 2024

0

Hi Hristina,

I checked it again and seems to be as per the steps mentioned by you. Please check attachment (contains relevant part of the code).

Regards,

Dhaivat


Instructor
Posted on:

06 Mar 2024

0

Hey again Dhaivat,


I believe you might have missed to download the Tink.ipynb and Tink_revisited.ipynb files where the first few lines of the code are pre-implemented and a specific encoding is used for reading the CSV files. Taking this into account, you should obtain the same results as the ones provided in the solution.


Kind regards,

365 Hristina

Submit an answer