regression_tutorial.py 文件源码

python
阅读 30 收藏 0 点赞 0 评论 0

项目:aboleth 作者: data61 项目源码 文件源码
def svr(X, Y):
    """Support vector regressor, kind of..."""
    lambda_ = 1e-4
    eps = 0.01
    lenscale = 1.

    # Specify which kernel to approximate with the random Fourier features
    kern = ab.RBF(lenscale=lenscale)

    net = (
        # ab.InputLayer(name="X", n_samples=n_samples_) >>
        ab.InputLayer(name="X", n_samples=1) >>
        ab.RandomFourier(n_features=50, kernel=kern) >>
        # ab.DropOut(keep_prob=0.9) >>
        ab.DenseMAP(output_dim=1, l2_reg=lambda_, l1_reg=0.)
    )

    f, reg = net(X=X)
    loss = tf.reduce_mean(tf.nn.relu(tf.abs(Y - f) - eps)) + reg
    return f, loss
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号