remove model
parent
789b5d2eb6
commit
c245264388
|
|
@ -236,8 +236,7 @@ VectorValues HybridBayesNet::optimize(const DiscreteValues &assignment) const {
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ************************************************************************* */
|
/* ************************************************************************* */
|
||||||
HybridValues HybridBayesNet::sample(VectorValues given, std::mt19937_64 *rng,
|
HybridValues HybridBayesNet::sample(VectorValues given, std::mt19937_64 *rng) const {
|
||||||
SharedDiagonal model) const {
|
|
||||||
DiscreteBayesNet dbn;
|
DiscreteBayesNet dbn;
|
||||||
for (size_t idx = 0; idx < size(); idx++) {
|
for (size_t idx = 0; idx < size(); idx++) {
|
||||||
if (factors_.at(idx)->isDiscrete()) {
|
if (factors_.at(idx)->isDiscrete()) {
|
||||||
|
|
@ -250,26 +249,24 @@ HybridValues HybridBayesNet::sample(VectorValues given, std::mt19937_64 *rng,
|
||||||
// Select the continuous bayes net corresponding to the assignment.
|
// Select the continuous bayes net corresponding to the assignment.
|
||||||
GaussianBayesNet gbn = this->choose(assignment);
|
GaussianBayesNet gbn = this->choose(assignment);
|
||||||
// Sample from the gaussian bayes net.
|
// Sample from the gaussian bayes net.
|
||||||
VectorValues sample = gbn.sample(given, rng, model);
|
VectorValues sample = gbn.sample(given, rng);
|
||||||
return HybridValues(assignment, sample);
|
return HybridValues(assignment, sample);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ************************************************************************* */
|
/* ************************************************************************* */
|
||||||
HybridValues HybridBayesNet::sample(std::mt19937_64 *rng,
|
HybridValues HybridBayesNet::sample(std::mt19937_64 *rng) const {
|
||||||
SharedDiagonal model) const {
|
|
||||||
VectorValues given;
|
VectorValues given;
|
||||||
return sample(given, rng, model);
|
return sample(given, rng);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ************************************************************************* */
|
/* ************************************************************************* */
|
||||||
HybridValues HybridBayesNet::sample(VectorValues given,
|
HybridValues HybridBayesNet::sample(VectorValues given) const {
|
||||||
SharedDiagonal model) const {
|
return sample(given, &kRandomNumberGenerator);
|
||||||
return sample(given, &kRandomNumberGenerator, model);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ************************************************************************* */
|
/* ************************************************************************* */
|
||||||
HybridValues HybridBayesNet::sample(SharedDiagonal model) const {
|
HybridValues HybridBayesNet::sample() const {
|
||||||
return sample(&kRandomNumberGenerator, model);
|
return sample(&kRandomNumberGenerator);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ************************************************************************* */
|
/* ************************************************************************* */
|
||||||
|
|
|
||||||
|
|
@ -130,11 +130,9 @@ class GTSAM_EXPORT HybridBayesNet : public BayesNet<HybridConditional> {
|
||||||
*
|
*
|
||||||
* @param given Values of missing variables.
|
* @param given Values of missing variables.
|
||||||
* @param rng The pseudo-random number generator.
|
* @param rng The pseudo-random number generator.
|
||||||
* @param model Optional diagonal noise model to use in sampling.
|
|
||||||
* @return HybridValues
|
* @return HybridValues
|
||||||
*/
|
*/
|
||||||
HybridValues sample(VectorValues given, std::mt19937_64 *rng,
|
HybridValues sample(VectorValues given, std::mt19937_64 *rng) const;
|
||||||
SharedDiagonal model = nullptr) const;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Sample using ancestral sampling.
|
* @brief Sample using ancestral sampling.
|
||||||
|
|
@ -144,28 +142,24 @@ class GTSAM_EXPORT HybridBayesNet : public BayesNet<HybridConditional> {
|
||||||
* auto sample = bn.sample(&rng);
|
* auto sample = bn.sample(&rng);
|
||||||
*
|
*
|
||||||
* @param rng The pseudo-random number generator.
|
* @param rng The pseudo-random number generator.
|
||||||
* @param model Optional diagonal noise model to use in sampling.
|
|
||||||
* @return HybridValues
|
* @return HybridValues
|
||||||
*/
|
*/
|
||||||
HybridValues sample(std::mt19937_64 *rng,
|
HybridValues sample(std::mt19937_64 *rng) const;
|
||||||
SharedDiagonal model = nullptr) const;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Sample from an incomplete BayesNet, use default rng.
|
* @brief Sample from an incomplete BayesNet, use default rng.
|
||||||
*
|
*
|
||||||
* @param given Values of missing variables.
|
* @param given Values of missing variables.
|
||||||
* @param model Optional diagonal noise model to use in sampling.
|
|
||||||
* @return HybridValues
|
* @return HybridValues
|
||||||
*/
|
*/
|
||||||
HybridValues sample(VectorValues given, SharedDiagonal model = nullptr) const;
|
HybridValues sample(VectorValues given) const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Sample using ancestral sampling, use default rng.
|
* @brief Sample using ancestral sampling, use default rng.
|
||||||
*
|
*
|
||||||
* @param model Optional diagonal noise model to use in sampling.
|
|
||||||
* @return HybridValues
|
* @return HybridValues
|
||||||
*/
|
*/
|
||||||
HybridValues sample(SharedDiagonal model = nullptr) const;
|
HybridValues sample() const;
|
||||||
|
|
||||||
/// Prune the Hybrid Bayes Net such that we have at most maxNrLeaves leaves.
|
/// Prune the Hybrid Bayes Net such that we have at most maxNrLeaves leaves.
|
||||||
HybridBayesNet prune(size_t maxNrLeaves);
|
HybridBayesNet prune(size_t maxNrLeaves);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue