def __init__(self, n_features, lenscale=1.0, p=1, variational=False,
lenscale_posterior=None):
"""Create an instance of an arc cosine kernel layer."""
# Setup random weights
if variational:
kern = RBFVariational(lenscale=lenscale,
lenscale_posterior=lenscale_posterior)
else:
kern = RBF(lenscale=lenscale)
super().__init__(n_features=n_features, kernel=kern)
# Kernel order
assert isinstance(p, int) and p >= 0
if p == 0:
self.pfunc = tf.sign
elif p == 1:
self.pfunc = lambda x: x
else:
self.pfunc = lambda x: tf.pow(x, p)
评论列表
文章目录