Changeset e9c0ec3 in tol for tol_tests


Ignore:
Timestamp:
Oct 23, 2009, 7:47:53 AM (17 years ago)
Author:
Víctor de Buen <vdebuen@…>
Branches:
1941-docker-image-to-test, devel, master
Children:
2049a4a3
Parents:
c9971f2
Message:

Enhancement of signification of some components as missing values and quality measurement

git-svn-id: ​https://www.tol-project.org/svn/tolp/trunk@1555 be4846ae-f051-483a-831f-b64e7d08527f

Location:
tol_tests/tol/BSR
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • tol_tests/tol/BSR/test_02/def.tol

    rc9971f2 re9c0ec3  
    2727
    2828//Number of variables of each observational node
    29 Real n  = IntRand(10,10);
     29Real n  = IntRand(20,20);
    3030//Data length of each observational node
    31 Real m  = IntRand(300,300);
     31Real m  = IntRand(200,200);
    3232//Number of observational nodes
    3333Real K1 = IntRand(4,4);
    … …  
    125125  });
    126126  //Input matrix
    127   Matrix aux = Rand(m,n,-1,1);
    128   Matrix X = IfMat(LT(Abs(aux),Rand(m,n,0.5,0.5)),Rand(m,n,0,0),aux);
     127  Matrix aux = Group("ConcatColumns",For(1,n,Matrix(Real j)
     128  {
     129    Real avr = Rand(-10, 10);
     130    Real sig = Rand(0.1, 0.8);
     131    Gaussian(m,1,avr,sig)
     132  }));
     133  Matrix X = IfMat(LT(Abs(Rand(m,n,-2,2)),Rand(m,n,0.5,0.5)),
     134     Rand(m,n,0,0),aux);
    129135  //Real beta block
    130136  Matrix b = SetCol(For(1,n,Real(Real h)
    … …  
    301307  //omitidos sin prior
    302308  Real rnd = IntRand(3,4);
     309  Real nu = value*Rand(0.8,1.2);
    303310  Text prior = Case
    304311  (
    … …  
    311318      Real min   = If(value>=0, 0, 10*value);
    312319      Real max   = If(value<=0, 0, 10*value);
    313       "? <- "<<(value*Rand(0.5,2))+"\n"+
     320      "? <- "<<nu+"\n"+
    314321      " ~ Uniform("<<min+","<<max+")"
    315322    },
    … …  
    317324    {
    318325      Real sigma2 = ((value)/2)^2;
    319       "? ~ Normal("<<(value*Rand(0.8,1.2))+","<<sigma2+")"
     326      "? ~ Normal("<<nu+","<<sigma2+")"
    320327    },
    321328    rnd==4,
    … …  
    324331      Real min   = If(value>=0, 0, 10*value);
    325332      Real max   = If(value<=0, 0, 10*value);
    326       "? ~ TruncatedNormal("<<(value*Rand(0.8,1.2))+","<<sigma2+","<<min+","<<max+")"
     333      "? ~ TruncatedNormal("<<nu+","<<sigma2+","<<min+","<<max+")"
    327334    }
    328335  );
    329   Eval(id+"=[[ id, varIdx, equIdx, prior]]")
     336  Eval(id+"=[[ id, varIdx, equIdx, prior, value, nu]]")
    330337});
    331338Real If(MissInp, SetIndexByName(inputMissing));
    … …  
    356363  });
    357364  Real rnd = IntRand(1,4);
     365  Real nu = value*Rand(0.8,1.2);
    358366  Text prior = Case
    359367  (
    360368    rnd==1,
    361369    {
    362       "? <- "<<(value*Rand(0.5,2))
     370      "? <- "<<(value*Rand(0.8,1.2))
    363371    },
    364372    rnd==2,
    … …  
    366374      Real min   = If(value>=0, 0, 10*value);
    367375      Real max   = If(value<=0, 0, 10*value);
    368       "? <- "<<(value*Rand(0.5,2))+"\n"+
     376      "? <- "<<nu+"\n"+
    369377      " ~ Uniform("<<min+","<<max+")"
    370378    },
    … …  
    372380    {
    373381      Real sigma2 = ((value)/2)^2;
    374       "? ~ Normal("<<(value*Rand(0.8,1.2))+","<<sigma2+")"
     382      "? ~ Normal("<<nu+","<<sigma2+")"
    375383    },
    376384    rnd==4,
    … …  
    379387      Real min   = If(value>=0, 0, 10*value);
    380388      Real max   = If(value<=0, 0, 10*value);
    381       "? ~ TruncatedNormal("<<(value*Rand(0.8,1.2))+","<<sigma2+","<<min+","<<max+")"
     389      "? ~ TruncatedNormal("<<nu+","<<sigma2+","<<min+","<<max+")"
    382390    }
    383391  );
    384392  Real varIdx=1;
    385   Eval(id+"=[[ id, varIdx, equIdx, prior]]")
     393  Eval(id+"=[[ id, varIdx, equIdx, prior, value, nu]]")
    386394});
    387395Real If(MissOut, SetIndexByName(outputMissing));
    … …  
    463471  "\n"
    464472  "////////////////////////////////////////////////////////////////////////////////\n"
    465   "// Regression NOise Declarations Normal(0,sigma^2)\n"
     473  "// Regression Noise Declarations Normal(0,sigma^2)\n"
    466474  "////////////////////////////////////////////////////////////////////////////////\n"
    467475  "\n"
    … …  
    638646Matrix _inpMis= If(!MissInp,Rand(0,1,0,0),
    639647{
    640   Matrix SetMat(Set Extract(bsr.parsed->InputMissingBlock,6))
     648  Matrix SetMat(Set Extract(inputMissing,5))
    641649});
    642650Matrix _outMis= If(!MissOut,Rand(0,1,0,0),
    643   SetMat(Set Extract(bsr.parsed->OutputMissingBlock,6)));
     651  SetMat(Set Extract(outputMissing,5)));
    644652
    645653Real ok.Y = (VMatMax(Abs(bsr.parsed::Y-Y))+10)==10;
  • tol_tests/tol/BSR/test_02/test.tol

    rc9971f2 re9c0ec3  
    5555  BysMcmc::@Notifier::Null(0));
    5656
    57 
    5857//Real cycler::initialize(0);
    5958
    6059BysMcmc::@Estimation estim = BysMcmc::@Estimation::New(cycler);
    61 
    6260Real estim::Run(0);
    63 
    64 /* */
    6561Struct @CompareStruct
    6662{
    … …  
    8278    mod::_beta <<
    8379    mod::_variance <<
    84     mod::_inpMis <<
    85     mod::_outMis;
     80    mod::_outMis <<
     81    mod::_inpMis ;
    8682  For(1,Card(estim::report::colNames), Set(Real k)
    8783  {
    … …  
    122118    Matrix Residuals.Estim = est::noise;
    123119    Matrix Residuals.Cmp = Residuals | Residuals.Estim;
     120    Matrix Filter = ((mod::obsNodes)[nu_node])::X*
     121                    ((mod::obsNodes)[nu_node])::b;
     122    Matrix Filter.Estim = est::filter.full;
     123    Matrix Filter.Cmp = Filter | Filter.Estim;
    124124    Matrix Output = ((mod::obsNodes)[nu_node])::Y;
    125125    Matrix Output.Estim = est::output.full;
  • tol_tests/tol/BSR/test_03/def.tol

    rc9971f2 re9c0ec3  
    2929
    3030//Number of variables of each observational node
    31 Real n = IntRand(2,3);
     31Real n = IntRand(20,30);
    3232Real S = 7;
    3333//Data length of each observational node
    34 Real m  = IntRand(20,50);
     34Real m  = IntRand(300,600);
    3535//Number of observational nodes
    36 Real K1 = IntRand(2,3);
     36Real K1 = IntRand(2,4);
    3737//
    3838Real enableARMA = true;
    3939//Regular AR Degree
    40 Real p1 = enableARMA*IntRand(0,2);
     40Real p1 = enableARMA*IntRand(0,1);
    4141//Seasonal AR Degree
    4242Real pS = enableARMA*IntRand(1,1);
    4343//Regular AR Degree
    44 Real q1 = enableARMA*IntRand(0,Max(0,2-p1));
     44Real q1 = enableARMA*IntRand(0,Max(0,1-p1));
    4545//Seasonal AR Degree
    4646Real qS = enableARMA*0*IntRand(0,Max(0,1-pS));
    … …  
    128128  });
    129129  //Input matrix
    130   Matrix aux = Rand(m,n,-1,1);
    131   Matrix X = IfMat(LT(Abs(aux),Rand(m,n,0.5,0.5)),Rand(m,n,0,0),aux);
     130  Matrix aux = Group("ConcatColumns",For(1,n,Matrix(Real j)
     131  {
     132    Real avr = Rand(-10, 10);
     133    Real sig = Rand(0.1, 0.8);
     134    Gaussian(m,1,avr,sig)
     135  }));
     136  Matrix X = IfMat(LT(Abs(Rand(m,n,-2,2)),Rand(m,n,0.5,0.5)),
     137     Rand(m,n,0,0),aux);
    132138  //Real beta block
    133139  Matrix b = SetCol(For(1,n,Real(Real h)
    … …  
    137143  //Standard deviation
    138144  Real s = Rand(0.50,0.90);
    139   Polyn ar1 = RandStationary(p1);
    140   Polyn arS = RandStationary(pS,S);
    141   Polyn ma1 = RandStationary(q1);
    142   Polyn maS = RandStationary(qS,S);
     145  Polyn ar1 = If(p1,1-Rand(-0.95,0.95)*B,1);
     146  Polyn arS = If(pS,1-Rand(-0.95,0.95)*B^S,1);
     147  Polyn ma1 = If(q1,1-Rand(-0.95,0.95)*B,1);
     148  Polyn maS = If(qS,1-Rand(-0.95,0.95)*B^S,1);
    143149  Polyn dif1 = (1-B)^If(Coef(ma1,1)<-0.9,1,0);
    144150  Polyn difS = (1-B^S)^If(Coef(maS,1)<-0.9,1,0);
    … …  
    345351  //omitidos sin prior
    346352  Real rnd = IntRand(3,4);
     353  Real nu = value*Rand(0.8,1.2);
    347354  Text prior = Case
    348355  (
    … …  
    355362      Real min   = If(value>=0, 0, 10*value);
    356363      Real max   = If(value<=0, 0, 10*value);
    357       "? <- "<<(value*Rand(0.5,2))+"\n"+
     364      "? <- "<<nu+"\n"+
    358365      " ~ Uniform("<<min+","<<max+")"
    359366    },
    … …  
    361368    {
    362369      Real sigma2 = ((value)/2)^2;
    363       "? ~ Normal("<<(value*Rand(0.8,1.2))+","<<sigma2+")"
     370      "? ~ Normal("<<nu+","<<sigma2+")"
    364371    },
    365372    rnd==4,
    … …  
    368375      Real min   = If(value>=0, 0, 10*value);
    369376      Real max   = If(value<=0, 0, 10*value);
    370       "? ~ TruncatedNormal("<<(value*Rand(0.8,1.2))+","<<sigma2+","<<min+","<<max+")"
     377      "? ~ TruncatedNormal("<<nu+","<<sigma2+","<<min+","<<max+")"
    371378    }
    372379  );
    373   Eval(id+"=[[ id, varIdx, equIdx, prior]]")
     380  Eval(id+"=[[ id, varIdx, equIdx, prior, value, nu]]")
    374381});
    375382Real If(MissInp, SetIndexByName(inputMissing));
    … …  
    400407  });
    401408  Real rnd = IntRand(1,4);
     409  Real nu = value*Rand(0.8,1.2);
    402410  Text prior = Case
    403411  (
    404412    rnd==1,
    405413    {
    406       "? <- "<<(value*Rand(0.5,2))
     414      "? <- "<<(value*Rand(0.8,1.2))
    407415    },
    408416    rnd==2,
    … …  
    410418      Real min   = If(value>=0, 0, 10*value);
    411419      Real max   = If(value<=0, 0, 10*value);
    412       "? <- "<<(value*Rand(0.5,2))+"\n"+
     420      "? <- "<<nu+"\n"+
    413421      " ~ Uniform("<<min+","<<max+")"
    414422    },
    … …  
    416424    {
    417425      Real sigma2 = ((value)/2)^2;
    418       "? ~ Normal("<<(value*Rand(0.8,1.2))+","<<sigma2+")"
     426      "? ~ Normal("<<nu+","<<sigma2+")"
    419427    },
    420428    rnd==4,
    … …  
    423431      Real min   = If(value>=0, 0, 10*value);
    424432      Real max   = If(value<=0, 0, 10*value);
    425       "? ~ TruncatedNormal("<<(value*Rand(0.8,1.2))+","<<sigma2+","<<min+","<<max+")"
     433      "? ~ TruncatedNormal("<<nu+","<<sigma2+","<<min+","<<max+")"
    426434    }
    427435  );
    428436  Real varIdx=1;
    429   Eval(id+"=[[ id, varIdx, equIdx, prior]]")
     437  Eval(id+"=[[ id, varIdx, equIdx, prior, value, nu]]")
    430438});
    431439Real If(MissOut, SetIndexByName(outputMissing));
    … …  
    686694Matrix _inpMis= If(!MissInp,Rand(0,1,0,0),
    687695{
    688   Matrix SetMat(Set Extract(bsr.parsed->InputMissingBlock,6))
     696  Matrix SetMat(Set Extract(inputMissing,5))
    689697});
    690698Matrix _outMis= If(!MissOut,Rand(0,1,0,0),
    691   SetMat(Set Extract(bsr.parsed->OutputMissingBlock,6)));
     699  SetMat(Set Extract(outputMissing,5)));
    692700
    693701Real ok.Y = (VMatMax(Abs(bsr.parsed::Y-Y))+10)==10;
  • tol_tests/tol/BSR/test_03/test.tol

    rc9971f2 re9c0ec3  
    8181    mod::_beta <<
    8282    mod::_variance <<
    83     mod::_arma <<
    84     mod::_inpMis <<
    85     mod::_outMis;
     83    mod::_arma  <<
     84    mod::_outMis <<
     85    mod::_inpMis;
    8686  For(1,Card(estim::report::colNames), Set(Real k)
    8787  {
  • tol_tests/tol/BSR/test_10/test.tol

    rc9971f2 re9c0ec3  
    2020
    2121//Random seed setting
    22 Real PutRandomSeed(1610450658);
     22Real PutRandomSeed(0);
    2323Real rndSeed = GetRandomSeed(0);
    2424WriteLn("Current Random Seed = "<<rndSeed);
  • tol_tests/tol/BSR/test_13/test.tol

    rc9971f2 re9c0ec3  
    144144      m->Row+new.obs.length-old.obs.length,
    145145      m->Col,
    146       m->Prior,
     146      "None",
    147147      m->Nu,
    148       m->Sigma2,
    149       m->MinBound,
    150       m->MaxBound)
     148      +1/0,
     149      -1/0,
     150      +1/0)
    151151  })
    152152};
  • tol_tests/tol/BSR/test_15/test.tol

    rc9971f2 re9c0ec3  
    1111
    1212Real numErr0 = Copy(NError);
     13
     14//Random seed setting
     15Real PutRandomSeed(0);
     16Real rndSeed = GetRandomSeed(0);
     17WriteLn("Current Random Seed = "<<rndSeed);
    1318
    1419BysMcmc::@Config bsr.config =
    … …  
    6873Set MissingBlk = Select(recover::_.colNames, Real(Text param)
    6974{
    70    If(!TextBeginWith(param,"MissingBlk::"),0,Rand(0,1)<.98)
     75   If(!TextBeginWith(param,"MissingBlk::"),0,Rand(0,1)<.90)
    7176});
    7277
  • tol_tests/tol/BSR/test_16/test.tol

    rc9971f2 re9c0ec3  
    4040{
    4141   If(!TextBeginWith(param,"Node")|
    42        TextEndAt(param,"_Sigma2"),0,Rand(0,1)<0.98)
     42       TextEndAt(param,"_Sigma2"),0,Rand(0,1)<0.95)
    4343});
    4444
    4545Set MissingBlk = Select(recover::_.colNames, Real(Text param)
    4646{
    47    If(!TextBeginWith(param,"MissInp."),0,Rand(0,1)<0.98)
     47   If(!TextBeginWith(param,"MissInp."),0,Rand(0,1)<0.50)
    4848});
    4949
    5050Set SigmaBlk = Select(recover::_.colNames, Real(Text param)
    5151{
    52    If(!TextEndAt(param,"_Sigma2"),0,Rand(0,1)<0.98)
     52   If(!TextEndAt(param,"_Sigma2"),0,Rand(0,1)<0.95)
    5353});
    5454
    5555Set ArimaBlk = Select(recover::_.colNames, Real(Text param)
    5656{
    57    If(!TextBeginWith(param,"ArmaBlk"),0,Rand(0,1)<.98)
     57   If(!TextBeginWith(param,"ArmaBlk"),0,Rand(0,1)<0.50)
    5858});
    5959
Note: See TracChangeset for help on using the changeset viewer.