Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

[081fbe]: src / modules / glm / samplers / BinaryFactory.h Maximize Restore History

Download this file

BinaryFactory.h    57 lines (50 with data), 1.6 kB

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#ifndef BINARY_FACTORY_H_
#define BINARY_FACTORY_H_
#include "GLMFactory.h"
namespace glm {
class BinaryGLM;
/**
* @short Base class for Binary GLM factories
*/
class BinaryFactory : public GLMFactory
{
bool _gibbs;
public:
BinaryFactory(std::string const &name, bool gibbs);
/**
* Checks that the outcome variable is a Bernoulli random
* variable or a binomial variable with size fixed to 1, and
* the link function is logit or probit. Linear models with
* identity link are also permitted.
*/
bool checkOutcome(StochasticNode const *snode,
LinkNode const *lnode) const;
/**
* Returns a newly allocated object of class BinaryGLM, unless
* we have a pure linear model with normal outcome variables.
* In this case, an object of class Linear is returned, as
* the overhead of the BinaryGLM class is not required.
*
* This function is called by GLMFactory#makeSampler
*/
GLMMethod *newMethod(GraphView const *view,
std::vector<GraphView const *> const &sub_views,
unsigned int chain) const;
/**
* If the factory was constructed with parameter "gibbs" set
* to true, then snode must be scalar. Otherwise, snode must
* be unbounded.
*
* @param snode Candidate node for sampling by BinaryGLM
*/
bool canSample(StochasticNode const *snode) const;
/**
* Returns a newly allocated BinaryGLM object.
*/
virtual BinaryGLM *newBinary(GraphView const *view,
std::vector<GraphView const *> const
&sub_views,
unsigned int chain) const = 0;
};
}
#endif /* BINARY_FACTORY_H_ */