Ignore:
Timestamp:
07/18/16 12:26:03 (8 years ago)
Author:
sherbold
Message:
  • code documentation and formatting
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/CrossPare/src/de/ugoe/cs/cpdp/training/WekaLocalEMTraining.java

    r99 r135  
    3333 
    3434/** 
    35  * WekaLocalEMTraining 
     35 * <p> 
     36 * Local Trainer with EM Clustering for data partitioning. Currently supports only EM Clustering. 
     37 * </p> 
     38 * <ol> 
     39 * <li>Cluster training data</li> 
     40 * <li>for each cluster train a classifier with training data from cluster</li> 
     41 * <li>match test data instance to a cluster, then classify with classifier from the cluster</li> 
     42 * </ol> 
    3643 *  
    37  * Local Trainer with EM Clustering for data partitioning. Currently supports only EM Clustering. 
     44 * XML configuration: 
    3845 *  
    39  * 1. Cluster training data 2. for each cluster train a classifier with training data from cluster 
    40  * 3. match test data instance to a cluster, then classify with classifier from the cluster 
    41  *  
    42  * XML configuration: <!-- because of clustering --> <preprocessor name="Normalization" param=""/> 
    43  *  
    44  * <!-- cluster trainer --> <trainer name="WekaLocalEMTraining" 
    45  * param="NaiveBayes weka.classifiers.bayes.NaiveBayes" /> 
     46 * <pre> 
     47 * {@code 
     48 * <trainer name="WekaLocalEMTraining" param="NaiveBayes weka.classifiers.bayes.NaiveBayes" /> 
     49 * } 
     50 * </pre> 
    4651 */ 
    4752public class WekaLocalEMTraining extends WekaBaseTraining implements ITrainingStrategy { 
    4853 
     54    /** 
     55     * the classifier 
     56     */ 
    4957    private final TraindatasetCluster classifier = new TraindatasetCluster(); 
    5058 
     59    /* 
     60     * (non-Javadoc) 
     61     *  
     62     * @see de.ugoe.cs.cpdp.training.WekaBaseTraining#getClassifier() 
     63     */ 
    5164    @Override 
    5265    public Classifier getClassifier() { 
     
    5467    } 
    5568 
     69    /* 
     70     * (non-Javadoc) 
     71     *  
     72     * @see de.ugoe.cs.cpdp.training.ITrainingStrategy#apply(weka.core.Instances) 
     73     */ 
    5674    @Override 
    5775    public void apply(Instances traindata) { 
     
    6482    } 
    6583 
     84    /** 
     85     * <p> 
     86     * Weka classifier for the local model with EM clustering. 
     87     * </p> 
     88     *  
     89     * @author Alexander Trautsch 
     90     */ 
    6691    public class TraindatasetCluster extends AbstractClassifier { 
    6792 
     93        /** 
     94         * default serializtion ID 
     95         */ 
    6896        private static final long serialVersionUID = 1L; 
    6997 
     98        /** 
     99         * EM clusterer used 
     100         */ 
    70101        private EM clusterer = null; 
    71102 
     103        /** 
     104         * classifiers for each cluster 
     105         */ 
    72106        private HashMap<Integer, Classifier> cclassifier; 
     107 
     108        /** 
     109         * training data for each cluster 
     110         */ 
    73111        private HashMap<Integer, Instances> ctraindata; 
    74112 
     
    107145        } 
    108146 
     147        /* 
     148         * (non-Javadoc) 
     149         *  
     150         * @see weka.classifiers.AbstractClassifier#classifyInstance(weka.core.Instance) 
     151         */ 
    109152        @Override 
    110153        public double classifyInstance(Instance instance) { 
     
    139182        } 
    140183 
     184        /* 
     185         * (non-Javadoc) 
     186         *  
     187         * @see weka.classifiers.Classifier#buildClassifier(weka.core.Instances) 
     188         */ 
    141189        @Override 
    142190        public void buildClassifier(Instances traindata) throws Exception { 
Note: See TracChangeset for help on using the changeset viewer.