Learn R Programming

edl (version 1.1)

activationsCueSet: Calculate the change in activation for a specific cue or set of cues.

Description

Calculate the change in activation for a specific cue or set of cues for all outcomes (or a subset) in the weightmatrices.

Usage

activationsCueSet(
  wmlist,
  cueset,
  split = "_",
  select.outcomes = NULL,
  init.value = 0,
  normalize = FALSE
)

Arguments

wmlist

A list with weightmatrices, generated by RWlearning or updateWeights, or a single weightmatrix (matrix).

cueset

String, specifying the cue set for which to calculate change in activation.

split

String, separator between cues and/or outcomes.

select.outcomes

Optional selection of outcomes to limit (or expand) the number of activations that are returned. The value of NULL (default) will return all activations (for each outcome in wmlist). Note that specified values that are not in the weightmatrix will return the initial value without error or warning. Please use getValues for returning all outcomes in the data.

init.value

Value of activations for non-existing connections. Typically set to 0.

normalize

Logical: whether or not the activation is normalized by dividing the total activation by the number of cues. Default is FALSE. If set to TRUE, the activation reflects the average activation per cue.

Value

List of data frames. For each cueset defined in cueset, a dataframe of activation values is provided. These are returned as a list, with the cuesets as names.

Notes

The outcomes are selected based on the weightmatrices, and not necessarily all outcomes present in the training data.

See Also

getWeightsByCue, getWeightsByOutcome

Other functions for calculating activations: activationsEvents(), activationsMatrix(), activationsOutcomes(), getActivations()

Examples

Run this code
# 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)

# now use createTrainingData to sample from the specified frequencies: 
train <- createTrainingData(dat)
head(train)

# this training data can actually be used train network:
wm <- RWlearning(train)

# Now we calculate the activations for all outcomes
# per event:
activations <- activationsCueSet(wm, cueset="BG_bicycle_red")
names(activations)
head(activations[[1]])

# plot:
a1 <- activations[[1]]
emptyPlot(nrow(a1), range(a1),
    xlab="Learning events", ylab="Activations",
    xmark=TRUE, ymark=TRUE, las=1)
for(i in 1:ncol(a1)){
    lines(a1[,i], col=i, lty=i)
}
legend_margin('topleft', legend=colnames(a1),
    col=1:ncol(a1), lty=1:ncol(a1),
    bty='n', cex=.75)

# }

Run the code above in your browser using DataLab