Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ability to specify domains for variables in numeric sampling #2

Open
jsharkey13 opened this issue Sep 5, 2016 · 0 comments
Open

Ability to specify domains for variables in numeric sampling #2

jsharkey13 opened this issue Sep 5, 2016 · 0 comments

Comments

@jsharkey13
Copy link
Member

This was some sample code I wrote way back that sort of implemented that functionality, not sure how it worked now though:

##### Some test code to implement different limits on the sample space #####
test = numpy.random.random_sample((4, 10))#numpy.ones((4, 10))
lims = {"gamma": (0, 0), "b": (0, 0), "c": (0, 1), "d": (0, 0)}
up_limits = numpy.array([lims[e][1] for e in sorted(lims.keys())])
low_limits = numpy.array([lims[e][0] for e in sorted(lims.keys())])
vals = numpy.dot(numpy.diag(up_limits - low_limits), test)
print vals
vals += numpy.dot(numpy.diag(low_limits), numpy.ones((4, 10)))
tttt = sympy_parser.parse_expr("2*lamda+4*c+5*d+3*b", sympy.abc._clash)
print sorted(tttt.free_symbols, key=lambda x: str(x))
ffff = sympy.lambdify(sorted(tttt.free_symbols, key=lambda x: str(x)), tttt, "numpy")
gggg = ffff(*vals)
print gggg
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant