/
README.Rmd
126 lines (87 loc) · 3.21 KB
/
README.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
---
output: github_document
---
<!-- README.md is generated from README.Rmd. Please edit that file -->
```{r, echo = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "tools/"
)
```
sigmoid
=======
[![License](http://img.shields.io/badge/license-GPLv3-brightgreen.svg)](http://www.gnu.org/licenses/gpl-3.0.html)
[![CRAN Version](http://www.r-pkg.org/badges/version/sigmoid)](https://cran.r-project.org/package=sigmoid)
[![Total RStudio Cloud Downloads](http://cranlogs.r-pkg.org/badges/grand-total/sigmoid?color=brightgreen)](https://cran.r-project.org/package=sigmoid)
[![RStudio Cloud Downloads](http://cranlogs.r-pkg.org/badges/sigmoid?color=brightgreen)](https://cran.r-project.org/package=sigmoid)
[![Travis-CI Build Status](https://travis-ci.org/bquast/sigmoid.svg?branch=master)](https://travis-ci.org/bquast/sigmoid)
[![Coverage Status](https://coveralls.io/repos/github/bquast/sigmoid/badge.svg?branch=master)](https://coveralls.io/github/bquast/sigmoid?branch=master)
Several different sigmoid functions are implemented, including a wrapper function, SoftMax preprocessing and inverse functions.
Demonstration
---------------
![sigmoid demonstration](https://github.com/bquast/R-demo-GIFs/blob/master/sigmoid.gif)
Installation
------------
The **stable** version can be installed from [CRAN](https://cran.r-project.org/package=sigmoid) using:
```r
install.packages('sigmoid')
```
The **development** version, to be used **at your peril**, can be installed from [GitHub](http://github.com/bquast/sigmoid) using the `devtools` package.
```r
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**.
```{r}
library(sigmoid)
sigmoid(3)
```
Inputs can also be tensors, such as vectors, matrices, or arrays.
```{r}
sigmoid(-5:5)
sigmoid( matrix(-3:5,nrow=3) ) # etc.
```
The `sigmoid()` function is a wrapper, which by default uses the `logistic()` function, it can also use other methods.
```{r}
sigmoid( -5:5, method='Gompertz' )
```
These functions can also be accessed directly.
```{r}
logistic(1:5)
Gompertz(-1:-5)
```
These mappings are similar but not identical.
```{r sigmoid-shape}
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.
```r
help('sigmoid')
help(package='sigmoid')
```
Additional Information
-----------------------
An overview of the changes is available in the NEWS file.
```r
news(package='sigmoid')
```
There is a dedicated website with information hosted on my [personal website](http://qua.st/).
http://qua.st/sigmoid
Development
-------------
Development takes place on the GitHub page.
http://github.com/bquast/sigmoid
Bugs can be filed on the issues page on GitHub.
https://github.com/bquast/sigmoid/issues