# 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:
wm <- RWlearningNoOutcomeCompetition(train)
# retrieve trained network:
new <- getWM(wm)
train2 <- createTrainingData(dat)
updateWeightsNoOutcomeCompetition(getValues(train2$Cues[1]),
getValues(train2$Outcomes[1]), wm=new)
# comparison between eta and alpha, beta1, beta2:
check.cues <- c("BG", "car", "red")
new[check.cues,]
tmp1 <- updateWeightsNoOutcomeCompetition(check.cues,
c("vehicle", "animal"), wm=new)
tmp2 <- updateWeightsNoOutcomeCompetition(check.cues,
c("vehicle", "animal"), wm=new, eta=NULL)
tmp3 <- updateWeightsNoOutcomeCompetition(check.cues,
c("vehicle", "animal"), wm=new, beta1=0.2)
tmp4 <- updateWeightsNoOutcomeCompetition(check.cues,
c("vehicle", "animal"), wm=new, eta=NULL, beta1=0.2)
# these two should be the same:
tmp1[check.cues,]
tmp2[check.cues,]
# now we change beta2, but this does not change anything,
# because eta is being used:
tmp3[check.cues,]
# when we turn eta off, beta2 changes the values:
tmp4[check.cues,]
# }
Run the code above in your browser using DataLab