Learning network parameters

<< Click to Display Table of Contents >>

Navigation:  Using SMILE Wrappers > Learning >

Learning network parameters

To learn the parameters in the existing Network object, you can use the EM algorithm implemented in EM class. As with structure learning, the data comes in DataSet object. However, the network and the data must be matched to ensure that learning algorithm knows the relationship between the dataset variables and network nodes. If the variables and nodes have identical identifiers, you can use the DataSet.matchNetwork method:

Java:

DataSet ds = new DataSet();

Network net = new Network();
// load network and data here

DataMatch[] matching = ds.matchNetwork(net);

em = new EM();
em.learn(ds, net, matching);

Python:

ds = pysmile.learning.DataSet()

net = pysmile.Network()

# load network and data here
matching = ds.match_network(net)
em = pysmile.learning.EM()

em.learn(ds, net, matching)

R:

ds <- DataSet()

net <- Network()
# load network and data here

matching <- ds$matchNetwork(net)

em <- EM()
em$learn(ds, net, matching)

C#:

DataSet ds = new DataSet();

Network net = new Network();

// load network and data here

DataMatch[] matching = ds.MatchNetwork(net);

em = new EM();

em.Learn(ds, net, matching);

If your network and data cannot be automatically matched with DataSet.matchNetwork, you can build the array of DataMatch objects in your own code. DataMatch has node and column fields representing node handle and variable index, respectively. For each node/variable pair you need one element of the array.