//for multi-task
 public toolbox(dataSet X, List <dataSet> XList, bool train = true)
 {
     if (train)//to train
     {
         _X         = X;
         _XList     = XList;
         _fGene     = new featureGenerator(X);
         _model     = null;
         _modelList = new List <model>();
         for (int i = 0; i < Global.nTask; i++)
         {
             model m = new model(XList[i], _fGene);
             _modelList.Add(m);
         }
         _inf  = new inference(this);
         _grad = new gradient(this);
         initOptimizer();
     }
     else//to test
     {
         _X         = X;
         _XList     = XList;
         _model     = null;
         _modelList = new List <model>();
         for (int i = 0; i < Global.nTask; i++)
         {
             model m = new model(Global.modelDir + i.ToString() + Global.fModel);
             _modelList.Add(m);
         }
         _fGene = new featureGenerator(X);
         _inf   = new inference(this);
         _grad  = new gradient(this);
     }
 }
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;
 }