============================== Linear Discriminative Learning ============================== Linear Discriminative Learning (LDL) [1]_ was developed against the backgroud of Naive Discriminative Learning (NDL) [2]_. NDL is based on the Rescorla-Wagner learning rule [3]_. The learning rule updates associations between cues (e.g., word forms) and outcomes (e.g., meanings) incrementally, based on cooccurrences of cues and outcomes. Incrementally learned associations can asymptote an equilibrium, where association strengths stay almost constant with (almost) no more updates. Such an equilibrium state can theoretically be estimated without incrementally learning associations. The "endstate-of-learning" of the Rescorla-Wagner learning rule is the Danks equation [4]_. NDL only accepts binary inputs and outputs. Cues or outcomes are present (1) or absent (0). LDL loosenes this constrainty and generalizes NDL so that cues and outcomes can also take real values. For the current implementation, LDL adopts the real-value counterpart of the Danks equation. In other words, LDL estimates the equilibrium state of associations between cues and outcomes at once, without incrementally learning the associations. The method of estimating the equilibrium associations is mathematically equivalent to multivariate regression, where multiple continuous predictors and response variables are accepted. For more detail, see [1]_ and [5]_. To estimate associations (or weight matrices) between cues and outcomes, LDL requires two matrices. One is a C-matrix (i.e., :math:`\mathbf{C}`), which can also be called a form matrix or a cue matrix. :math:`\mathbf{C}` has words as rows and sublexical units (e.g., triphones) as columns. Each row represents a form vector of a word. In the current implementation, each form vector is coded 1 where the triphone is contained in the word and 0 otherwise. With discriminative_lexicon_model, you can create a :math:`\mathbf{C}` from a list of words by using discriminative_lexicon_model.mapping.gen_cmat. .. code-block:: python >>> import discriminative_lexicon_model.mapping as pmap >>> words = ['walk','walked','walks'] >>> cmat = pmap.gen_cmat(words) >>> cmat array([[ True, True, False, False, False, True, False, False, True], [ True, True, True, True, False, False, True, False, True], [ True, True, False, False, True, False, False, True, True]]) Coordinates: * word (word) >> import pandas as pd >>> infl = pd.DataFrame({'Word':['walk','walked','walks'], 'Lemma':['walk','walk','walk'], 'Tense':['PRES','PAST','PRES']}) >>> smat = pmap.gen_smat_sim(infl, dim_size=5) >>> smat.round(2) array([[ 0.75, 1.25, 0.39, -4.41, -0.12], [-1.68, 0.6 , -0. , -3.55, -2.23], [-2.77, 0.71, -0.48, -2.76, 0.15]]) Coordinates: * word (word) >> fmat = pmap.gen_fmat(cmat, smat) >>> fmat.round(2) array([[-0. , -0. , -0. , -0. , -0. ], [-0. , -0. , -0. , -0. , -0. ], [-0.56, 0.2 , -0. , -1.18, -0.74], [-0.56, 0.2 , -0. , -1.18, -0.74], [-1.39, 0.35, -0.24, -1.38, 0.07], [ 0.75, 1.25, 0.39, -4.41, -0.12], [-0.56, 0.2 , -0. , -1.18, -0.74], [-1.39, 0.35, -0.24, -1.38, 0.07], [-0. , -0. , -0. , -0. , -0. ]]) Coordinates: * cues (cues) >> gmat = pmap.gen_gmat(cmat, smat) >>> gmat.round(2) array([[-0.11, -0.11, -0.03, -0.03, -0.27, 0.19, -0.03, -0.27, -0.11], [ 0.06, 0.06, -0.06, -0.06, 0.05, 0.08, -0.06, 0.05, 0.06], [-0.01, -0.01, 0.03, 0.03, -0.08, 0.04, 0.03, -0.08, -0.01], [-0.23, -0.23, -0.01, -0.01, -0.05, -0.17, -0.01, -0.05, -0.23], [ 0.02, 0.02, -0.43, -0.43, 0.29, 0.15, -0.43, 0.29, 0.02]]) Coordinates: * semantics (semantics) >> shat = pmap.gen_shat(cmat=cmat, fmat=fmat) >>> shat.round(2) array([[ 0.75, 1.25, 0.39, -4.41, -0.12], [-1.68, 0.6 , -0. , -3.55, -2.23], [-2.77, 0.71, -0.48, -2.76, 0.15]]) Coordinates: * word (word) >> shat = pmap.gen_shat(cmat=cmat, smat=smat) >>> shat.round(2) array([[ 0.75, 1.25, 0.39, -4.41, -0.12], [-1.68, 0.6 , -0. , -3.55, -2.23], [-2.77, 0.71, -0.48, -2.76, 0.15]]) Coordinates: * word (word) >> chat = pmap.gen_chat(smat=smat, gmat=gmat) >>> chat.round(2) array([[ 1., 1., 0., 0., -0., 1., 0., -0., 1.], [ 1., 1., 1., 1., 0., -0., 1., 0., 1.], [ 1., 1., -0., -0., 1., -0., -0., 1., 1.]]) Coordinates: * word (word) >> chat = pmap.gen_chat(smat=smat, cmat=cmat) >>> chat.round(2) array([[ 1., 1., 0., 0., -0., 1., 0., -0., 1.], [ 1., 1., 1., 1., 0., -0., 1., 0., 1.], [ 1., 1., -0., -0., 1., -0., -0., 1., 1.]]) Coordinates: * word (word)