# NOT RUN {
# 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)
# }
Run the code above in your browser using DataLab