IMP logo
IMP Reference Guide  2.15.0
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-2021 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 
18 IMPISD_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  */
37 class 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 
61  virtual double unprotected_evaluate(IMP::DerivativeAccumulator *accum)
62  const IMP_OVERRIDE;
63 
65 
67 };
68 
69 IMPISD_END_NAMESPACE
70 
71 #endif /* IMPISD_NORMAL_SIGMA_PC_RESTRAINT_H */
#define IMP_OBJECT_METHODS(Name)
Define the basic things needed by any Object.
Definition: object_macros.h:25
A decorator for scale parameters particles.
Add scale parameter to particle.
Definition: Scale.h:24
A more IMP-like version of the std::vector.
Definition: Vector.h:40
A smart pointer to a reference counted object.
Definition: Pointer.h:87
Class for storing model, its restraints, constraints, and particles.
Definition: Model.h:72
Penalized complexity prior.
Classes to handle individual model particles. (Note that implementation of inline functions is in int...
A Penalized Complexity prior on sigma of a normal distribution.
Abstract base class for all restraints.
virtual ModelObjectsTemp do_get_inputs() const =0
#define IMP_OVERRIDE
Cause a compile error if this method does not override a parent method.
Class for adding derivatives from restraints to the model.
A restraint is a term in an IMP ScoringFunction.
Definition: Restraint.h:54