Repository navigation
Conversation
|
This pull request introduces 36 alerts when merging eb3da63 into 2c66afb - view on LGTM.com new alerts:
|
|
one unrelated failure in this PR has some whitespace pep-8 and unused variables in LGTM, params unpacked but not used mistake in comments I might privatize |
|
I still need simple chaining to get equivalent classes that I can use for unit tests, e.g. log version of other transformations. Another question is then how to get equivalent parameterization and the corresponding parameter transformation. I'm not sure how generically that will work or if it is distribution/transform dependent. |
eb3da63 to
d3864e0
Compare
|
amended commit with pep-8 cleaning and rename I still left unused explicit |
|
checking birnbaum-saunder-normal distribution against scipy.stats.fatiguelife (other common name of BS) looks like the shape parameter is the same I'm skipping first element for rtol because pdf is zero agreement is higher than I expected, only floating point noise at limit of double precision. update update 2 |
|
extra: what do we need in the transformation for log jacobian? i.e. |
|
different parameterization, standardizing coefficient. sinh in log-birnbaum-saunders article has a multiplicative factor It's difficult to figure out how to match up parameterizations the following matches visually, but parameters are just by trial-and-error another generalized BS and sinh article uses scaled log-transform y = 0.5 * log(x) I'm not sure there are "standard" definitions for these distributions. Do I need to add extra params that are just normalizing or standardizing coefficients like the 2 above? Those are fixed definitional coefficients and not used as transform and distribution parameters. Aside: IIRC, the wikipedia page for log-normal has a good list and descriptions for possible parameterization of the log-normal distribution, with clear distinction of where e.g. loc and scale refer to the original or transformed distribution. |
|
parameterization (continued) I think for the distribution we want to keep loc-scale of final, transformed variable out of the transformation, similar to scipy. A multiplicative factor on the Tensorflow makes a scale adjustment to the transform to fix a quantile. generalized BS or TMI transform, with different powers choosing multiplicative factor 1/2 in transform similar to TMI versus TMI1 makes a "nicer" inverse function, e.g. formula looks better in latex processed math The second article on power generalized BS Diaz-Cardia and Domingues-Molinea 2006 does not use 1/2 in inverse transform but adds scale parameter alpha I'm getting confused again, without the 1/2 another version: using exponent c / 2 analogous to sqrt in BS, so that BS is special case c=1 edit current code Birnbaum Sounders inverse no 1/2:
|
|
including loc-scale changes in transforms? the general pattern is standard base distribution -> affine, loc-scale transform -> nonlinear transform -> affine, loc-scale transform -> transformed distribution Base distribution and all 3 transforms can have params, but, depending on the transform, some params will be redundant. In the models we need just params, i.e. y ~ F(params), so we can use regression to model some of the params. Alternatives: required as scipy distribution: we need loc-scale family we can also merge the loc-scale transformation into the nonlinear transform or we could use loc-scale family as base distribution or we merge all transforms current code is a mix of the above
update I think we merge loc-scale of base distribution into the transform, if applicable, i.e. not in SinhArcsinh. Then we only have shape parameters of the base distribution as extra params layer. If there are no shape parameters as in normal distribution, then we don't need to chain the extra layer of params. If we merge both loc-scale transformation into the nonlinear transformation, then we don't get a scipy compatible loc-scale family, unless we fix loc-scale parameters in the transformed distribution before applying scipy's loc-scale treatment. I still don't have code that uses params in a non-trivial way. Adding loc-scale anywhere to transform or inverse is trivial in usage, but it will get more difficult for derivatives and estimation. good case for checking: BS-t(df) versus TMI-t(df), and get fully parameterized log(pdf), loglike for an MLE model |
d3864e0 to
f91a598
Compare
|
amended and force pushed again |
|
added a change in docstring to check whether renaming of master branch works |
87a7066 to
f05ef55
Compare
|
more on parameterization, based on log-normal and log-logistic We can parameterize distributions like log-normal in terms of the e.g. gaussian base distribution, e.g. loc-scale, or as parameters of the final distribution, shape-scale, In the final distribution we can only add loc-scale, shape parameters will be determined by original, base distribution and parameters of the transform. I think this limits us to still use some of the original parameters as final shape parameter, whether it's included in the base distribution or in the transform. (I guess for log-normal: use scale of original gaussian as final shape parameter, and scale of the final distribution as substitute for mean of original gaussian.) |
|
namings are a pain Here I used
Either version of the names can be justified in terms of ordering methods. |
see #7241
see #7244 SUMM issues about transformation and function collections
edit maybe look also at Box-Cox Cole Green distribution (BCCG) #4256
provides Transformation classes for creating flexible 3 or 4 parameter distributions based on transformation of variables.
Main part missing for generic usage in models are derivatives with respect to the params.
related to derivatives #7245
For some models we might get case specific derivative, e.g. articles for sinh-arcsinh-t regression with score and hessian.
This has comprehensive unit tests for checking internal consistency, but no outside verification