Пример #1
0
block_struct = weight_struct + nodes

# create link inputs (link inputs used repeatedly but can have link input per group)
# permute to bring diagonal to first position
link_inputs = [[] for _ in range(output_dim)]
for i in range(output_dim):
    idx = list(range(d_link.shape[0]))
    link_inputs[i] = d_link[[idx.pop(i)] + idx, :]

link_inputs = link_inputs + [1.0 for i in range(output_dim)
                             ]  # for full W row blocks, independent nodes

# create 'between' kernel list
klink_rows = [
    kernels.CompositeKernel('mul', [
        kernels.RadialBasis(
            2, std_dev=2.0, lengthscale=1.0, white=0.01, input_scaling=IS_ARD),
        kernels.CompactSlice(
            2, active_dims=[0, 1], lengthscale=2.0, input_scaling=IS_ARD)
    ]) for i in range(output_dim)
]
klink_f = [1.0 for i in range(node_dim)]

kernlink = klink_rows + klink_f

# create 'within' kernel
# kern
lag_active_dims_s = [[] for _ in range(output_dim)]
for i in range(output_dim):
    lag_active_dims_s[i] = list(range(lag_dim * i, lag_dim * (i + 1)))

k_rows = [
Пример #2
0
nodes = [[x] for x in list(range(output_dim * node_dim, output_dim * node_dim + output_dim))]
block_struct = weight_struct + nodes


# create link inputs (link inputs used repeatedly but can have link input per group)
# permute to bring diagonal to first position
link_inputs = [[] for _ in range(output_dim)]
for i in range(output_dim):
    idx = list(range(d_link.shape[0]))
    link_inputs[i] = d_link[[idx.pop(i)] + idx, :]

link_inputs = link_inputs + [1.0 for i in range(output_dim)]  # for full W row blocks, independent nodes

# create 'between' kernel list
klink_rows = [kernels.CompositeKernel('mul',[kernels.RadialBasis(2, std_dev=2.0, lengthscale=1.0, white=0.01, input_scaling = IS_ARD),
                                            kernels.CompactSlice(2, active_dims=[0,1], lengthscale = 2.0, input_scaling = IS_ARD)] )
                                            for i in range(output_dim) ]
klink_f = [1.0 for i in range(node_dim)]

kernlink = klink_rows +  klink_f


# create 'within' kernel
# kern
lag_active_dims_s = [ [] for _ in range(output_dim)]
for i in range(output_dim):
    lag_active_dims_s[i] = list(range(lag_dim*i, lag_dim*(i+1)))

k_rows = [kernels.CompositeKernel('mul',[kernels.RadialBasisSlice(lag_dim, active_dims=lag_active_dims_s[i],
                                            std_dev = 1.0, white = 0.01, input_scaling = IS_ARD),