growingspheres/utils/gs_utils.py
def generate_inside_ball(center, segment, n):
    """
    Args:
        "center" corresponds to the target instance to explain
        Segment corresponds to the size of the hypersphere
        n corresponds to the number of instances generated
        feature_variance: Array of variance for each continuous feature
    """
    def norm(v):
        # For Thibault Laugel
        v = np.linalg.norm(v, ord=2, axis=1)
        return v
    # Just for clarity of display
    d = center.shape[0]
    z = np.random.normal(0, 1, (n, d))
    # Draw uniformaly instances between the value of s egment[0]**d and segment[1]**d with 
    # d the number of dimension of the instance to explain
    u = np.random.uniform(segment[0]**d, segment[1]**d, n)
    r = u**(1/float(d))
    z = np.array([a * b / c for a, b, c in zip(z, r,  norm(z))])
    z = z + center
    return z

    Args:
        "center" corresponds to the target instance to explain
        Segment corresponds to the size of the hypersphere
        n corresponds to the number of instances generated
        feature_variance: Array of variance for each continuous feature
    
"center" corresponds to the target instance to explain
Segment corresponds to the size of the hypersphere
n corresponds to the number of instances generated
feature_variance: Array of variance for each continuous feature
" center " corresponds to the target instance to explain Segment corresponds to the size of the hypersphere n corresponds to the number of instances generated feature_variance : Array of variance for each continuous feature
def generate_inside_ball(center, segment, n):
    def norm(v):
        v = np.linalg.norm(v, ord=2, axis=1)
        return v
    d = center.shape[0]
    z = np.random.normal(0, 1, (n, d))
    u = np.random.uniform(segment[0]**d, segment[1]**d, n)
    r = u**(1/float(d))
    z = np.array([a * b / c for a, b, c in zip(z, r,  norm(z))])
    z = z + center
    return z
def generate_inside_ball ( center , segment , n ) : def norm ( v ) : v = np . linalg . norm ( v , ord = 2 , axis = 1 ) return v d = center . shape [ 0 ] z = np . random . normal ( 0 , 1 , ( n , d ) ) u = np . random . uniform ( segment [ 0 ] ** d , segment [ 1 ] ** d , n ) r = u ** ( 1 / float ( d ) ) z = np . array ( [ a * b / c for a , b , c in zip ( z , r , norm ( z ) ) ] ) z = z + center return z
Args:
"center" corresponds to the target instance to explain
Segment corresponds to the size of the hypersphere
n corresponds to the number of instances generated
feature_variance: Array of variance for each continuous feature
Args : " center " corresponds to the target instance to explain Segment corresponds to the size of the hypersphere n corresponds to the number of instances generated feature_variance : Array of variance for each continuous feature
"""
    Args:
        "center" corresponds to the target instance to explain
        Segment corresponds to the size of the hypersphere
        n corresponds to the number of instances generated
        feature_variance: Array of variance for each continuous feature
    """ # For Thibault Laugel # Just for clarity of display # Draw uniformaly instances between the value of s egment[0]**d and segment[1]**d with  # d the number of dimension of the instance to explain
center
segment
n