gradientDesc: Fit a Binary Logistic Biplot via Gradient Descent

View source: R/gradientDesc.R

gradientDescR Documentation

Fit a Binary Logistic Biplot via Gradient Descent

Description

Estimates the row-marker matrix A and the column-marker matrix B of a binary logistic biplot using a simple (batch) gradient descent algorithm. This function is mainly provided for pedagogical purposes and benchmarking; the MM and CG methods in LogBip are generally faster and more reliable.

Usage

gradientDesc(
  x,
  k = 2,
  rate = 0.001,
  converg = 0.001,
  max_iter,
  plot = FALSE,
  ...
)

Arguments

x

A binary matrix.

k

Number of dimensions. Default is k = 2.

rate

Learning rate \alpha for the gradient descent update. Default is 0.001.

converg

Convergence tolerance: the algorithm stops when the relative change in the loss function is below this value. Default is 0.001.

max_iter

Maximum number of iterations.

plot

Logical; if TRUE, the logistic biplot is plotted after fitting. Default is FALSE.

...

Additional arguments (currently unused).

Details

The model is

\mathrm{logit}(\pi_{ij}) = \log\!\left(\frac{\pi_{ij}}{1-\pi_{ij}}\right) = \mu_j + \sum_{s=1}^k b_{js}\,a_{is} = \mu_j + \mathbf{a}_i^\top \mathbf{b}_j.

The gradient with respect to the full parameter vector is

\nabla\ell = \left(\frac{\partial\ell}{\partial\boldsymbol{\mu}},\, \frac{\partial\ell}{\partial\mathbf{A}},\, \frac{\partial\ell}{\partial\mathbf{B}}\right) = \left((\boldsymbol{\Pi}-\mathbf{X})^\top,\; (\boldsymbol{\Pi}-\mathbf{X})\mathbf{B},\; (\boldsymbol{\Pi}-\mathbf{X})^\top\mathbf{A}\right).

Value

An object of class BiplotML (a named list) containing:

Ahat

Estimated row-marker matrix.

Bhat

Estimated column-marker matrix (including intercepts).

method

Character string "Gradient Descent".

Author(s)

Giovany Babativa <jgbabativam@unal.edu.co>

References

Vicente-Villardon, J. L., & Galindo, M. P. (2006). Logistic biplots. In M. Greenacre & J. Blasius (Eds.), Multiple Correspondence Analysis and Related Methods (pp. 503–521). Chapman & Hall.

See Also

plotBLB, performanceBLB

Examples

data("Methylation")
set.seed(02052020)
outGD <- gradientDesc(x = Methylation, k = 2, max_iter = 10000, plot = TRUE)

BiplotML documentation built on May 8, 2026, 5:06 p.m.