import tensorflow as tf

                                   + 0.00392377*t**(-8))

        a = 7.5
        return __phi_f(tf.minimum(x, a)) - __phi_f(a) + __phi_g(tf.maximum(x, a))

    N = tf.cast(tf.shape(X)[0], tf.float32)
    if y is None:
        y = silverman_rule_of_thumb(N)

    A = 1/(N*N*tf.sqrt(y))
    B = 2.0/(N*tf.sqrt(y+0.5))

    A1 = euclidean_norm_squared(tf.subtract(tf.expand_dims(X, 0), tf.expand_dims(X, 1)), axis=2)/(4*y)
    B1 = euclidean_norm_squared(X, axis=1)/(2+4*y)
    return 1/tf.sqrt(1+y) + A*tf.reduce_sum(__phi(A1)) - B*tf.reduce_sum(__phi(B1))


def cw(X, y=None):
    D = tf.cast(tf.shape(X)[1], tf.float32)
    N = tf.cast(tf.shape(X)[0], tf.float32)
    if y is None:
        y = silverman_rule_of_thumb(N)

    K = 1/(2*D-3)
