Exemplo n.º 1
0
def test_linear_variable_get_vec(spline_variable):
    uprior = UniformPrior(lb=0.0, ub=1.0, size=spline_variable.size)
    gprior = GaussianPrior(mean=0.0, sd=1.0, size=spline_variable.size)
    spline_variable.add_priors([uprior, gprior])

    uvec = spline_variable.get_uvec()
    gvec = spline_variable.get_gvec()

    assert uvec.shape == (2, spline_variable.size)
    assert gvec.shape == (2, spline_variable.size)
Exemplo n.º 2
0
 def result_to_priors(self,
                      result: Dict[str, np.ndarray],
                      min_var: float = 0.1) -> Dict[str, Prior]:
     mean = result["coefs"]
     sd = np.sqrt(np.maximum(min_var, np.diag(result["vcov"])))
     slices = sizes_to_sclices([var.size for var in self.variables])
     return {
         var_name: GaussianPrior(mean=mean[slices[i]], sd=sd[slices[i]])
         for i, var_name in enumerate(self.var_names)
     }
Exemplo n.º 3
0
def gprior():
    return GaussianPrior(mean=0.0, sd=1.0)