Changeset 44 for trunk/CrossPare/src/de


Ignore:
Timestamp:
11/17/15 20:42:08 (9 years ago)
Author:
atrautsch
Message:

metric matching hinzu

Location:
trunk/CrossPare/src/de/ugoe/cs/cpdp
Files:
2 added
4 edited

Legend:

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

    r41 r44  
    1 // Copyright 2015 Georg-August-Universität Göttingen, Germany 
     1// Copyright 2015 Georg-August-Universit�t G�ttingen, Germany 
    22// 
    33//   Licensed under the Apache License, Version 2.0 (the "License"); 
     
    4040import de.ugoe.cs.cpdp.eval.IEvaluationStrategy; 
    4141import de.ugoe.cs.cpdp.loader.IVersionLoader; 
     42import de.ugoe.cs.cpdp.training.ISetWiseTestdataAwareTrainingStrategy; 
    4243import de.ugoe.cs.cpdp.training.ISetWiseTrainingStrategy; 
    4344import de.ugoe.cs.cpdp.training.ITrainingStrategy; 
     
    114115 
    115116    /** 
     117     * setwise testdata aware trainers, i.e., trainers that require the selected training data to be separate from 
     118     * each other and the current testdata  
     119     */ 
     120    private List<ISetWiseTestdataAwareTrainingStrategy> setwiseTestdataAwareTrainers; 
     121     
     122    /** 
    116123     * data processors that are applied before the pointwise data selection 
    117124     */ 
     
    178185        setwisepostprocessors = new LinkedList<>(); 
    179186        setwiseTrainers = new LinkedList<>(); 
     187        setwiseTestdataAwareTrainers = new LinkedList<>(); 
    180188        preprocessors = new LinkedList<>(); 
    181189        pointwiseselectors = new LinkedList<>(); 
     
    324332    } 
    325333 
     334    /** 
     335     * returns the setwise training algorithms 
     336     *  
     337     * @return setwise training algorithms 
     338     */ 
     339    public List<ISetWiseTestdataAwareTrainingStrategy> getSetWiseTestdataAwareTrainers() { 
     340        return setwiseTestdataAwareTrainers; 
     341    } 
     342     
    326343    /** 
    327344     * returns the processors applied before the pointwise data selection 
     
    465482                trainer.setParameter(attributes.getValue("param")); 
    466483                setwiseTrainers.add(trainer); 
     484            } 
     485            else if (qName.equals("setwisetestdataawaretrainer")) { 
     486                final ISetWiseTestdataAwareTrainingStrategy trainer = 
     487                    (ISetWiseTestdataAwareTrainingStrategy) Class.forName("de.ugoe.cs.cpdp.training." + 
     488                                                                 attributes.getValue("name")) 
     489                        .newInstance(); 
     490                trainer.setParameter(attributes.getValue("param")); 
     491                setwiseTestdataAwareTrainers.add(trainer); 
    467492            } 
    468493            else if (qName.equals("preprocessor")) { 
     
    566591        setwisepostprocessors.addAll(other.setwisepostprocessors); 
    567592        setwiseTrainers.addAll(other.setwiseTrainers); 
     593        setwiseTestdataAwareTrainers.addAll(other.setwiseTestdataAwareTrainers); 
    568594        preprocessors.addAll(other.preprocessors); 
    569595        pointwiseselectors.addAll(other.pointwiseselectors); 
     
    609635            StringTools.ENDLINE); 
    610636        builder.append("Setwise trainers: " + setwiseTrainers.toString() + StringTools.ENDLINE); 
     637        builder.append("Setwise Testdata Aware trainers: " + setwiseTestdataAwareTrainers.toString() + StringTools.ENDLINE); 
    611638        builder 
    612639            .append("Pointwise preprocessors: " + preprocessors.toString() + StringTools.ENDLINE); 
  • trunk/CrossPare/src/de/ugoe/cs/cpdp/eval/AbstractWekaEvaluation.java

    r41 r44  
    123123                output.append(",tn_" + ((IWekaCompatibleTrainer) trainer).getName()); 
    124124                output.append(",fp_" + ((IWekaCompatibleTrainer) trainer).getName()); 
    125                 output.append(",trainerror_" + ((IWekaCompatibleTrainer) trainer).getName()); 
    126                 output.append(",trainrecall_" + ((IWekaCompatibleTrainer) trainer).getName()); 
    127                 output.append(",trainprecision_" + ((IWekaCompatibleTrainer) trainer).getName()); 
    128                 output.append(",trainsuccHe_" + ((IWekaCompatibleTrainer) trainer).getName()); 
     125                //output.append(",trainerror_" + ((IWekaCompatibleTrainer) trainer).getName()); 
     126                //output.append(",trainrecall_" + ((IWekaCompatibleTrainer) trainer).getName()); 
     127                //output.append(",trainprecision_" + ((IWekaCompatibleTrainer) trainer).getName()); 
     128                //output.append(",trainsuccHe_" + ((IWekaCompatibleTrainer) trainer).getName()); 
    129129            } 
    130130            output.append(StringTools.ENDLINE); 
     
    136136 
    137137        Evaluation eval = null; 
    138         Evaluation evalTrain = null; 
     138        //Evaluation evalTrain = null; 
    139139        for (Classifier classifier : classifiers) { 
    140140            eval = createEvaluator(testdata, classifier); 
    141             evalTrain = createEvaluator(traindata, classifier); 
     141            //evalTrain = createEvaluator(traindata, classifier); 
    142142 
    143143            double pf = 
     
    195195            output.append("," + eval.numTrueNegatives(1)); 
    196196            output.append("," + eval.numFalsePositives(1)); 
    197             output.append("," + evalTrain.errorRate()); 
     197            /*output.append("," + evalTrain.errorRate()); 
    198198            output.append("," + evalTrain.recall(1)); 
    199199            output.append("," + evalTrain.precision(1)); 
     
    203203            else { 
    204204                output.append(",0"); 
    205             } 
     205            }*/ 
    206206        } 
    207207 
  • trunk/CrossPare/src/de/ugoe/cs/cpdp/execution/CrossProjectExperiment.java

    r41 r44  
    3131import de.ugoe.cs.cpdp.eval.IEvaluationStrategy; 
    3232import de.ugoe.cs.cpdp.loader.IVersionLoader; 
     33import de.ugoe.cs.cpdp.training.ISetWiseTestdataAwareTrainingStrategy; 
    3334import de.ugoe.cs.cpdp.training.ISetWiseTrainingStrategy; 
    3435import de.ugoe.cs.cpdp.training.ITrainer; 
     
    168169                    setwiseTrainer.apply(traindataSet); 
    169170                } 
     171                for (ISetWiseTestdataAwareTrainingStrategy setwiseTestdataAwareTrainer : config.getSetWiseTestdataAwareTrainers()) { 
     172                    Console.traceln(Level.FINE, String 
     173                        .format("[%s] [%02d/%02d] %s: applying testdata aware setwise trainer %s", 
     174                                config.getExperimentName(), versionCount, testVersionCount, 
     175                                testVersion.getVersion(), setwiseTestdataAwareTrainer.getName())); 
     176                    setwiseTestdataAwareTrainer.apply(traindataSet, testdata); 
     177                } 
    170178                Instances traindata = makeSingleTrainingSet(traindataSet); 
    171179                for (IProcessesingStrategy processor : config.getPreProcessors()) { 
     
    210218                    for (ISetWiseTrainingStrategy setwiseTrainer : config.getSetWiseTrainers()) { 
    211219                        allTrainers.add(setwiseTrainer); 
     220                    } 
     221                    for (ISetWiseTestdataAwareTrainingStrategy setwiseTestdataAwareTrainer : config.getSetWiseTestdataAwareTrainers()) { 
     222                        allTrainers.add(setwiseTestdataAwareTrainer); 
    212223                    } 
    213224                    for (ITrainingStrategy trainer : config.getTrainers()) { 
  • trunk/CrossPare/src/de/ugoe/cs/cpdp/execution/RelaxedCrossProjectExperiment.java

    r41 r44  
    3131import de.ugoe.cs.cpdp.eval.IEvaluationStrategy; 
    3232import de.ugoe.cs.cpdp.loader.IVersionLoader; 
     33import de.ugoe.cs.cpdp.training.ISetWiseTestdataAwareTrainingStrategy; 
    3334import de.ugoe.cs.cpdp.training.ISetWiseTrainingStrategy; 
    3435import de.ugoe.cs.cpdp.training.ITrainer; 
     
    173174                    setwiseTrainer.apply(traindataSet); 
    174175                } 
     176                for (ISetWiseTestdataAwareTrainingStrategy setwiseTestdataAwareTrainer : config.getSetWiseTestdataAwareTrainers()) { 
     177                    Console.traceln(Level.FINE, String 
     178                        .format("[%s] [%02d/%02d] %s: applying testdata aware setwise trainer %s", 
     179                                config.getExperimentName(), versionCount, testVersionCount, 
     180                                testVersion.getVersion(), setwiseTestdataAwareTrainer.getName())); 
     181                    setwiseTestdataAwareTrainer.apply(traindataSet, testdata); 
     182                } 
    175183                Instances traindata = makeSingleTrainingSet(traindataSet); 
    176184                for (IProcessesingStrategy processor : config.getPreProcessors()) { 
Note: See TracChangeset for help on using the changeset viewer.