2

Balanced Classification Rate

Unsolved
Fundamentals

Difficulty: 1 | Problem written by mesakarghm
Problem reported in interviews at

Amazon
Apple
Facebook
Google
Netflix

The Balanced Classification rate of a confusion matrix is defined as: 

\(BCR = {1\over 2}* ({TP \over (TP + FN)} + {TN \over (TN + FP)})\)

Write a function BCR(TP,TN,FP,FN) which calculates and returns the error rate of the classifier. 

Here, 

TP -> True Positive 

TN -> True Negative 

FP -> False Positive

FN -> False Negative

Sample Input:
<class 'int'>
TP: 100
<class 'int'>
TN: 50
<class 'int'>
FP: 10
<class 'int'>
FN: 9

Expected Output:
<class 'float'>
0.8753822629969419

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.

Autem accusamus aperiam doloribus, nesciunt illum tenetur accusantium sit possimus, iusto eligendi ipsa? Saepe quibusdam provident necessitatibus ipsum sunt vitae mollitia. Libero molestiae minus? Sint ut ipsa repellendus, pariatur cum mollitia nemo?

Necessitatibus eligendi sed inventore iste facere dignissimos ab?

Sunt optio quo officiis assumenda consequatur neque nesciunt, vitae et fugit libero expedita vero asperiores quibusdam cum qui error, commodi maxime non veniam ullam. Doloremque veniam eveniet distinctio quae quidem eius asperiores voluptate facere assumenda totam?

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)