I've created a manual matching by taking the regular matching and adding more DataMatch objects with modified slice and column values.
For example, where normaly i would have:
Code: Select all
DataMatch.node = 1, DataMatch.column = 100, DataMatch.slice = 0
For a 100 time slice DBN, I added more DataMatch objects with
Code: Select all
DataMatch.node = 1, DataMatch.column = 101, DataMatch.slice = 1
DataMatch.node = 1, DataMatch.column = 102, DataMatch.slice = 2
DataMatch.node = 1, DataMatch.column = 103, DataMatch.slice = 3
DataMatch.node = 1, DataMatch.column = 104, DataMatch.slice = 4
etc.
However, doing this still led to some nonsensical results, and it apears only some of the temporal CPT's were updated.
When i restricted the learning data to only the first entry, while GeNIe optimised to a score of -71.6369, the wrapper would optimise to a score of -3.2147 but with the nonsensical temporal CPT's. ([0.994949494949495, 0.005050505050505051, 0.75, 0.25, 0.5, 0.5, 0.5, 0.5], source values [0.99, 0.01, 0.75, 0.25, 0.95, 0.05, 0.25, 0.75])
The base BN CPT's are exactly the same though.
The edited script looks like this:
Code: Select all
networkFile = "dev_PerfNetwork1_3BE_1574983185.5145876.xdsl"
networkOutFile = networkFile[:-5]+ "B.xdsl"
dataFile = "PerfNetwork1_3BE_DataA.csv"
net = pysmile.Network()
net.read_file(networkFile)
ds = pysmile.learning.DataSet()
ds.read_file(dataFile);
print("learning from records: " + str(ds.get_record_count()))
matching = ds.match_network(net)
newMatching = []
for baseMatch in matching:
newMatching.append(baseMatch)
for i in range(1, net.get_slice_count()):
newMatchColumn = baseMatch.column + i
newMatchNode = baseMatch.node
newMatchSlice = i
newMatch = pysmile.learning.DataMatch(newMatchColumn, newMatchNode, newMatchSlice)
newMatching.append(newMatch)
matching = newMatching
em = pysmile.learning.EM()
em.learn(ds, net, matching)
lastScore = em.get_last_score()
net.write_file(networkOutFile)
Am i still missing a step in the EM learning, or am i misunderstanding the values the DataMatch objects should have?
EDIT: I just missed the previous post, since i had the site still open and posted before refreshing. I'll investigate that now.