A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/kasselhingee/scorematchingad below:

kasselhingee/scorematchingad: R package for score matching by automatic differentiation

The goal of scorematchingad is to enable fast implementation of score matching estimators through the use of automatic differentiation in the CppAD library. Estimators for new models can be created quickly via the tape_uld() and the tape_smd() function. If the new models require domain/manifold not yet implemented in scorematchingad, then (for now) the domain/manifold has to be added to the source of scorematchingad.

See the file DESCRIPTION for a slightly longer description, and ./R/scorematchingad-package.R (equivalently help(scorematchingad, scorematchingad) from within R) for an even longer description. The built-in help for R packages is well populated.

You can install the development version of scorematchingad from GitHub with:

# install.packages("devtools")
devtools::install_github("kasselhingee/scorematchingad")

Some models are already incorporated into scorematchingad. Below is an example of estimating the Polynomially-Tilted Pairwise Interaction model (Scealy and Wood, 2023) for compositional data:

library(scorematchingad)
model <- rppi_egmodel(100)
estalr <- ppi(model$sample,
              paramvec = ppi_paramvec(betap = -0.5, p = ncol(model$sample)),
              trans = "alr")

This is an example of obtaining a tape of the score matching discrepancy of a custom likelihood for compositional data, which most naturally lies on the simplex:

myuld <- tape_uld(
"a1type dirich(const veca1 &u, const veca1 &beta) {
  size_t d  = u.size();
  a1type y(0.);  // initialize summation at 0
  for(size_t i = 0; i < d; i++)
  {   y   += beta[i] * CppAD::log(u[i]);
  }
  return y;
}",
  x = rep(0.2, 5), theta = rep(-0.1, 5))

tapes <- tape_smd("sim", "identity", "sim", 
 myuld$tape, myuld$tape$xtape, usertheta = NA * myuld$tape$dyntape, 
 bdryw="minsq", acut = 0.01)
Using scorematchingad in Other Packages [draft notes]

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4