import tensorflow as tf



def cw_sampling(X, y=None):
    def phi_sampling(s, D):
        return tf.pow(1.0 + 4.0*s/(2.0*D-3), -0.5)

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