> next up previous contents index
: Kernels dictionaries : Discrete conditional built-in kernels : plCndBellShape   目次   索引

plCndProbTable

Definition 19   Given $\Omega_s=\{X_1,X_2,...,X_n\}$ with order $0(\Omega_s)=m$ and $\Omega_k=\{D_1,D_2,...,D_m\}$ a plCndProbTable on $\Omega=\Omega_s\cup\Omega_k$ represents a set of plProbTables with variable frequency distribution data $\Omega_k$ (see plProbTable definition).

Example 13   Let's define $\Omega_s=\{X_1,X_2\}$, with $X_1,X_2\in [0,3]$ and $\Omega_k=\{D_1,D_2,...,D_9\}$. Define a plCndProbTable on $\Omega=\Omega_s\cup\Omega_k$.

The construction of the variable sets $\Omega_s$ and $\Omega_k$ and the variable values shows as follow

  plIntegerType Tx(1,N);
  plRealType TFrequency(0,1000);

  plArray Omega_s("x",Tx,1,2);
  plArray Omega_k("d",TFrequency,2,N,N);
  
  plValues values(Omega_s^Omega_k);

Note that $\Omega_k$ is a $3\times 3$ dimensional array and that the number of elements (i.e. 9=3*3) is the order of $\Omega_s$. The number of elements on $\Omega_s$ must be equal to the cardinality $m$ of $\Omega_k$. This because the instantiation requires of $m$ values corresponding to the frequency distribution of the $m$ possible values of $\Omega_s$.

The construction of the plCndProbTable is executed by the following code

  plCndProbTable my_cnd_kernel(Omega_s,Omega_k);

Finally the values of $\Omega_k$ used in the $instantiate$ function are read as follow

  int  i,j;
  plFloat v;

  for(i=0;i<N;i++)
    for(j=0;j<N;j++) {
      cout<<"Give me the data "<<i<<","<<j<<": "; cin>>v;      
      values[Omega_k(i,j)]= v;
    }

Lets make the observation that $\Omega_k$ could be defined in many ways. For instance,

  plArray Omega_k("d",TFrequency,1,N*N);

remember that the unique requirement of $\Omega_k$ is to contain $m$ variables. Again, this because a frequency value must be assigned to each of the $m$ possible values of $\Omega_s$. A variable on $\Omega_k$ represents then the frequency of a particular value $\omega_s \in \Omega_s$. Of course if we use the previous definition of Omega_k then we shall read the variable values as follows

  int  i,j;
  plFloat v;

  for(i=0;i<N*N;i++){
      cout<<"Give me the data "<<i<<": "; cin>>v;      
      values[Omega_k(i)]= v;
    }

values[Omega_k(0)] corresponds then to the frequency of x(0,0), values[Omega_k(0)] to that of x(0,1) and so on. That is the values are organized by rows. For dimension higher than two the same principle is applied.


next up previous contents index
: Kernels dictionaries : Discrete conditional built-in kernels : plCndBellShape   目次   索引
Juan-Manuel Ahuactzin 平成17年3月31日