ArtPoon / BelleJS

Generate BEAST XML analysis files using a BEAUTI-like JavaScript interface
MIT License
2 stars 0 forks source link

Enable user to modify prior settings (hyperparameters) #6

Open ArtPoon opened 3 years ago

ArtPoon commented 3 years ago

Clicking on row of priors table should bring up modal window where user can view and modify hyperparameters, e.g., mean and standard deviation of normal distribution. Let's not worry about visualizing the distribution for now.

ArtPoon commented 3 years ago

I'm modifying the prior functions to be Object classes with prototype Prior

ArtPoon commented 3 years ago

That way if hyperparameters are modified, a Prior object is aware of it and will modify its return value for str() accordingly.

ArtPoon commented 3 years ago

I'm going to modify the Priors table to use d3 so that these objects are bound to the table rows. This will help with modifying the object in response to user input. We can also add an active property to filter priors that are not used by the user's current model settings.

ArtPoon commented 3 years ago

Ok finished modifying the table. Last thing is to implement the modal dialog. I've bound an event listener to clicking on rows, which retrieves sufficient data to retrieve the prior object class instance:

// on click
Object
  Bound: "n/a"
  Description: "substitution rate"
  Parameter: "clock.rate"  // <---- use this
  Prior: "Fixed value, value=1"
> row = priors.filter(x => x.parameter==="clock.rate")[0];
> row.obj
FixedValuePrior {idref: "clock.rate", initial: 1, bound: Array(1), str: ƒ}
ewong347 commented 3 years ago

Screen Shot 2021-03-29 at 1 51 20 PM

Change Prior Popup similar to the parse date popup. Wasn't 100% sure how to update the prior hyper-params object, so just need to fill out changePriors() at line 296 with update commands

ArtPoon commented 3 years ago

Thanks @ewong347 - We still need to be able to modify the hyperparameters and initial value

ArtPoon commented 3 years ago

For example, we can modify this for a LogNormalPrior object as follows:

row = priors.filter(x => x.parameter==="kappa")[0];
row.obj.mu = 2.0;