This version of greta uses Tensorflow 2.0.0, which comes with it a host of new very exciting features!
Optimizers
The latest interface to optimizers in tensorflow are now used, these changes are described.
gradient_descent
gainsmomentum
andnesterov
arguments, as described here in TF docsadagrad
gainsepsilon
argument- removes
momentum
optimizer, as this has been folded intogradient_descent
arguments - Adds
amsgrad
argument toadam
optimizer, as described in TF docs - Adds
adamax
optimiser, see TF docs - Adds
l2_shrinkage_regularization_strength
andbeta
arguments toftrl
optimiser. - adds
nadam
optimiser - see docs. - In
rms_prop
optimiser, changesdecay
parameter torho
, and addscentered
parameter - see docs
The following optimisers are removed, as they are no longer supported by Tensorflow:
powell()
cg()
newton_cg()
l_bfgs_b()
tnc()
cobyla()
slsqp()
Installation revamp
This release provides a few improvements to installation in greta. It should now provide more information about installation progress, and be more robust. The intention is, it should just work, and if it doesn't, it should fail gracefully with some useful advice on problem solving.
- Added option to restart R + run
library(greta)
after installation (#523). - Added installation deps object,
greta_deps_sepc()
to help simplify specifying package versions (#664). - Removed
method
andconda
arguments frominstall_greta_deps()
as they
were not used. - Removed
manual
argument ininstall_greta_deps()
. - Added default 5 minute timer to installation processes.
- Added
greta_deps_receipt()
to list the current main python packages installed (#668). - Added checking suite to ensure you are using valid versions of TF, TFP, and Python(#666).
- Added data
greta_deps_tf_tfp
(#666), which contains valid versions combinations of TF, TFP, and Python. - Remove
greta_nodes_install/conda_*()
options as #493 makes them defunct. - Added option to write to a single logfile with
greta_set_install_logfile()
, andwrite_greta_install_log()
, andopen_greta_install_log()
(#493). - Added
destroy_greta_deps()
function to remove miniconda and python conda environment. - Improved
write_greta_install_log()
andopen_greta_install_log()
to usetools::R_user_dir()
to always write to a file location.open_greta_install_log()
will open one found from an environment variable or go to the default location (#703).
New Print methods
- New print method for
greta_mcmc_list
. This means MCMC output will be shorter and more informative (#644). - greta arrays now have a print method that stops them from printing too many rows into the console. Similar to MCMC print method, you can control the print output with the
n
argument:print(object, n = <elements to print>)
(#644).
Minor
greta_sitrep()
now checks for installations of Python, TF, and TFP.- Slice sampler no longer needs precision = "single" to work.
- greta now depends on R 4.1.0, which was released May 2021, over 3 years ago.
- export
is.greta_array()
andis.greta_mcmc_list()
. restart
argument forinstall_greta_deps()
andreinstall_greta_deps()
to automatically restart R (#523).
Internals
- Internally we are replacing most of the error handling code as separate
check_*
functions. - Implemented
cli::cli_abort/warn/inform()
in place ofcli::format_error/warning/message()
+stop/warning/message(msg, call. = FALSE)
pattern. - Uses legacy optimizer internally (Use
tf$keras$optimizers$legacy$METHOD
overtf$keras$optimizers$METHOD
). No user impact expected. - Update photo of Grete Hermann (#598).
- Use
%||%
internally to replace the pattern:if (is.null(x)) x <- thing
withx <- x %||% thing
(#630). - Add more explaining variables - replace
if (thing & thing & what == this)
withif (explanation_of_thing)
. - Refactored repeated uses of
vapply
into functions (#377, #658). - Add internal data files
.deps_tf
and.deps_tfp
to track dependencies of TF and TFP. Related to #666.
- Posterior density checks (#720):
- Don't run Geweke on CI as it takes 30 minutes to run.
- Add thinning to Geweke tests.
- Fix broken geweke tests from TF1-->TF2 change.
- Increase the number of effective samples for check_samples for lkj distribution
- Add more checks to posterior to run on CI/on each test of greta
Bug fixes
- Fix bug where matrix multiply had dimension error before coercing to greta array. (#464)
- Fixes for Wishart and LKJ Correlation distributions (#729 #733 #734):
- Add bijection density to choleskied distributions.
- Note about some issues with LKJ and our normalisation constant for the density.
- Removed our custom
forward_log_det_jacobian()
function fromtf_correlation_cholesky_bijector()
(used inlkj_correlation()
). Previously, it did not work with unknown dimensions, but it now works with them. - Ensure wishart uses sigma_chol in scale_tril
- Wishart uses
tf$matmul(chol_draws, chol_draws, adjoint_b = TRUE)
instead oftf_chol2symm(chol_draws)
. - Test log prob function returns valid numeric numbers.
- Addresses issue with log prob returning NaNs--replace
FillTriangular
withFillScaleTriL
and apply Chaining to first transpose input.