mle#

cinnabar.stats.mle(graph: DiGraph, factor: str = 'f_ij', node_factor: str | None = None) ndarray[source]#

Compute maximum likelihood estimate of free energies and covariance in their estimates. The number ‘factor’ is the node attribute on which the MLE will be calculated, where d’factor’ will be used as the standard error of the factor

We assume the free energy of node 0 is zero.

Reference : https://pubs.acs.org/doi/abs/10.1021/acs.jcim.9b00528 Xu, Huafengraph. “Optimal measurement network of pairwise differences.” Journal of Chemical Information and Modeling 59.11 (2019): 4720-4728.

NOTE: Self-edges (edges that connect a node to itself) will be ignored.

Parameters:
  • graph (nx.Graph) – The graph for which an estimate is to be computed Each edge must have attributes ‘f_ij’ and ‘df_ij’ for the free energy and uncertainty estimate Will have ‘bayesian_f_ij’ and ‘bayesian_df_ij’ added to each edge and ‘bayesian_f_i’ and ‘bayesian_df_i’ added to each node.

  • factor (string, default = ‘f_ij’) – node attribute of nx.Graph that will be used for MLE

  • node_factor (string, default = None) – optional - provide if there is node data (i.e. absolute values) ‘f_i’ or ‘exp_DG’ to include will expect a corresponding uncertainty ‘f_di’ or ‘exp_dDG’

Returns:

  • f_i (np.array with shape (n_ligands,)) – f_i[i] is the absolute free energy of ligand i in kT f_i[0] = 0

  • C (np.array with shape (n_ligands, n_ligands)) – C[i,j] is the covariance of the free energy estimates of i and j