beta = np.random.rand(N)
theta = 10

# Simple testing of the performance of the Python and Scipy implementations
import time

t0 = time.time()
rbf_network(X, beta, theta)
print("Python: ", time.time() - t0)

t0 = time.time()
rbf_scipy(X, beta)
print("Scipy: ", time.time() - t0)

# Testing the performance of Cython
t0 = time.time()
rbf_network_cython(X, beta, theta)
print("Cython: ", time.time() - t0)











        
Esempio n. 2
0
# Cython  implementation of a Radial Basis Function (RBF) approximation scheme
#
# TODO: Write the Cython implementation in a separate fastloop.pyx file, compile and import it here
#
# from fastloop import rbf_network_cython

# Make up some data
D = 5
N = 1000
X = np.array([np.random.rand(N) for d in range(D)]).T
beta = np.random.rand(N)
theta = 10

# Simple testing of the performance of the Python and Scipy implementations
import time

# python
t0 = time.time()
rbf_network(X, beta, theta)
print("Python: ", time.time() - t0)
# scipy
t0 = time.time()
rbf_scipy(X, beta)
print("Scipy: ", time.time() - t0)

# Testing the performance of Cython
t0 = time.time()
fastloop.rbf_network_cython(X, beta, theta)
print("Cython: ", time.time() - t0)
Esempio n. 3
0
def dummy(X, beta, theta):
    rbf_network_cython(X, beta, theta)