Exemplo n.º 1
0
 def setUp(self):
     """
     Set up
     """
     self.kernel = asam.maxima_mean_kernel(np.vstack([self.Q_ref,
                                                      self.Q_ref+.5]), self.rho_D)
Exemplo n.º 2
0
 def setUp(self):
     """
     Set up
     """
     self.kernel = asam.maxima_mean_kernel(
         np.vstack([self.Q_ref, self.Q_ref + .5]), self.rho_D)
Exemplo n.º 3
0
        interp_values[:, i] = griddata(points.transpose(), Q[:, i],
                inputs)
    return interp_values 

# Create kernel
maximum = 1/np.product(bin_size)
def rho_D(outputs):
    rho_left = np.repeat([Q_ref-.5*bin_size], outputs.shape[0], 0)
    rho_right = np.repeat([Q_ref+.5*bin_size], outputs.shape[0], 0)
    rho_left = np.all(np.greater_equal(outputs, rho_left), axis=1)
    rho_right = np.all(np.less_equal(outputs, rho_right), axis=1)
    inside = np.logical_and(rho_left, rho_right)
    max_values = np.repeat(maximum, outputs.shape[0], 0)
    return inside.astype('float64')*max_values

kernel_mm = asam.maxima_mean_kernel(np.array([Q_ref]), rho_D)
kernel_rD = asam.rhoD_kernel(maximum, rho_D)
kernel_m = asam.maxima_kernel(np.array([Q_ref]), rho_D)
heur_list = [kernel_mm, kernel_rD, kernel_m]

# Create sampler
chain_length = 125
num_chains = 80
num_samples = num_chains*chain_length
sampler = asam.sampler(num_samples, chain_length, model)
inital_sample_type = "lhs"

# Get samples
# Run with varying kernels
gen_results = sampler.run_gen(heur_list, rho_D, maximum, param_domain,
        transition_set, sample_save_file) 
Exemplo n.º 4
0
# Create kernel
maximum = 1 / np.product(bin_size)


def rho_D(outputs):
    rho_left = np.repeat([Q_ref - .5 * bin_size], outputs.shape[0], 0)
    rho_right = np.repeat([Q_ref + .5 * bin_size], outputs.shape[0], 0)
    rho_left = np.all(np.greater_equal(outputs, rho_left), axis=1)
    rho_right = np.all(np.less_equal(outputs, rho_right), axis=1)
    inside = np.logical_and(rho_left, rho_right)
    max_values = np.repeat(maximum, outputs.shape[0], 0)
    return inside.astype('float64') * max_values


kernel_mm = asam.maxima_mean_kernel(np.array([Q_ref]), rho_D)
kernel_rD = asam.rhoD_kernel(maximum, rho_D)
kernel_m = asam.maxima_kernel(np.array([Q_ref]), rho_D)
heur_list = [kernel_mm, kernel_rD, kernel_m]

# Create sampler
chain_length = 125
num_chains = 80
num_samples = num_chains * chain_length
sampler = asam.sampler(num_samples, chain_length, model)
inital_sample_type = "lhs"

# Get samples
# Run with varying kernels
gen_results = sampler.run_gen(heur_list, rho_D, maximum, param_domain,
                              transition_set, sample_save_file)