コード例 #1
0
ファイル: mathematics.py プロジェクト: JacobLaney/cgp-tetris
def sqrtxy(x, y, p):
    if is_np(x) and is_np(y):
        new_dim = min_dim(x, y)
        return np.sqrt(
            np.square(np.resize(x, new_dim)) +
            np.square(np.resize(y, new_dim))) / np.sqrt(2.0)
    return np.sqrt(np.square(x) + np.square(y)) / np.sqrt(2.0)
コード例 #2
0
ファイル: mathematics.py プロジェクト: JacobLaney/cgp-tetris
def inv(x, y, p):
    if is_np(x):
        out = np.zeros(x.shape)
        np.divide(1.0, x, out=out, where=(x != 0.0))
        return out
    else:
        return x if x == 0 else 1.0 / x
コード例 #3
0
ファイル: statistics.py プロジェクト: aHeraud/cgp-tetris
def f_range(x, y, p):
    if is_np(x):
        return np.max(x) - np.min(x) - 1
    else:
        return x
コード例 #4
0
ファイル: statistics.py プロジェクト: aHeraud/cgp-tetris
def kurtosis(x, y, p):
    if is_np(x):
        return scipy.stats.kurtosis(x)
    else:
        return x
コード例 #5
0
ファイル: statistics.py プロジェクト: aHeraud/cgp-tetris
def skew(x, y, p):
    if is_np(x):
        return scipy.stats.skew(x)
    else:
        return x
コード例 #6
0
ファイル: statistics.py プロジェクト: aHeraud/cgp-tetris
def stddev(x, y, p):
    if is_np(x):
        return np.std(x)
    else:
        return x
コード例 #7
0
def reverse(x, y, p):
    if not is_np(x):
        return x
    else:
        return np.copy(x[::-1])
コード例 #8
0
ファイル: mathematics.py プロジェクト: JacobLaney/cgp-tetris
def ypow(x, y, p):
    if is_np(x) and is_np(y):
        new_dim = min_dim(x, y)
        return (np.abs(np.resize(x, new_dim))**np.abs(np.resize(y, new_dim)))
    return np.abs(x)**np.abs(y)
コード例 #9
0
ファイル: mathematics.py プロジェクト: JacobLaney/cgp-tetris
def mult(x, y, p):
    if is_np(x) and is_np(y):
        new_dim = min_dim(x, y)
        return np.resize(x, new_dim) * np.resize(y, new_dim)
    return x * y
コード例 #10
0
ファイル: mathematics.py プロジェクト: JacobLaney/cgp-tetris
def aminus(x, y, p):
    if is_np(x) and is_np(y):
        new_dim = min_dim(x, y)
        return np.abs(np.resize(x, new_dim) - np.resize(y, new_dim)) / 2.0
    return np.abs(x - y) / 2.0
コード例 #11
0
ファイル: mathematics.py プロジェクト: JacobLaney/cgp-tetris
def add(x, y, p):
    if is_np(x) and is_np(y):
        new_dim = min_dim(x, y)
        return (np.resize(x, new_dim) + np.resize(y, new_dim)) / 2.0
    return (x + y) / 2.0
コード例 #12
0
ファイル: comparison.py プロジェクト: aHeraud/cgp-tetris
def gt(x, y, p):
    if is_np(x) and is_np(y):
        new_dim = min_dim(x, y)
        return np.resize(x, new_dim) > np.resize(y, new_dim)
    return x > y