File wellmet/whitebox.py changed (mode: 100644) (index 9b87bb9..4b3c7d9) |
... |
... |
class HyperPlane(WhiteBox): # куда ж без него... |
280 |
280 |
self.beta_exact = betas[-1]/np.sqrt(np.sum(np.array(betas[:-1])**2)) |
self.beta_exact = betas[-1]/np.sqrt(np.sum(np.array(betas[:-1])**2)) |
281 |
281 |
self.pf_exact = stats.norm.cdf(-self.beta_exact) |
self.pf_exact = stats.norm.cdf(-self.beta_exact) |
282 |
282 |
self.pf_exact_method = 'FORM (exact solution)' # Ang, Tang and Pythagoras |
self.pf_exact_method = 'FORM (exact solution)' # Ang, Tang and Pythagoras |
|
283 |
|
self.r_exact = self.beta_exact |
283 |
284 |
|
|
284 |
285 |
|
|
285 |
286 |
def __str__(wt): |
def __str__(wt): |
|
... |
... |
class Line(WhiteBox): |
305 |
306 |
|
|
306 |
307 |
self.pf_exact = stats.norm.cdf(-beta) |
self.pf_exact = stats.norm.cdf(-beta) |
307 |
308 |
self.pf_exact_method = 'FORM (exact solution)' # Ang, Tang and Pythagoras |
self.pf_exact_method = 'FORM (exact solution)' # Ang, Tang and Pythagoras |
308 |
|
|
|
|
309 |
|
self.r_exact = self.beta_exact |
309 |
310 |
|
|
310 |
311 |
def __str__(wt): |
def __str__(wt): |
311 |
312 |
return 'Line%sD' % wt.f.nvar |
return 'Line%sD' % wt.f.nvar |
|
... |
... |
class TwoLine(WhiteBox): |
329 |
330 |
|
|
330 |
331 |
self.pf_exact = stats.norm.cdf(-beta) * 2 |
self.pf_exact = stats.norm.cdf(-beta) * 2 |
331 |
332 |
self.pf_exact_method = '2FORM (exact solution)' # Ang, Tang and Pythagoras |
self.pf_exact_method = '2FORM (exact solution)' # Ang, Tang and Pythagoras |
|
333 |
|
self.r_exact = self.beta |
332 |
334 |
|
|
333 |
335 |
|
|
334 |
336 |
def __str__(wt): |
def __str__(wt): |
|
... |
... |
class Gaussian_Z_sum(WhiteBox): #ё куда ж без этого... |
351 |
353 |
self.beta_exact = beta_exact |
self.beta_exact = beta_exact |
352 |
354 |
self.pf_exact = stats.norm.cdf(-self.beta_exact) |
self.pf_exact = stats.norm.cdf(-self.beta_exact) |
353 |
355 |
self.pf_exact_method = 'FORM (exact solution)' # Ang, Tang and Pythagoras |
self.pf_exact_method = 'FORM (exact solution)' # Ang, Tang and Pythagoras |
|
356 |
|
self.r_exact = self.beta_exact |
354 |
357 |
|
|
355 |
358 |
|
|
356 |
359 |
def __str__(wt): |
def __str__(wt): |
|
... |
... |
class Gaussian_Z_prod_2D(WhiteBox): |
412 |
415 |
else: |
else: |
413 |
416 |
self.pf_exact = 1 - gauss_prod_CDF(-self.const) |
self.pf_exact = 1 - gauss_prod_CDF(-self.const) |
414 |
417 |
self.pf_exact_method = 'exact (Bessel) solution' |
self.pf_exact_method = 'exact (Bessel) solution' |
415 |
|
|
|
|
418 |
|
self.r_exact = np.sqrt(np.abs(self.const) * 2) |
416 |
419 |
|
|
417 |
420 |
def __str__(wt): |
def __str__(wt): |
418 |
421 |
return 'Gaussian_Z_prod_2D' |
return 'Gaussian_Z_prod_2D' |
|
... |
... |
class Gaussian_ProdFourBetas_2D(WhiteBox): |
448 |
451 |
BesselK1 = special.kn(1, const) |
BesselK1 = special.kn(1, const) |
449 |
452 |
self.pf_exact = 1 - const * (StruveL1 * BesselK0 + StruveL0 * BesselK1 + 2/np.pi * BesselK0) |
self.pf_exact = 1 - const * (StruveL1 * BesselK0 + StruveL0 * BesselK1 + 2/np.pi * BesselK0) |
450 |
453 |
self.pf_exact_method = 'exact (Bessel) solution' |
self.pf_exact_method = 'exact (Bessel) solution' |
451 |
|
|
|
|
454 |
|
self.r_exact = self.beta |
452 |
455 |
|
|
453 |
456 |
def __str__(wt): |
def __str__(wt): |
454 |
457 |
return 'Gaussian_ProdFourBetas_2D' |
return 'Gaussian_ProdFourBetas_2D' |
|
... |
... |
class Lognormal_Z_prod(WhiteBox): #č ověřím to moje odvození... |
472 |
475 |
self.beta_exact = beta_exact |
self.beta_exact = beta_exact |
473 |
476 |
self.pf_exact = stats.norm.cdf(-self.beta_exact) |
self.pf_exact = stats.norm.cdf(-self.beta_exact) |
474 |
477 |
self.pf_exact_method = 'FORM (exact solution)' # Ang, Tang and Pythagoras |
self.pf_exact_method = 'FORM (exact solution)' # Ang, Tang and Pythagoras |
475 |
|
|
|
|
478 |
|
self.r_exact = self.beta_exact |
476 |
479 |
|
|
477 |
480 |
def __str__(wt): |
def __str__(wt): |
478 |
481 |
return 'Lognormal_Z_prod%sD'%(wt.f.nvar) |
return 'Lognormal_Z_prod%sD'%(wt.f.nvar) |
|
... |
... |
class Gaussian_Z_min(WhiteBox): |
499 |
502 |
self.pf_exact = float(1 - mpmath.ncdf(self.const)**ndim) |
self.pf_exact = float(1 - mpmath.ncdf(self.const)**ndim) |
500 |
503 |
else: |
else: |
501 |
504 |
raise ValueError |
raise ValueError |
|
505 |
|
self.r_exact = self.const |
502 |
506 |
self.gm = g_models.Z_min(self.const) # min(X1, X2, XN) + const |
self.gm = g_models.Z_min(self.const) # min(X1, X2, XN) + const |
503 |
507 |
# na začatku nemáme vzorky - pouze rozdělení a podpís |
# na začatku nemáme vzorky - pouze rozdělení a podpís |
504 |
508 |
self.sample_box = SampleBox(self.f(), gm_signature=self.gm_signature) |
self.sample_box = SampleBox(self.f(), gm_signature=self.gm_signature) |
|
... |
... |
class Weibull_Z_min(WhiteBox): |
545 |
549 |
self.pf_exact = 1e-4 |
self.pf_exact = 1e-4 |
546 |
550 |
self.const = -self.rvweibmin.ppf(self.pf_exact) |
self.const = -self.rvweibmin.ppf(self.pf_exact) |
547 |
551 |
|
|
|
552 |
|
sf = 1 - mpmath.root(1 - mpmath.mpf(self.pf_exact), len(wb_scales)) |
|
553 |
|
self.r_exact = stats.norm.isf(float(sf)) |
548 |
554 |
self.gm = g_models.Z_min(self.const) |
self.gm = g_models.Z_min(self.const) |
549 |
555 |
# na začatku nemáme vzorky - pouze rozdělení a podpís |
# na začatku nemáme vzorky - pouze rozdělení a podpís |
550 |
556 |
self.sample_box = SampleBox(self.f(), gm_signature=self.gm_signature) |
self.sample_box = SampleBox(self.f(), gm_signature=self.gm_signature) |
|
... |
... |
class Gaussian_Z_max(WhiteBox): |
574 |
580 |
self.pf_exact = float(mpmath.ncdf(-self.const)**ndim) |
self.pf_exact = float(mpmath.ncdf(-self.const)**ndim) |
575 |
581 |
else: |
else: |
576 |
582 |
raise ValueError |
raise ValueError |
|
583 |
|
self.r_exact = np.sqrt(self.const**2 * ndim) |
577 |
584 |
self.gm = g_models.Z_max(self.const) # min(X1, X2, XN) + const |
self.gm = g_models.Z_max(self.const) # min(X1, X2, XN) + const |
578 |
585 |
# na začatku nemáme vzorky - pouze rozdělení a podpís |
# na začatku nemáme vzorky - pouze rozdělení a podpís |
579 |
586 |
self.sample_box = SampleBox(self.f(), gm_signature=self.gm_signature) |
self.sample_box = SampleBox(self.f(), gm_signature=self.gm_signature) |
|
... |
... |
class SNorm_Z_sumsq(WhiteBox): |
686 |
693 |
|
|
687 |
694 |
|
|
688 |
695 |
self.const = self.C |
self.const = self.C |
|
696 |
|
self.R_exact = np.sqrt(self.const) |
689 |
697 |
self.gm = g_models.Z_sumsq(self.C) |
self.gm = g_models.Z_sumsq(self.C) |
690 |
698 |
# na začatku nemáme vzorky - pouze rozdělení a podpís |
# na začatku nemáme vzorky - pouze rozdělení a podpís |
691 |
699 |
self.sample_box = SampleBox(self.f(), gm_signature=self.gm_signature) |
self.sample_box = SampleBox(self.f(), gm_signature=self.gm_signature) |
|
... |
... |
class SNorm_S_ball(WhiteBox): |
743 |
751 |
|
|
744 |
752 |
|
|
745 |
753 |
self.r = r |
self.r = r |
|
754 |
|
self.r_exact = self.r |
746 |
755 |
self.gm = g_models.S_ball(r) |
self.gm = g_models.S_ball(r) |
747 |
756 |
# na začatku nemáme vzorky - pouze rozdělení a podpís |
# na začatku nemáme vzorky - pouze rozdělení a podpís |
748 |
757 |
self.sample_box = SampleBox(self.f(), gm_signature=self.gm_signature) |
self.sample_box = SampleBox(self.f(), gm_signature=self.gm_signature) |