catNetwork objects, with complexity up to some maximal value, that best fit the data.cnSearchSA(data, perturbations,
maxParentSet, maxComplexity=0,
parentsPool=NULL, fixedParentsPool=NULL,
selectMode = "BIC",
tempStart=1, tempCoolFact=0.9, tempCheckOrders=10, maxIter=100,
orderShuffles=1, stopDiff=0, priorSearch = NULL, echo=FALSE)matrix in row-nodes format or a data.frame in column-nodes formatdata. A value 1 designates the node in the corresponding sample as perturbedcatNetworkEvaluate object from a previous searchlogical that sets on/off some functional progress and debug informationcatNetworkEvaluate object.data can be a matrix of character categories with rows specifying the node-variables and columns assumed to be independent samples from an unknown network, or
a data.frame with columns specifying the nodes and rows being the samples.The number of categories for each node is obtained from the data. It is the user responsibility to make sure the data can be categorized reasonably. If the data is numerical it will be forcibly coerced to integer one, which however may result to NA entries or too many node categories, and in both cases the function will fail.
The function returns a list of networks, one for any possible complexity within the specified range. Stochastic optimization, based on the criterion of maximizing the likelihood, is carried on the network with complexity closest to, but not above, maxComplexity.
If maxComplexity is not specified, thus the function is called with the default zero value, then maxComplexity is set to be the complexity of a network with all nodes having the maximum, maxParentSet, the number of parents.
The selectMode parameter sets the selection criterion for the network upon which the
maximum likelihood optimization is carried on. "BIC" is the default choice, while any value
different from "AIC" and "BIC" results in the maximum complexity criterion to be used,
the one which selects the network with complexity given by maxComplexity.
The parameters tempStart, tempCoolFact and tempCheckOrders control the Simulated Annealing schedule.
tempStart is the starting temperature of the annealing process.
tempCoolFact is the cooling factor from one temperature step to another.
It is a number between 0 and 1, inclusively;
For example, if tempStart is the temperature in the first step,
tempStart*tempCoolFact will be temperature in the second.
tempCheckOrders is the number of proposals to be checked,
or with other words, order selections from the current order's neighborhood, at each step before decreasing the temperature.
maxIter is the maximum number of orders to be checked.
If for example maxIter is 40 and tempCheckOrders is 4,
then 10 temperature decreasing steps will be eventually performed.
orderShuffles is a number that controls the extend of the order neighborhoods.
Each new proposed order is obtained from the last accepted one by
orderShuffles switches of two node indices.
stopDiff is a stopping criterion. If at a current temperature,
after tempCheckOrders orders being checked, no likelihood improvement of level at least stopDiff is found, then the SA stops and the function exists.
Setting this parameter to zero guarantees exhausting all of the maximum allowed
maxIter order searches.
priorSearch is a result from previous search. This parameters allows a new search to be initiated
from the best order found so far. Thus a chain of searches can be constructed with varying parameters
providing greater adaptability and user control.
See the vignettes for more details on the algorithm.
cnSearchOrder, cnSearchSAclustercnet <- cnRandomCatnet(numnodes=12, maxParents=3, numCategories=2)
psamples <- cnSamples(object=cnet, numsamples=100)
nets <- cnSearchSA(data=psamples, perturbations=NULL,
maxParentSet=2, maxComplexity=36)
cc <- cnComplexity(object=cnet)
cnFind(object=nets, complexity=cc)Run the code above in your browser using DataLab