@@ -651,23 +651,53 @@ def compile_logp(
651
651
jacobian : bool = True ,
652
652
sum : bool = True ,
653
653
):
654
- """Compiled log probability density function"""
654
+ """Compiled log probability density function.
655
+
656
+ Parameters
657
+ ----------
658
+ vars: list of random variables or potential terms, optional
659
+ Compute the gradient with respect to those variables. If None, use all
660
+ free and observed random variables, as well as potential terms in model.
661
+ jacobian:
662
+ Whether to include jacobian terms in logprob graph. Defaults to True.
663
+ sum:
664
+ Whether to sum all logp terms or return elemwise logp for each variable.
665
+ Defaults to True.
666
+ """
655
667
return self .model .compile_fn (self .logpt (vars = vars , jacobian = jacobian , sum = sum ))
656
668
657
669
def compile_dlogp (
658
670
self ,
659
671
vars : Optional [Union [Variable , Sequence [Variable ]]] = None ,
660
672
jacobian : bool = True ,
661
673
):
662
- """Compiled log probability density gradient function"""
674
+ """Compiled log probability density gradient function.
675
+
676
+ Parameters
677
+ ----------
678
+ vars: list of random variables or potential terms, optional
679
+ Compute the gradient with respect to those variables. If None, use all
680
+ free and observed random variables, as well as potential terms in model.
681
+ jacobian:
682
+ Whether to include jacobian terms in logprob graph. Defaults to True.
683
+ """
663
684
return self .model .compile_fn (self .dlogpt (vars = vars , jacobian = jacobian ))
664
685
665
686
def compile_d2logp (
666
687
self ,
667
688
vars : Optional [Union [Variable , Sequence [Variable ]]] = None ,
668
689
jacobian : bool = True ,
669
690
):
670
- """Compiled log probability density hessian function"""
691
+ """Compiled log probability density hessian function.
692
+
693
+ Parameters
694
+ ----------
695
+ vars: list of random variables or potential terms, optional
696
+ Compute the gradient with respect to those variables. If None, use all
697
+ free and observed random variables, as well as potential terms in model.
698
+ jacobian:
699
+ Whether to include jacobian terms in logprob graph. Defaults to True.
700
+ """
671
701
return self .model .compile_fn (self .d2logpt (vars = vars , jacobian = jacobian ))
672
702
673
703
def logpt (
@@ -747,6 +777,20 @@ def dlogpt(
747
777
vars : Optional [Union [Variable , Sequence [Variable ]]] = None ,
748
778
jacobian : bool = True ,
749
779
) -> Variable :
780
+ """Gradient of the models log-probability w.r.t. ``vars``.
781
+
782
+ Parameters
783
+ ----------
784
+ vars: list of random variables or potential terms, optional
785
+ Compute the gradient with respect to those variables. If None, use all
786
+ free and observed random variables, as well as potential terms in model.
787
+ jacobian:
788
+ Whether to include jacobian terms in logprob graph. Defaults to True.
789
+
790
+ Returns
791
+ -------
792
+ dlogp graph
793
+ """
750
794
if vars is None :
751
795
value_vars = None
752
796
else :
@@ -771,6 +815,20 @@ def d2logpt(
771
815
vars : Optional [Union [Variable , Sequence [Variable ]]] = None ,
772
816
jacobian : bool = True ,
773
817
) -> Variable :
818
+ """Hessian of the models log-probability w.r.t. ``vars``.
819
+
820
+ Parameters
821
+ ----------
822
+ vars: list of random variables or potential terms, optional
823
+ Compute the gradient with respect to those variables. If None, use all
824
+ free and observed random variables, as well as potential terms in model.
825
+ jacobian:
826
+ Whether to include jacobian terms in logprob graph. Defaults to True.
827
+
828
+ Returns
829
+ -------
830
+ d²logp graph
831
+ """
774
832
if vars is None :
775
833
value_vars = None
776
834
else :
0 commit comments