Description Usage Arguments Value Author(s) See Also Examples
View source: R/RWlearningMatrix.R
Function implementing the Rescorla-Wagner learning.
1 2 3 4 5 6 7 8 9 10 | RWlearningMatrix(
data,
wm = NULL,
alpha = 0.1,
lambda = 1,
beta1 = 0.1,
beta2 = 0.1,
progress = TRUE,
...
)
|
data |
A data frame with columns |
wm |
A weightmatrix of class matrix, or a list with weight matrices. If not provided a new weightmatrix is returned. Note that the cues and outcomes do not necessarily need to be available as cues and outcomes in the weightmatrix: if not present, they will be added. |
alpha |
Learning parameter (scaling both positive and negative evidence adjustments), typically set to 0.1. |
lambda |
Constant constraining the connection strength. |
beta1 |
Learning parameter for positive evidence, typically set to 0.1. |
beta2 |
Learning parameter for negative evidence, typically set to 0.1. |
progress |
Logical: whether or not showing a progress bar (may slow down the process). |
... |
Parameters for the function |
A weightmatrix.
Jacolien van Rij
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 | # load example data:
data(dat)
# add obligatory columns Cues, Outcomes, and Frequency:
dat$Cues <- paste("BG", dat$Shape, dat$Color, sep="_")
dat$Outcomes <- dat$Category
dat$Frequency <- dat$Frequency1
head(dat)
dim(dat)
# now use createTrainingData to sample from the specified frequencies:
train <- createTrainingData(dat)
# this training data can actually be used train network:
wm1 <- RWlearningMatrix(train)
# comparison with a list:
wm2 <- RWlearning(train)
length(wm2)
getWM(wm2)
# in R markdown or knitr reports the progress bar should be turned off:
wm <- RWlearningMatrix(train, progress=FALSE)
# Learning in steps is also possible:
wm <- RWlearningMatrix(train[1:20,])
train[21,c("Cues", "Outcomes")]
wm <- RWlearningMatrix(train[21,], wm=wm)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.