|
@@ 188-196 (lines=9) @@
|
| 185 |
|
else: |
| 186 |
|
params = self.params |
| 187 |
|
return params |
| 188 |
|
|
| 189 |
|
def test_mixed_density_goodness_of_fit(self): |
| 190 |
|
for param in self.dist_params(): |
| 191 |
|
dim = get_dim(self.dist.rvs(*param, size=2)[0]) |
| 192 |
|
sample_count = NUM_BASE_SAMPLES + NUM_SAMPLES_SCALE * dim |
| 193 |
|
samples = self.dist.rvs(*param, size=sample_count) |
| 194 |
|
samples = list(map(self._sample_postprocessing, samples)) |
| 195 |
|
probabilities = [self.pdf(sample, *param) for sample in samples] |
| 196 |
|
gof = mixed_density_goodness_of_fit(samples, probabilities) |
| 197 |
|
self.assertGreater(gof, TEST_FAILURE_RATE) |
| 198 |
|
|
| 199 |
|
def test_good_fit(self): |
|
@@ 178-186 (lines=9) @@
|
| 175 |
|
By default, this is a no-op, but subclasses may wish to override |
| 176 |
|
this method to modify sample in some way. |
| 177 |
|
|
| 178 |
|
""" |
| 179 |
|
return sample |
| 180 |
|
|
| 181 |
|
def dist_params(self): |
| 182 |
|
# If there are no parameters, then we provide a random one. |
| 183 |
|
if self.params is None: |
| 184 |
|
params = [tuple(1 + rand(self.dist.numargs))] |
| 185 |
|
else: |
| 186 |
|
params = self.params |
| 187 |
|
return params |
| 188 |
|
|
| 189 |
|
def test_mixed_density_goodness_of_fit(self): |