IMP logo
IMP Reference Guide  develop.7482b7c7af, 2026/12/05
The Integrative Modeling Platform
NormalSigmaPCRestraint.h
Go to the documentation of this file.
1/**
2 * \file IMP/isd/NormalSigmaPCRestraint.h
3 * \brief A Penalized Complexity prior on sigma of a normal distribution.
4 *
5 * Copyright 2007-2022 IMP Inventors. All rights reserved.
6 *
7 */
8
9#ifndef IMPISD_NORMAL_SIGMA_PC_RESTRAINT_H
10#define IMPISD_NORMAL_SIGMA_PC_RESTRAINT_H
11
12#include <IMP/isd/isd_config.h>
14#include <IMP/isd/Scale.h>
15#include <IMP/Particle.h>
16#include <IMP/Restraint.h>
17
18IMPISD_BEGIN_NAMESPACE
19
20//! A Penalized Complexity prior on sigma of a normal distribution.
21/** The Penalized Complexity (PC) prior on sigma minimizes the complexity (and
22 resulting risk of over-fitting) introduced by deviation from a delta
23 function (\f$\sigma=0\f$) to a normal distribution. Its density is
24
25 \f[ p(\sigma) = \frac{-\log\alpha}{\sigma_u} \alpha^{\sigma / \sigma_u},\f]
26
27 where \f$\sigma_u\f$ is a user-specified value of \f$\sigma\f$ that
28 indicates a 'tail event', a value that it is unexpected to exceed, and
29 \f$\alpha = p(\sigma > \sigma_u)\f$ is the density in the tail.
30
31 \see PenalizedComplexityPrior
32
33 \note The prior is related by a change of variables to the PC prior on the
34 precision tau in Simpson et al. Stat Sci. (2017) 32(1): 1. arXiv: 1403.4630,
35 which is a type 2 Gumbel distribution.
36 */
37class IMPISDEXPORT NormalSigmaPCRestraint : public Restraint {
38
39 private:
41 ParticleIndex spi_;
42 double su_, nloga_;
43
44 void create_distribution(double alpha);
45
46 public:
47 NormalSigmaPCRestraint(Model *m, ParticleIndex spi, double su, double alpha,
48 std::string name = "NormalSigmaPCRestraint%1%");
49
50 NormalSigmaPCRestraint(Scale s, double su, double alpha,
51 std::string name = "NormalSigmaPCRestraint%1%");
52
53 Scale get_sigma() const;
54
55 double get_alpha() const { return std::exp(-nloga_); }
56
57 double get_sigma_upper() const { return su_; }
58
59 double get_probability() const { return std::exp(-unprotected_evaluate(nullptr)); }
60
62 const override;
63
64 virtual IMP::ModelObjectsTemp do_get_inputs() const override;
65
66 IMP_OBJECT_METHODS(NormalSigmaPCRestraint);
67};
68
69IMPISD_END_NAMESPACE
70
71#endif /* IMPISD_NORMAL_SIGMA_PC_RESTRAINT_H */
Classes to handle individual model particles. (Note that implementation of inline functions is in int...
Penalized complexity prior.
Abstract base class for all restraints.
A decorator for scale parameters particles.
Class for adding derivatives from restraints to the model.
Restraint(Model *m, std::string name)
Create a restraint and register it with the model.
virtual IMP::ModelObjectsTemp do_get_inputs() const override
virtual double unprotected_evaluate(IMP::DerivativeAccumulator *accum) const override
Return the unweighted score for the restraint.
Add scale parameter to particle.
Definition Scale.h:24
Index< ParticleIndexTag > ParticleIndex
Definition base_types.h:196
IMP::Vector< IMP::WeakPointer< ModelObject > > ModelObjectsTemp
Definition base_types.h:122
#define IMP_OBJECT_METHODS(Name)
Define the basic things needed by any Object.
A smart pointer to a reference counted object.
Definition Pointer.h:88