SGD: Stochastic Gradient Descent (SGD) algorithm

View source: R/optim_functions.R

SGDR Documentation

Stochastic Gradient Descent (SGD) algorithm

Description

Performs stochastic gradient descent to optimize the parameters.

Usage

SGD(
  theta_current,
  psi,
  X,
  delta_Mu,
  delta_Nu,
  lambda,
  alpha = 0.1,
  beta = 0.05,
  centered = FALSE,
  batch_prop = 1/5,
  max_iter = 1000,
  tol = 0.001,
  lr = 0.01,
  verbose = FALSE
)

Arguments

theta_current

A numeric matrix of size 1 x d (intialization for parameter to estimate).

psi

A function that takes an input X and returns a numeric vector with values in the range ⁠[-1,1]⁠.

X

A matrix of covariates of size n x d (input data in ⁠[0,1]⁠).

delta_Mu

A function of X that determines the contrast between primary outcomes.

delta_Nu

A function of X that determines the contrast between adverse event outcomes.

lambda

A non-negative numeric scalar controlling the penalty for violating the constraint.

alpha

A numeric scalar representing the constraint tolerance (in ⁠[0,1/2]⁠, 0.1 by default).

beta

A non-negative numeric scalar controlling the sharpness of the probability function (0.05 by default).

centered

A logical value indicating whether to apply centering in sigma_beta (FALSE by default).

batch_prop

Proportion of data in a batch (by default 1/5).

max_iter

Maximum number of iterations in the SGD (by default 1e3).

tol

Tolerance parameter (by default 1e-3).

lr

Learning rate parameter (by default 1e-2).

verbose

A logical value indicating whether to print progress updates. Default is FALSE.

Value

A numeric matrix of size 1 x d (optimized parameters).


PLUCR documentation built on March 30, 2026, 5:08 p.m.