Ejemplo n.º 1
0
 def by_samples(cls, samples, bounds=None):
     nataf = NatafDensity()
     nataf.build(samples)
     return cls(nataf,
                bounds=bounds,
                params={
                    "name": "samples",
                    "samples": samples
                })
Ejemplo n.º 2
0
    def beta_marginals(cls,
                       lwr,
                       upr,
                       alpha,
                       beta,
                       covMatrix=None,
                       corrMatrix=None,
                       bounds=None):
        range = upr - lwr
        mean = lwr + alpha / (alpha + beta) * range
        stddev = np.sqrt(alpha * beta /
                         (alpha + beta + 1.0)) / (alpha + beta) * range
        if corrMatrix is None:
            corrMatrix = Dist().corrcoeff(covMatrix=covMatrix)

        num_dims = corrMatrix.shape[0]
        nataf = NatafDensity()
        nataf.initialize_random_variable_types([STD_BETA] * num_dims)
        nataf.initialize_random_variable_parameters([mean] * num_dims,
                                                    [stddev] * num_dims,
                                                    [[alpha, beta]] * num_dims)
        nataf.initialize_random_variable_correlations(corrMatrix)

        return cls(nataf,
                   bounds=bounds,
                   params={
                       "name": "beta",
                       "lwr": lwr,
                       "upr": upr,
                       "alpha": alpha,
                       "beta": beta,
                       "corrMatrix": corrMatrix,
                       "covMatrix": covMatrix
                   })
Ejemplo n.º 3
0
    def gamma_marginals(cls,
                        alpha,
                        beta,
                        covMatrix=None,
                        corrMatrix=None,
                        bounds=None):
        mean = alpha * beta
        stddev = np.sqrt(alpha) * beta
        if corrMatrix is None:
            corrMatrix = Dist().corrcoeff(covMatrix=covMatrix)

        num_dims = corrMatrix.shape[0]
        nataf = NatafDensity()
        nataf.initialize_random_variable_types([GAMMA] * num_dims)
        nataf.initialize_random_variable_parameters([mean] * num_dims,
                                                    [stddev] * num_dims,
                                                    [[alpha, beta]] * num_dims)
        nataf.initialize_random_variable_correlations(corrMatrix)
        return cls(nataf,
                   bounds=bounds,
                   params={
                       "name": "gamma",
                       "alpha": alpha,
                       "beta": beta,
                       "corrMatrix": corrMatrix,
                       "covMatrix": covMatrix
                   })
Ejemplo n.º 4
0
    def normal_marginals(cls,
                         mean,
                         stddev,
                         covMatrix=None,
                         corrMatrix=None,
                         bounds=None):
        if corrMatrix is None:
            corrMatrix = Dist().corrcoeff(covMatrix=covMatrix)

        num_dims = corrMatrix.shape[0]
        nataf = NatafDensity()
        nataf.initialize_random_variable_types([GAUSSIAN] * num_dims)
        nataf.initialize_random_variable_parameters(
            [mean] * num_dims, [stddev] * num_dims,
            [[mean, stddev]] * num_dims)
        nataf.initialize_random_variable_correlations(corrMatrix)
        return cls(nataf,
                   bounds=bounds,
                   params={
                       "name": "normal",
                       "mean": mean,
                       "stddev": stddev,
                       "corrMatrix": corrMatrix,
                       "covMatrix": covMatrix
                   })