pharmpy.modeling.evaluate_eta_gradient#
- pharmpy.modeling.evaluate_eta_gradient(model, etas=None, parameters=None, dataset=None)[source]#
Evaluate the numeric eta gradient
The gradient is evaluated at the current model parameter values or optionally at the given parameter values. The gradient is done for each data record in the model dataset or optionally using the dataset argument. The gradient is done at the current eta values or optionally at the given eta values.
This function currently only support models without ODE systems
- Parameters:
model (Model) – Pharmpy model
etas (dict) – Optional dictionary of eta values
parameters (dict) – Optional dictionary of parameters and values
dataset (pd.DataFrame) – Optional dataset
- Returns:
pd.DataFrame – Gradient
Examples
>>> from pharmpy.modeling import load_example_model, evaluate_eta_gradient >>> from pharmpy.tools import load_example_modelfit_results >>> model = load_example_model("pheno_linear") >>> results = load_example_modelfit_results("pheno_linear") >>> etas = results.individual_estimates >>> evaluate_eta_gradient(model, etas=etas) dF/dETA_1 dF/dETA_2 1 -0.159537 -17.609116 2 -9.325893 -19.562289 3 -0.104417 -11.346161 4 -4.452951 -16.682310 5 -10.838840 -18.981836 .. ... ... 151 -5.424423 -19.973013 152 -14.497185 -17.344797 153 -0.198714 -22.697161 154 -7.987731 -23.941806 155 -15.817067 -22.309945 [155 rows x 2 columns]
See also
evaluate_epsilon_gradientEvaluate the epsilon gradient