// Copyright 2015 Georg-August-Universität Göttingen, Germany // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. package de.ugoe.cs.cpdp.training; import java.util.HashSet; import java.util.LinkedList; import java.util.List; import java.util.Set; import org.apache.commons.collections4.list.SetUniqueList; import weka.classifiers.AbstractClassifier; import weka.classifiers.Classifier; import weka.core.DenseInstance; import weka.core.Instance; import weka.core.Instances; /** *
* The first parameter is the trainer name, second parameter is class name. All subsequent * parameters are configuration parameters of the algorithms. Cross validation parameters always * come last and are prepended with -CVPARAM *
** XML Configurations for Weka Classifiers: * *
* {@code * ** * * @author Alexander Trautsch */ public class WekaBaggingTraining extends WekaBaseTraining implements ISetWiseTrainingStrategy { /** * the classifier */ private final TraindatasetBagging classifier = new TraindatasetBagging(); /* * (non-Javadoc) * * @see de.ugoe.cs.cpdp.training.WekaBaseTraining#getClassifier() */ @Override public Classifier getClassifier() { return classifier; } /* * (non-Javadoc) * * @see * de.ugoe.cs.cpdp.training.ISetWiseTrainingStrategy#apply(org.apache.commons.collections4.list. * SetUniqueList) */ @Override public void apply(SetUniqueList* * } *
* Helper class for bagging classifiers. *
* * @author Steffen Herbold */ public class TraindatasetBagging extends AbstractClassifier { /** * default serialization ID. */ private static final long serialVersionUID = 1L; /** * internal storage of the training data */ private List* trains a new dataset wise bagging classifier *
* * @param traindataSet * the training data per prodcut * @throws Exception * thrown if an error occurs during the training of the classifiers for any * product */ public void buildClassifier(SetUniqueList