Пример #1
0
b = ModelBuilder()
for var in ["c","p","wp","i","klag","x","wg","plag","xlag","a"]:
    b.addNode(var)
b.setInfluence("xlag","wp",1)
b.setInfluence("x","wp",1)
b.setInfluence("a","wp",1)
b.setInfluence("klag","i",1)
b.setInfluence("plag","i",1)
b.setInfluence("p","i",1)
b.setInfluence("plag","c",1)
b.setInfluence("p","c",1)
b.setInfluence("wg","c",1)
b.setInfluence("wp","c",1)
m = b.consume()

data = dataset.fromCSV("experiments/kleindata.csv")
data = data.makeDiff()
data = data.discretise()

lincp = NonLinearCPLogicGenerator()
cpcode = lincp.generate(m)

cc = CPCompiler()
runmodel = cc.compileCode(cpcode,data)
runmodel.iterations = 10000
result = runmodel.run()
g = GnuplotDrawer()
g.draw(result)
t = TableResultInterpreter()
r = t.interprete(m,result.latest())
ltri = LatexTableResultInterpreter(r)
Пример #2
0
    else:
      newdata.append(d)
  return newdata

b = ModelBuilder()
for var in ["f","mbsa2","mbsa7","mbsa8","mbsa9"]:
  b.addNode(var)
  b.setLevels(var,["Disagree","Agree"])
  #b.setLevels(var,["StronglyDisagree","Disagree","Agree","StronglyAgree"])
b.setInfluence("f","mbsa2",1)
b.setInfluence("f","mbsa7",1)
b.setInfluence("f","mbsa8",1)
b.setInfluence("f","mbsa9",1)
m = b.consume()

data = dataset.fromCSV("experiments/cnesdata.csv")
data = data.discretiseFunc(toTwoLevel)

lincp = NonLinearCPLogicGenerator()
cpcode = lincp.generate(m)

cc = CPCompiler()
runmodel = cc.compileCode(cpcode,data)
runmodel.iterations = 1000
result = runmodel.run()
g = GnuplotDrawer()
g.draw(result)
t = TableResultInterpreter()
r = t.interprete(m,result.latest())
replace = [
  ("f","$F$"),