Skip to content

Instantly share code, notes, and snippets.

@stefanv
Last active October 23, 2019 00:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save stefanv/ccbda6f293b79ad4710972cdd8612bbd to your computer and use it in GitHub Desktop.
Save stefanv/ccbda6f293b79ad4710972cdd8612bbd to your computer and use it in GitHub Desktop.
import numpy as np
xs = np.linspace(2, 5, 10000) # 10000 samples of x between 2 and 5
ys = np.linspace(1, 2, 10000) # 10000 samples of y between 1 and 2
ix = np.random.randint(0, 10000, size=(10000, 2)) # random index, 2 parameters
def my_model(x, y):
... # do some magic
return 42 # spit out your evaluation of the model for a given x, y
N = 200
results = []
for i in range(N):
xi, yi = ix[i, 0], ix[i, 1]
x = xs[xi]
y = ys[yi]
results.append(my_model(x, y))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment