1

Type 1 and 2 Errors

Unsolved
Prob. and Stats

Difficulty: 3 | Problem written by zeyad_omar
Problem reported in interviews at

Amazon
Apple
Facebook
Google
Netflix

In statistics, we often worry about Type 1 and Type 2 errors.

For example, when our hypothesis is all persons are innocent until proven guilty, then Type 1 error means sending an innocent to his death while Type 2 means setting a guilty person free. Both are bad news but Type 1 error is worse in this instance.

In this problem, you are required to write a function that calculates how many times we made a Type 1 error and how many time we made a Type 2 error.

Inputs:
y_pred: 1D vector represents our decision (prediction)
y_true: 1D vector that carrys the true values

Return a list with 2 elements: [number of type 1 error , number of type 2 errors].
 

Sample Input:
<class 'list'>
y_pred: [1, 1, 1, 1]
<class 'list'>
y_true: [0, 0, 0, 0]

Expected Output:
<class 'list'>
[0, 4]

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

Similique quibusdam ad sapiente placeat maiores. Pariatur earum sunt, a tenetur ab accusantium?

Quasi harum ratione, architecto laudantium in minus ab repudiandae, corporis quisquam rem harum similique quas? Laborum incidunt repudiandae dolor porro inventore corporis quasi sequi vero ipsa commodi, ratione delectus laborum aliquam quam impedit corrupti, cumque fuga incidunt amet enim perspiciatis totam error. Ex earum ipsam ipsa iste, officia nulla nesciunt libero voluptate expedita quas alias voluptates repellat fugit, rerum eos suscipit accusamus eius culpa?

Aspernatur maiores voluptatibus iusto reiciendis odio omnis ipsum perspiciatis ad.

This is a premium feature.
To access this and other such features, click on upgrade below.

Ready.

Input Test Case

Please enter only one test case at a time
numpy has been already imported as np (import numpy as np)