Skip to content

Commit

Permalink
Use PEtab parameter prior for starting point sampling (#194)
Browse files Browse the repository at this point in the history
* make parPE use startpoint sampling from PEtab

* Update PEtab requirement to provide code for prior handling
  • Loading branch information
paulstapor authored and dweindl committed Dec 13, 2019
1 parent 0acbc8d commit 1d3c76c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
16 changes: 8 additions & 8 deletions misc/generateHDF5DataFileFromText.py
Original file line number Diff line number Diff line change
Expand Up @@ -1135,22 +1135,22 @@ def write_bounds(self):

def write_starting_points(self):
"""
Write a list of random starting points uniformly sampled from the
parameter bounds.
Parameter bounds need to be written beforehand.
Write a list of random starting points sampled as specified in PEtab
file.
"""
num_params = self.f['/parameters/parameterNames'].shape[0]
num_starting_points = 100
np.random.seed(0)

starting_points = self.f.require_dataset(
'/optimizationOptions/randomStarts',
[num_params, num_starting_points], 'f8')
lower = self.f['/parameters/lowerBound'][:]
upper = self.f['/parameters/upperBound'][:]
starting_points[:] = np.transpose(
np.random.rand(num_starting_points, num_params) * (
upper - lower) + lower)

starting_points[:] = \
self.petab_problem.sample_parameter_startpoints(
num_starting_points)

# Write nominal values for testing purposes
if 'nominalValue' in self.parameter_df:
self.f['/parameters/nominalValues'] = \
self.parameter_df.nominalValue[
Expand Down
4 changes: 2 additions & 2 deletions python/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
install_requires=['numpy',
'termcolor',
'colorama',
'petab>=0.0.0a14',
'amici>=0.10.13',
'petab>=0.0.0a17',
'amici>=0.10.16',
'h5py',
'python-libsbml>=5.17.0',
'jinja2',
Expand Down

0 comments on commit 1d3c76c

Please sign in to comment.