instLabels.addElement(new Double(classes[h]));
}
// convert the training dataset into single-instance dataset
m_ConvertToProp.setWeightMethod(
new SelectedTag(
MultiInstanceToPropositional.WEIGHTMETHOD_1,
MultiInstanceToPropositional.TAGS_WEIGHTMETHOD));
m_ConvertToProp.setInputFormat(train);
train = Filter.useFilter( train, m_ConvertToProp);
train.deleteAttributeAt(0); //remove the bagIndex attribute;
if (m_filterType == FILTER_STANDARDIZE)
m_Filter = new Standardize();
else if (m_filterType == FILTER_NORMALIZE)
m_Filter = new Normalize();
else
m_Filter = null;
if (m_Filter!=null) {
m_Filter.setInputFormat(train);
train = Filter.useFilter(train, m_Filter);
}
if (m_Debug) {
System.out.println("\nIteration History..." );
}
if (getDebug())
System.out.println("\nstart building model ...");
int index;
double sum, max_output;
Vector max_index = new Vector();
Instance inst=null;
int loopNum=0;
do {
loopNum++;
index=-1;
if (m_Debug)
System.out.println("=====================loop: "+loopNum);
//store the previous label information
pre_instLabels=(Vector)instLabels.clone();
// set the proper SMO options in order to build a SVM model
m_SVM = new SVM();
m_SVM.setC(getC());
m_SVM.setKernel(Kernel.makeCopy(getKernel()));
// SVM model do not normalize / standardize the input dataset as the the dataset has already been processed
m_SVM.setFilterType(new SelectedTag(FILTER_NONE, TAGS_FILTER));
m_SVM.buildClassifier(train);
for(int h=0; h<numBags; h++) {//h_th bag
if (classes[h]==1) { //positive bag