[d2aab8]: src / modules / glm / samplers / IWLSFactory.cc  Maximize  Restore  History

Download this file

65 lines (55 with data), 1.4 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
57
58
59
60
61
62
63
64
#include <config.h>
#include <graph/StochasticNode.h>
#include "IWLSFactory.h"
#include "IWLS.h"
#include <graph/LinkNode.h>
using std::vector;
using std::string;
namespace glm {
IWLSFactory::IWLSFactory()
: GLMFactory("glm::IWLS")
{}
bool IWLSFactory::checkOutcome(StochasticNode const *snode,
LinkNode const *lnode) const
{
GLMFamily family = GLMMethod::getFamily(snode);
if (family == GLM_NORMAL) {
return lnode == 0;
}
else if (!lnode) {
return false;
}
else {
string link = lnode->linkName();
switch(family) {
case GLM_BERNOULLI: case GLM_BINOMIAL:
return link == "probit" || link == "logit";
case GLM_POISSON:
return link == "log";
case GLM_UNKNOWN: case GLM_NORMAL:
return false;
}
}
return false; //icpc -Wall
}
GLMMethod *
IWLSFactory::newMethod(GraphView const *view,
vector<GraphView const *> const &sub_views,
unsigned int chain) const
{
return new IWLS(view, sub_views, chain);
}
bool IWLSFactory::canSample(StochasticNode const *snode) const
{
vector<Node const *> const &parents = snode->parents();
for (unsigned int i = 0; i < parents.size(); ++i) {
if (!parents[i]->isObserved())
return false;
}
return !isBounded(snode);
}
bool IWLSFactory::fixedDesign() const
{
return true;
}
}

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks