prophesy.sampling package¶
Sampling is the package to get a rough image of the parameter space by considering single points in the parameter space.
Sampler: How to sample?¶
The basic interface for sampling is the sampler interface. Besides sampling on given points, it supports uniform sampling as some samplers might perform better.
prophesy.sampling.sampler module¶
- class Sampler¶
Bases:
object
Base class for performing sampling of given set of points
- abstract perform_sampling(samplepoints, ensure_welldefinedness=False)¶
Given some parameter instantiations, perform sampling on these instantiations.
- Parameters
samplepoints – An iterable yielding parameter instantiations
- Returns
A collection with the results of these samples
- Return type
- perform_uniform_sampling(parameters, region, samples_per_dimension)¶
Samples a uniform grid of points.
Given a list of intervals (i.e., the first and last point; for each dimension, in order) and the number of samples per dimension, a uniformly-spaced grid of points (the cartesian product) is sampled.
- Parameters
parameters – Parameters together with their region.
samples_per_dimension – In how many points should the region be divided.
prophesy.sampling.sampler_ratfunc module¶
- class RatFuncSampling(ratfunc, parameters)¶
Bases:
prophesy.sampling.sampler.Sampler
Simple sampler based on pycarl rational function
- perform_sampling(samplepoints)¶
- Parameters
samplepoints – iterable of SamplePoint
- Returns
- Return type
Sampling via probabilistic model checking¶
One can also sample via probabilistic model checkers, see prophesy.modelcheckers.pmc module.
Sampling: Where to sample?¶
To determine sample points based on the already sampled information, we provide sample generators.
prophesy.sampling.sample_generator module¶
prophesy.sampling.sampling_linear module¶
- class LinearRefinement(sampler, parameters, region, samples, threshold)¶
Bases:
prophesy.sampling.sample_generator.SampleGenerator
Based on an initial set of samples, refines the samples by means of linear interpolation to approximate the threshold
prophesy.sampling.sampling_uniform module¶
- class UniformSampleGenerator(sampler, parameters, region, samples, samples_per_dimension)¶
Bases:
prophesy.sampling.sample_generator.SampleGenerator
Generates a uniform grid of samples
High-level convenience functions¶
prophesy.sampling.sampling module¶
Helper module for simplified sampling access.
- refine_samples(sampler, parameters, region, samples, iterations, threshold)¶
Refine samples over several iterations.
- Parameters
sampler – The sampler to use
parameters – The parameters of the problem
samples – The already known samples
iterations – The number of iterations the refinement generator should be called.
threshold – The threshold value we are most interested in
- Returns
- uniform_samples(sampler, parameters, region, samples_per_dim)¶
Generate a uniform grid of samples.
- Parameters
sampler – The sampler to use
parameters – The parameters in our problem
samples_per_dim – The number of samples per dimension
- Returns