Skip to content

Functions on the latest versions of hopsy #4

@vlsena

Description

@vlsena

Hi, I'm Physics master student in Brazil and I have been using hopsy library for a few months in my research project. Basically I am trying to sort out evenly distributed points within a polytope. I used your 'test.py' file as a base to build my code and it worked fine for a while, but when I recently updated hopsy library on my computer, some of the functions like "MultivariateGaussianModel" and "Run" stopped working. Have these functions had their names changed? How do I use them exactly the same as before?

I'm attaching my code (that's not working anymore) bellow:

import hopsy
import numpy as np

def sorteio(A,b,mu,cov,n_points): 
	model = hopsy.MultivariateGaussianModel(mu, cov)

	problem = hopsy.Problem(A, b, model)

	# the run object contains and constructs the markov chains. in the default case, the
	# Run object will have a single chain using the Hit-and-Run proposal algorithm and is
	# set to produce 10,000 samples.
	run = hopsy.Run(problem)

	# we finally sample
	run.sample(n_points)

	# from the run, we can now extract the produced data
	data = run.data

	# the states is a list of lists of numpy.ndarrays, which can be casted to a numpy.ndarray
	# which then has the shape (m,n,d), where m is the number of chains, n the number of samples
	# and d the dimenion
	states  = data.states
	
	return np.array(states)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions