R/softmax.r

#' Compute soft-max
#' 
#' \code{softmax} returns the soft maximum of a collection of reals.
#' 
#' @param x input
#' @param a scaling factor
#' @import matrixStats
#' @export
#' @examples
#' set.seed(12345)
#' n <- 10
#' x <- rnorm(n)
#' softmax(x)
softmax <- function(x, a=100){
  return(logSumExp(x*a)/a)
}

Try the splitFeas package in your browser

Any scripts or data that you put into this service are public.

splitFeas documentation built on May 2, 2019, 2:52 p.m.