stsimGCM: Generalized Context Model

Description Usage Arguments Details Value Note Author(s) References Examples

View source: R/stsimGCM.R

Description

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

Usage

1
  stsimGCM(st)

Arguments

st

List of model parameters

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.

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.

Note

1. Please note that setting mp = 1 or e.g. mp = 5 globally, will yield identical response probabilities. Crucially, memory strength is indifferent from the category choice bias parameter, if (and only if) mp's vary between categories, without varying within categories. Thus, the memory strength parameter can therefore be interpreted in terms of an exemplar choice bias (potentially related to categorization accuracy). In addition, if exemplar specific mp's are assigned during parameter fitting, one might want to calculate the natural log of the corresponding estimates, enabling direct comparisons between mp's indicating different directions, e.g. -log(.5) = log(2), for loss and gain, respectively, which are equal regarding their extent into different directions.

2. Theoretically, increasing global sensitivity indicates that categorization mainly relies on the most similar exemplars, usually making choices less probabilistic. Thus sensitivity c is likely to be correlated with gamma. See Navarro (2007) for a detailed discussion. However, it is possible to assume exemplar specific sensitivities, or specificity. Then, exemplars with lower sensitivity parameters will have a stronger impact on stimulus similarity and thus categorization behavior for stimuli. See Rodrigues & Murre (2007) for a related study.

3. Setting only the n-1 instead of all n feature weights (or bias parameters) eases model fitting procedures, in which the last weight always is a linear combination of the n-1 weights.

4. See Tversky & Gati (1982) for further info on r. In brief summary, r=2 (usually termed Euclidean), then a large difference on only one feature outweighs small differences on all features. In contrast, if r=1 (usually termed City-Block or Manhattan distance) both aspects contribute to an equal extent to the distance. Thus, r = 2 comes with the assumption that small differences in all features may be less recognized, than a large noticable differences on one feature, which may be depend on confusability of the stimuli or on the nature of the given task domain (perceptual or abstract).

Author(s)

Rene Schlegelmilch, Andy Wills

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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
    ## 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)

catlearn documentation built on May 2, 2019, 4:41 p.m.