Last active
May 19, 2020 22:48
Revisions
-
dirmeier renamed this gist
May 19, 2020 . 1 changed file with 3 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,6 +1,7 @@ def khatri_rao(J, X): # as needed to compute random effects model matrices # references: # - http://dx.doi.org/10.18637/jss.v067.i01 # - https://stat.ethz.ch/R-manual/R-patched/library/Matrix/html/KhatriRao.html Z = J[..., :, np.newaxis, :] * X[..., np.newaxis, :, :] return Z.reshape((-1,) + Z.shape[2:]) -
dirmeier created this gist
May 19, 2020 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,6 @@ def khatri_rao(J, X): # as needed to compute random effects model matrices # reference: http://dx.doi.org/10.18637/jss.v067.i01 # Z = J[..., :, np.newaxis, :] * X[..., np.newaxis, :, :] return Z.reshape((-1,) + Z.shape[2:])