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"); } }
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); } }
public inference(toolbox tb) { _optim = tb.Optim; _fGene = tb.FGene; _grad = tb.Grad; }
public gradient(toolbox tb) { _optim = tb.Optim; _inf = tb.Inf; _fGene = tb.FGene; }