Optimize
From HyPhy Wiki
| This page is a work in progress. Current status of the page is: being populated. |
Contents |
Syntax
Optimize (receptacle, likelihood_function_id);
Functionality
Upon completion receptacle will contain 2 rows:
- The first row lists all the parameters (global, followed by independent, followed by dependents,...). For order, call fprintf on the likelihood function after setting the environment variable LIKELIHOOD_FUNCTION_OUTPUT = 1
- The second row only has 3 entries.
- Element 1 ([1][0]): is the value of the likelihood function
- Element 2 ([1][1]): is the number of independent parameters that were optimized
- Element 3 ([1][2]): is the number of global(shared) parameters that were optimized.
Parameters
receptacle: The identifier of the matrix which receives the results.likelihood_function_id: The likelihood function to be optimized.likelihood_function_idmust refer to an existing likelihood function OR a user defined function which is to be optimized. In the latter case, the list of independent parameters will be gleaned from function parameter lists.
Example
SetDialogPrompt("Please specify a nucleotide data file:");
DataSet ds = ReadDataFile (PROMPT_FOR_FILE);
DataSetFilter filteredData = CreateFilter (ds,1);
SelectTemplateModel(filteredData);
Tree givenTree = DATAFILE_TREE;
LikelihoodFunction lf = (filteredData,givenTree);
Optimize (res, lf);
function userFunction (x,y)
{return Exp(-(x-2)^2-(y-3)^2);
}a = Random(0,10);
b = Random(0,10);
Optimize (res, userFunction (a,b));
fprintf (stdout, "", res, "");