Reference Manual: DSL em

From DSL
Jump to: navigation, search

This class implements the EM algorithm for learning the parameters of a Bayesian network.

Methods

  • DSL_em()

Constructor, that initializes the object with default values of parameters used for learning.


  • int Learn(const DSL_dataset &data, DSL_network &net, const vector<DSL_datasetMatch>& matches)

This method performs actual learning procedure. The first argument is the input data set. Only the parameters that are in the data set will be learned. So if you want to learn hidden variables you would have to add them to the data set. The result of learning procedure is stored in the DSL_network which is the second argument. The third argument contains matches between the variables in the data set and variables in the DSL_network. This vector is filled by the member function MatchNetwork. The Learn method returns DSL_OKAY if the learning was successful and some error code otherwise.

  • int MatchNetwork(const DSL_network &net, std::vector<DSL_datasetMatch> &matching, std::string &errMsg)

Matches up the variables in the DSL_network with the variables in the DSL_dataset. It makes sure that the states of discrete variables are linked in the matching vector. This vector contains translations for variable states in the network to variables states in the data set. If something goes wrong, the method will return something other than DSL_OKAY and the string errMsg will contain an explanation of what went wrong.


  • void SetEquivalentSampleSize(int eqSampleSize)

Sets the equivalent sample size.


  • int GetEquivalentSampleSize()

Returns the equivalent sample size.


  • void SetRandomizeParameters(int rand)

Determines if the parameters have to be randomized when the equivalent sample size is set to 0. It defaults to true.


  • bool GetRandomizeParameters()

Returns the randomised parameters

  • void SetSeed(int seed)

Sets the random seed

  • int GetSeed()

Returns the random seed

  • void SetRelevance(bool r)

Sets the value of the relevance option (True/False) (i.e. enables or disables it)

  • bool GetRelevance() { return relevance; }

Returns the value of the relevance option

  • void SetUniformizeParameters(bool u)

Enables/Disables the UniformizeParameters option

  • bool GetUniformizeParameters()

Returns the value of the UniformizeParameters option

Personal tools