Optimize

From HyPhy Wiki
Jump to: navigation, search
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_id must 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

  1. SetDialogPrompt("Please specify a nucleotide data file:");
  2. DataSet ds  = ReadDataFile (PROMPT_FOR_FILE);
  3. DataSetFilter filteredData = CreateFilter (ds,1);
  4. SelectTemplateModel(filteredData);
  5. Tree givenTree = DATAFILE_TREE;
  6. LikelihoodFunction lf = (filteredData,givenTree);
  7. Optimize (res, lf);
  8. function userFunction (x,y)
  9. {
  10.       return Exp(-(x-2)^2-(y-3)^2);
  11. }
  12. a = Random(0,10);
  13. b = Random(0,10);
  14. Optimize (res, userFunction (a,b));
  15. fprintf (stdout, "", res, "");

Personal tools
Namespaces
Variants
Actions
Navigation
Toolbox