mirror of
https://github.com/DeaDvey/mathgenerator.git
synced 2025-11-28 06:25:23 +01:00
fixing linter errors
This commit is contained in:
5
.vscode/settings.json
vendored
Normal file
5
.vscode/settings.json
vendored
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
{
|
||||||
|
"python.linting.pylintEnabled": false,
|
||||||
|
"python.linting.flake8Enabled": true,
|
||||||
|
"python.linting.enabled": true
|
||||||
|
}
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
from .__init__ import *
|
from .__init__ import *
|
||||||
|
|
||||||
|
|
||||||
def conditionalProbFunc():
|
def conditionalProbFunc():
|
||||||
P_disease = round(2. * random.random(), 2)
|
P_disease = round(2. * random.random(), 2)
|
||||||
true_positive = round(random.random() + float(random.randint(90, 99)), 2)
|
true_positive = round(random.random() + float(random.randint(90, 99)), 2)
|
||||||
@@ -8,7 +9,6 @@ def conditionalProbFunc():
|
|||||||
def BayesFormula(P_disease, true_positive, true_negative):
|
def BayesFormula(P_disease, true_positive, true_negative):
|
||||||
P_notDisease = 100. - P_disease
|
P_notDisease = 100. - P_disease
|
||||||
false_positive = 100. - true_negative
|
false_positive = 100. - true_negative
|
||||||
false_negative= 100.-false_positive
|
|
||||||
P_plus = (P_disease) * (true_positive) + (P_notDisease) * (false_positive)
|
P_plus = (P_disease) * (true_positive) + (P_notDisease) * (false_positive)
|
||||||
P_disease_plus = ((true_positive) * (100 * P_disease)) / P_plus
|
P_disease_plus = ((true_positive) * (100 * P_disease)) / P_plus
|
||||||
|
|
||||||
@@ -17,9 +17,9 @@ def conditionalProbFunc():
|
|||||||
problem = "Someone tested positive for a nasty disease which only {0:.2f}% of population have. " \
|
problem = "Someone tested positive for a nasty disease which only {0:.2f}% of population have. " \
|
||||||
"Test sensitivity (true positive) is equal to SN= {1:.2f}% whereas test specificity (true negative) SP= {2:.2f}%. " \
|
"Test sensitivity (true positive) is equal to SN= {1:.2f}% whereas test specificity (true negative) SP= {2:.2f}%. " \
|
||||||
"What is the probability that this guy really has that disease?".format(P_disease, true_positive, true_negative)
|
"What is the probability that this guy really has that disease?".format(P_disease, true_positive, true_negative)
|
||||||
|
|
||||||
answer = str(round(BayesFormula(P_disease, true_positive, true_negative), 2)) + "%"
|
answer = str(round(BayesFormula(P_disease, true_positive, true_negative), 2)) + "%"
|
||||||
|
|
||||||
return problem, answer
|
return problem, answer
|
||||||
|
|
||||||
|
|
||||||
conditionalProb = Generator("Conditional Probability", 101, "P(A|+)=", "c", conditionalProbFunc)
|
conditionalProb = Generator("Conditional Probability", 101, "P(A|+)=", "c", conditionalProbFunc)
|
||||||
Reference in New Issue
Block a user