// REVIEW: CJCB public InputLayer(DTNode[,][] boostedDTs, int cIter) { int cClass = boostedDTs.GetLength(1); this.cTransforms = cIter * cClass; this.inputTransforms = new InputTransform[this.cTransforms]; this.outputs = new float[this.cTransforms]; for (int i = 0; i < cIter; i++) { for (int j = 0; j < cClass; j++) { this.inputTransforms[i*cClass + j] = new InputTransform(boostedDTs[i, j], i + 1); } } }
public NNModelMSN(NNModelMSN subModel, DTNode[,][] boostedDTs) { int cIter = boostedDTs.GetLength(0); int cClass = boostedDTs.GetLength(1); if (cClass == 1) { if (subModel != null) { this.cNodeLayer = subModel.cNodeLayer; this.cInputs = subModel.cInputs + cIter; this.layers = new Layer[this.cNodeLayer + 1]; //create the input layer this.layers[0] = new InputLayer((InputLayer)subModel.layers[0], boostedDTs, cIter); //create the extended node layers for (int l = 1; l <= this.cNodeLayer; l++) { this.layers[l] = new NodeLayer((NodeLayer)subModel.layers[l], this.layers[l - 1]); } } else { this.cNodeLayer = 1; this.cInputs = cIter; this.layers = new Layer[this.cNodeLayer + 1]; this.layers[0] = new InputLayer(boostedDTs, cIter); this.layers[1] = new NodeLayer(1, this.cInputs, 1); } //add a new layer if necessary if (this.layers[this.cNodeLayer].cOutputs > 1) { this.cNodeLayer++; Layer[] layers = new Layer[this.cNodeLayer]; for (int i = 0; i < this.layers.Length; i++) { layers[i] = this.layers[i]; } this.layers = layers; this.layers[this.cNodeLayer-1] = new NodeLayer(this.cNodeLayer, this.layers[this.cNodeLayer-2].cOutputs, 1); } } else { if (subModel == null) { this.cNodeLayer = 2; this.cInputs = cIter * cClass; this.layers = new Layer[this.cNodeLayer + 1]; this.layers[0] = new InputLayer(boostedDTs, cIter); this.layers[1] = new NodeLayer(1, this.cInputs, cClass);//multiplex layer this.layers[2] = new NodeLayer(2, cClass); //dotproduct node layer } else { throw new Exception("Multiclass sub-mart has not been implemented yet"); } } }