# 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 <- RWlearning(train)
# plot connection weights for cue = 'car':
plotCueWeights(wm, cue="car")
# plot your own labels:
labels <- plotCueWeights(wm, cue="car", add.labels=FALSE)
legend_margin('topright', legend=labels$labels, col=labels$col,
lwd=1, bty='n')
# change color and select outcomes:
out <- getValues(train$Outcomes, unique=TRUE)
out <- out[out != "vehicle"]
labels <- plotCueWeights(wm, cue="car", add.labels=FALSE,
col=alphaPalette(c(1,2), f.seq=rep(.5,length(out))),
select.outcomes=out)
lab2 <- plotCueWeights(wm, cue="car", add.labels=FALSE,
select.outcomes="vehicle", add=TRUE, col=1, lwd=2)
legend_margin('topright', legend=c(labels$labels, "vehicle"),
col=c(labels$col, lab2$col), lwd=c(labels$lwd, lab2$lwd),
lty=c(labels$lty, lab2$lty))
# }
Run the code above in your browser using DataLab