Esempio n. 1
0
 public model(dataSet X, featureGenerator fGen)
 {
     _nTag = X.NTag;
     //default value is 0
     if (Global.random == 0)
     {
         _w = new float[fGen.NCompleteFeature];
     }
     else if (Global.random == 1)
     {
         List <float> randList = randomDoubleTool.getRandomList_float(fGen.NCompleteFeature);
         _w = randList.ToArray();
     }
     else
     {
         throw new Exception("error");
     }
 }
Esempio n. 2
0
 public toolbox(dataSet X, bool train = true)
 {
     if (train)//to train
     {
         _X     = X;
         _fGene = new featureGenerator(X);
         _model = new model(X, _fGene);
         _inf   = new inference(this);
         _grad  = new gradient(this);
         initOptimizer();
     }
     else//to test
     {
         _X     = X;
         _model = new model(Global.fModel);
         _fGene = new featureGenerator(X);
         _inf   = new inference(this);
         _grad  = new gradient(this);
     }
 }
Esempio n. 3
0
 public inference(toolbox tb)
 {
     _optim = tb.Optim;
     _fGene = tb.FGene;
     _grad  = tb.Grad;
 }
Esempio n. 4
0
 public gradient(toolbox tb)
 {
     _optim = tb.Optim;
     _inf   = tb.Inf;
     _fGene = tb.FGene;
 }