catlearn (version 0.8)

stsimGCM: Generalized Context Model

Description

Nosofsky's (1984, 2011) Generalized Context Model; an exemplar-based model of categorization.

Usage

stsimGCM(st)

Arguments

st

List of model parameters

Value

A matrix of probabilities for category responses (columns) for each stimulus (rows) presented to the model (e.g. test trials). Stimuli and categories are in the same order as presented to the model in st, see below.

Details

Argument st must be a list containing the following required items: training_items, tr, nCats, nFeat, sensitivity, weights, choice_bias, p, r_metric, mp, and gamma

nCats - integer indicating the number of categories

nFeat - integer indicating the number of stimulus dimensions

tr - the stimuli presented to the model, for which the choice probabilities will be predicted. tr has to be a matrix or dataframe with one row for each stimulus. tr requires the following columns.

x1, x2, … - columns for each dimension carrying the corresponding values (have to be coded as numeric values) for each exemplar (trial) given in the row. Columns have to start with x1 ascending with dimensions …, x2, x3, … at adjacent columns.

tr may have any number of additional columns with any desired name and position, e.g. for readability. As long as the feature columns x1, x2, … are given as defined (i.e. not scattered, across the range of matrix columns), the output is not affected by optional columns.

training_items - all unique exemplars assumed to be stored in memory; has to be a matrix or dataframe with one row for each exemplar. The rownames have to start with 1 in ascending order. training_items requires the following columns:

x1, x2, … - columns for each feature dimension carrying the corresponding values (have to be coded as numeric values) for each exemplar (row). Columns have to start with x1 ascending with dimensions …, x2, x3, … at adjacent columns.

cat1, cat2, … - columns that indicate the category assignment of each exemplar (row). For example, if the exemplar in row 2 belongs to category 1 the corresponding cell of cat1 has to be set to 1, else 0. Columns have to start with cat1 ascending with categories …, cat2, cat3, … at adjacent columns.

mem - (optional) one column that indicates whether an exemplar receives an extra memory weight, yes = 1, no = 0. For each exemplar (row) in the training_items with mem set to 0 the corresponding memory strength parameter is set to 1. When mem for an exemplar is set to 1 the memory strength parameter is set as defined in mp, see below.

training_items may have any number of additional columns with any desired name and position, e.g. for readability. As long as the feature columns x1, x2, … and cat1, cat2, … are given as defined (i.e. not scattered, across the range of matrix columns), the output is not affected by optional columns.

NOTE: The current model can be implemented as a prototype model if the training_items only carry one row for each category representing the values of the corresponding prototypes (e.g. see Minda & Smith, (2011).

mp - memory strength parameter (optional). Can take any numeric value between -Inf and +Inf. The default is 1, i.e. all exemplars have the same memory strength. There are two ways of specifying mp, i.e. either globally or exemplar specific:

When globally setting mp to a single integer, e.g. to 5, then all exemplars in training_items with mem = 1 will receive a memory strength 5 times higher than the memory strengths for the remaining exemplars.

For setting exemplar specific memory strengths mp has to be a vector of length n, where n is the overall number of of exemplars with mem = 1 in the training_items. The order of memory strengths defined in this vector exactly follows their row-wise ascending order of appearence in the training_items. E.g. if there are two exemplars with mem = 1 in the training_items, the first one in row 2 and the second one in row 10, then setting mp to c(3,2) will result in assigning a memory strength of 3 to the first exemplar (in row 2) and a memory strength of 2 to the second exemplar (in row 10). The memory strengths for all other exemplars will be set to 1. See Note 1.

sensitivity - sensitivity parameter c; can take any value between 0 (all exemplars are equally similar) and +infinity (towards being insensitive to large differences). There are two ways of specifying sensitivity, i.e. either globally or exemplar specific: When globally setting sensitivity to a single value, e.g. sensitivity=3, then the same parameter is applied to all exemplars. On the other hand, exemplar specific sensitivity parameters can be used by defining sensitivity as a vector of length n, where n is the number of rows in training_items. The sensitivity vector values then represent the sensitivity parameters for all exemplars in training_items at the corresponding row positions. E.g. if there are 3 exemplars (rows) in training_items, then setting sensitivity to c(1,1,3) assigns sensitivity = 1 to the first two exemplars, and sensitivity = 3 for the third exemplar. See Note 2.

weights - dimensional attention weights. Order corresponds to the definitions of x1, x2, … in tr and training_items. Has to be a vector with length n-1 , where n equals to nFeat dimension weights, e.g. of length 2 when there are three features, leaving out the last dimension. A constraint in the GCM is that all attentional weights sum to 1. Thus, the sum of n-1 weights should be equal to or smaller than 1, too. The last n-th weight then is computed within the model with: 1 - (sum of n-1 feature weights). When setting the weights to 1/nFeat = equal weights. See Note 3.

choice_bias - Category choice biases. Has to be a vector with length n-1, where n equals to nCats category biases, leaving out the last category bias, under the constraint that all biases sum to 1. Order corresponds to the definitions of cat1, cat2 in the training_items. The sum of n-1 choice biases has to be equal to or smaller than 1. Setting the weights to 1/nCats = no choice bias. The bias for the last category then is computed in the model with: 1 - (sum of nCats-1 choice biases). See Note 3.

gamma - decision constant/ response scaling. Can take any value between 0 (towards more probabilistic) and +infinity (towards deterministic choices). Nosofsky (2011) suggests setting gamma higher than 1 when individual participants' data are considered. See Note 2.

r_metric - distance metric. Set to 1 (city-block) or 2 (Euclidean). See Nosofsky (2011), and Note 4, for more details.

p - similarity gradient. Set to 1 (exponential) or 2 (Gaussian). See Nosofsky (2011), for more details.

References

Minda, J. P., & Smith, J. D. (2011). Prototype models of categorization: Basic formulation, predictions, and limitations. Formal approaches in categorization, 40-64.

Navarro, D. J. (2007). On the interaction between exemplar-based concepts and a response scaling process. Journal of Mathematical Psychology, 51(2), 85-98.

Nosofsky, R. M. (1984). Choice, similarity, and the context theory of classification. Journal of Experimental Psychology: Learning, memory, and cognition, 10(1), 104.

Nosofsky, R. M. (2011). The generalized context model: An exemplar model of classification. In Pothos, E.M. & Wills, A.J. Formal approaches in categorization. Cambridge University Press.

Rodrigues, P. M., & Murre, J. M. (2007). Rules-plus-exception tasks: A problem for exemplar models?. Psychonomic Bulletin & Review, 14(4), 640-646.

Tversky, A., & Gati, I. (1982). Similarity, separability, and the triangle inequality. Psychological review, 89(2), 123.

Examples

Run this code
# NOT RUN {
    ## Three Categories with 2 Training Items each, and repeatedly presented
    ## transfer/test items (from nosof94train()). Each item has three 
    ## features with two (binary) values: memory strength (st$mp and 
    ## 'mem' column in st$training_items are optional) is 
    ## equal for all exemplars
    
    st<-list(
        sensitivity = 3,
        weights = c(.2,.3),
        choice_bias = c(1/3),
        gamma = 1,
        mp = 1,
        r_metric = 1,
        p = 1,
        nCats = 2,
        nFeat=3
    )
    
    ## training item definitions 
    st$training_items <- as.data.frame(
        t(matrix(cbind(c(1,0,1,1,1,0,0),c(1,1,0,2,1,0,0),
                       c(0,1,0,5,0,1,0),c(0,0,1,1,0,1,0)),
                 ncol=4, nrow=7,
                 dimnames=list(c("stim","x1", "x2", "x3",
                                 "cat1", "cat2", "mem"),
                               c(1:4)))))
                               
    st$tr <- nosof94train()
    
    ## get the resulting predictions for the test items
    
    ## columns of the output correspond to category numbers as defined
    ## above rows correspond to the column indices of the test_items
    
    stsimGCM(st)

    ## columns of the output correspond to category numbers as defined
    ## above rows correspond to the column indices of the test_items

    ## Example 2

    ## Same (settings) as above, except: memory strength is 5 times higher
    ## for for some exemplars
    st$mp<-5
    
    ## which exemplars?
    ## training item definitions 
    st$training_items <- as.data.frame(
        t(matrix(cbind(c(1,0,1,1,1,0,1),c(1,1,0,2,1,0,0),
                       c(0,1,0,5,0,1,0),c(0,0,1,1,0,1,1)),
                 ncol=4, nrow=7,
                 dimnames=list(c("stim","x1", "x2", "x3",
                                 "cat1", "cat2", "mem"),
                               c(1:4)))))
    ## exemplars in row 1 and 4 will receive a memory strength of 5
    ## get predictions
    stsimGCM(st)

    ## Example 3 
    ## Same (settings) as above, except: memory strength is item specific
    ## for the two exemplars i.e. memory strength boost is not the same 
    ## for both exemplars (3 for the first in row 1, and 5 for the 
    ## second exemplar in row 4)
    st$mp<-c(3,5) 


    ## get predictions
    stsimGCM(st)
# }

Run the code above in your browser using DataLab