Created
November 4, 2021 14:24
-
-
Save MGCodesandStats/7a3009ac614507234e8795579d27b741 to your computer and use it in GitHub Desktop.
binomial class polymorphism
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Binomial(Probability): | |
def __init__(self, length): | |
super().__init__("Binomial") | |
self.length = length | |
def binomial5(self): | |
return np.sum((np.random.binomial(9, 0.05, self.length) == 0))/self.length | |
def binomial10(self): | |
return np.sum((np.random.binomial(9, 0.1, self.length) == 0))/self.length | |
def binomial15(self): | |
return np.sum((np.random.binomial(9, 0.15, self.length) == 0))/self.length | |
def fact(self): | |
return "Probability of failure according to the Binomial Distribution." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment