weights::weights(hiddenLayer hL, outputLayer oL) { wType = 1; numLayerOne = hL.getNumHidden(); numLayerTwo = oL.getNumOutput(); weightArray = new(double*[numLayerOne + 1]); for (int i = 0; i <= numLayerOne; i++) { weightArray[i] = new(double[numLayerTwo + 1]); for (int j = 0; j <= numLayerTwo; j++) weightArray[i][j] = 0; } initialiseWeights(numLayerTwo); }
weights::weights(inputLayer iL, hiddenLayer hL) { //For the weight update phase wType = 0; numLayerOne = iL.getInputs(); numLayerTwo = hL.getNumHidden(); weightArray = new(double*[numLayerOne + 1]); for (int i = 0; i <= numLayerOne; i++) { weightArray[i] = new(double[numLayerTwo + 1]); for (int j = 0; j <= numLayerTwo; j++) weightArray[i][j] = 0; } //Weights need to be initialise here. initialiseWeights(numLayerOne); }
void Instances::buildNominalAtts(WrapDataSource *_source) { //throw and exception if all the attributes are not nominal vector<EncodedAttributeInfo *> original_atts = _source->codedAttributes(); vector<AbstractAtt *> attributes(original_atts.size()); initialiseWeights(attributes.size()); //m_type = original_atts[0]->bitStreamAt(0)->Type(); BitStreamInfo * _info = original_atts[0]->vBitStreams()[0]; m_type = _info->Type(); for (size_t i = 0 ; i < attributes.size(); i++) { if(original_atts[i]->attributeType() == MULTICAT_VAL) { attributes[i] = new NominalAttribute(m_weights[i],getDistinctValues(original_atts[i])); attributes[i]->name(original_atts[i]->attributeName()); } } m_attributes = attributes; }