> next up previous contents index
: Joint distribution : Kernels dictionaries : plKernelMap   目次   索引

plKernelTable

Definition 22   A kernel table is kernel dictionary with an array like structure and retrieves an element by random access. In a plKernelTable the variables on $\Omega_k$ must be discrete.



Program 11: A kernel table.

     1  /*=============================================================================
     2   * File           : kernelTable.cpp
     3   *=============================================================================
     4   *
     5   *------------------------- Description ---------------------------------------
     6   * This program constructs a plKernelTable.
     7   *
     8   *-----------------------------------------------------------------------------
     9  */
    10
    11
    12  #include <pl.h>
    13
    14  main()
    15  {
    16    /**********************************************************************
    17       Defining the variable type, set and values
    18    ***********************************************************************/
    19    plIntegerType Tx(1,5);
    20    plRealType    Ty(0,120);
    21
    22    plSymbol x("x",Tx);
    23    plSymbol y("y",Ty);
    24
    25    plValues values(x^y);
    26
    27    /**********************************************************************
    28       Constructing kernel dictionary P( y | x)
    29    ***********************************************************************/
    30
    31    plCUniform Py0(y);
    32    plNormal   Py1(y,60,10);
    33    plNormal   Py3(y,50.5,15.5);
    34    plGamma    Py4(y,70.5,7.2);
    35
    36    plKernelTable Py(y,x);
    37
    38    // Pushing the default kernel
    39    Py.push_default(Py0);
    40
    41    // Pushing the pairs (key, kernel)
    42    values[x] = 1;
    43    Py.push(values,Py1);
    44    cout<<"inserting kernel for x= "<<values[x]<<endl;
    45
    46    values[x] = 3;
    47    Py.push(values,Py3);
    48    cout<<"inserting kernel for x= "<<values[x]<<endl;
    49
    50    values[x] = 4;
    51    Py.push(values,Py4);
    52    cout<<"inserting kernel for x= "<<values[x]<<"\n\n";
    53
    54    // Print the kernel table
    55    cout<<Py<<endl;
    56
    57  }

inserting kernel for x= 1
inserting kernel for x= 3
inserting kernel for x= 4

P(y | x) = plKernelTable {
1 = P(y | x) = plNormal(y,60,10)
2 = [Default]
3 = P(y | x) = plNormal(y,50.5,15.5)
4 = P(y | x) = plGamma(y, 70.5, 7.2, 0)
5 = [Default]
Default =  0.00833333
}

図: Representation of the kerne table at Example [*]
\begin{figure}\begin{center}
\psfig{figure=kernelTable.eps, width= 6cm}
\end{center}
\end{figure}

The access and structure representation are the main differences between a plKernelMap and a plKernelTable

Undoubtedly the choice of using a plKernelMap or a plKernelTable depends on the application. However, in a general way a plKernelMap often reduce the requirements of space whereas a plKernelTable has smaller access time.

A plKernelMap is generally used when a sparse dictionary of kernels is required: the numbers of keys (i.e. the size of $\Omega_k$) is big and a large proportion of them leads to a default kernel. A plKernelTable always requires of space proportional to the number of keys. Nevertheless, its access mode is faster that that of a plKernelMap. A plKernelTable is then generally used when a dense dictionary of kernel is required: few of the keys lead to the default kernel.


next up previous contents index
: Joint distribution : Kernels dictionaries : plKernelMap   目次   索引
Juan-Manuel Ahuactzin 平成17年3月31日