MyNixOS website logo
Description

Sigmoid Functions for Machine Learning.

Several different sigmoid functions are implemented, including a wrapper function, SoftMax preprocessing and inverse functions.

sigmoid

License CRAN Version R build status Coverage Status Total RStudio Cloud Downloads RStudio Cloud Downloads

Several different sigmoid functions are implemented, including a wrapper function, SoftMax preprocessing and inverse functions.

Demonstration

sigmoid demonstration

Installation

The stable version can be installed from CRAN using:

install.packages('sigmoid')

The development version, to be used at your peril, can be installed from GitHub using the remotes package.

if (!require('remotes')) install.packages('remotes')
remotes::install_github('bquast/sigmoid')

Usage

Following installation, the package can be loaded using:

The sigmoid() function returns the sigmoid value of the input(s), by default this is done using the standard logistic function.

library(sigmoid)
sigmoid(3)
#> [1] 0.9525741

Inputs can also be tensors, such as vectors, matrices, or arrays.

sigmoid(-5:5)
#>  [1] 0.006692851 0.017986210 0.047425873 0.119202922 0.268941421 0.500000000
#>  [7] 0.731058579 0.880797078 0.952574127 0.982013790 0.993307149
sigmoid( matrix(-3:5,nrow=3) ) # etc.
#>            [,1]      [,2]      [,3]
#> [1,] 0.04742587 0.5000000 0.9525741
#> [2,] 0.11920292 0.7310586 0.9820138
#> [3,] 0.26894142 0.8807971 0.9933071

The sigmoid() function is a wrapper, which by default uses the logistic() function, it can also use other methods.

sigmoid( -5:5, method='Gompertz' )
#>  [1] 3.507389e-65 1.942338e-24 1.892179e-09 6.179790e-04 6.598804e-02
#>  [6] 3.678794e-01 6.922006e-01 8.734230e-01 9.514320e-01 9.818511e-01
#> [11] 9.932847e-01

These functions can also be accessed directly.

logistic(1:5)
#> [1] 0.7310586 0.8807971 0.9525741 0.9820138 0.9933071
Gompertz(-1:-5)
#> [1] 6.598804e-02 6.179790e-04 1.892179e-09 1.942338e-24 3.507389e-65

These mappings are similar but not identical.

library(ggplot2)

input = -5:5

df = data.frame(input, logistic(input), Gompertz(input))

ggplot(df, aes(input, logistic(input))) + geom_line() +
  geom_line(aes(input,Gompertz(input)), colour='red')

For inverses, additional parameters, SoftMax, etc. see the vignette.

vignette('sigmoid')

For general information on using the package, please refer to the help files.

help('sigmoid')
help(package='sigmoid')

Additional Information

An overview of the changes is available in the NEWS file.

news(package='sigmoid')

There is a dedicated website with information hosted on my personal website.

https://qua.st/sigmoid

Development

Development takes place on the GitHub page.

https://github.com/bquast/sigmoid

Bugs can be filed on the issues page on GitHub.

https://github.com/bquast/sigmoid/issues.

Metadata

Version

1.4.0

License

Unknown

Platforms (77)

    Darwin
    FreeBSD
    Genode
    GHCJS
    Linux
    MMIXware
    NetBSD
    none
    OpenBSD
    Redox
    Solaris
    WASI
    Windows
Show all
  • aarch64-darwin
  • aarch64-freebsd
  • aarch64-genode
  • aarch64-linux
  • aarch64-netbsd
  • aarch64-none
  • aarch64-windows
  • aarch64_be-none
  • arm-none
  • armv5tel-linux
  • armv6l-linux
  • armv6l-netbsd
  • armv6l-none
  • armv7a-darwin
  • armv7a-linux
  • armv7a-netbsd
  • armv7l-linux
  • armv7l-netbsd
  • avr-none
  • i686-cygwin
  • i686-darwin
  • i686-freebsd
  • i686-genode
  • i686-linux
  • i686-netbsd
  • i686-none
  • i686-openbsd
  • i686-windows
  • javascript-ghcjs
  • loongarch64-linux
  • m68k-linux
  • m68k-netbsd
  • m68k-none
  • microblaze-linux
  • microblaze-none
  • microblazeel-linux
  • microblazeel-none
  • mips-linux
  • mips-none
  • mips64-linux
  • mips64-none
  • mips64el-linux
  • mipsel-linux
  • mipsel-netbsd
  • mmix-mmixware
  • msp430-none
  • or1k-none
  • powerpc-netbsd
  • powerpc-none
  • powerpc64-linux
  • powerpc64le-linux
  • powerpcle-none
  • riscv32-linux
  • riscv32-netbsd
  • riscv32-none
  • riscv64-linux
  • riscv64-netbsd
  • riscv64-none
  • rx-none
  • s390-linux
  • s390-none
  • s390x-linux
  • s390x-none
  • vc4-none
  • wasm32-wasi
  • wasm64-wasi
  • x86_64-cygwin
  • x86_64-darwin
  • x86_64-freebsd
  • x86_64-genode
  • x86_64-linux
  • x86_64-netbsd
  • x86_64-none
  • x86_64-openbsd
  • x86_64-redox
  • x86_64-solaris
  • x86_64-windows