Ignore:
Timestamp:
05/13/16 09:18:15 (9 years ago)
Author:
sherbold
Message:
  • added the new configuration parameter repetitions and implemented its usage in the AbstractCrossProjectExperiment?. It now allows for multiple storages of the same result in an IResultContainer to allow for repetitions of experiments with random components.
Location:
trunk/CrossPare/src/de/ugoe/cs/cpdp
Files:
4 edited

Legend:

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

    r86 r98  
    161161     */ 
    162162    private Boolean saveClassifier = null; 
     163     
     164    /** 
     165     * number of repetitions of an experiment (to account for randomness) 
     166     */ 
     167    private int repetitions = 1; 
    163168 
    164169    /** 
     
    421426        return saveClassifier; 
    422427    } 
     428     
     429    /** 
     430     * number of repetitions of an experiment 
     431     * 
     432     * @return number of repetitions 
     433     */ 
     434    public int getRepetitions() { 
     435        return repetitions; 
     436    } 
    423437 
    424438    /** 
     
    564578            else if (qName.equals("saveClassifier")) { 
    565579                saveClassifier = true; 
     580            } 
     581            else if( qName.equals("repetitions")) { 
     582                repetitions = Integer.parseInt(attributes.getValue("number")); 
    566583            } 
    567584            else if (qName.equals("executionStrategy")) { 
  • trunk/CrossPare/src/de/ugoe/cs/cpdp/eval/IResultStorage.java

    r86 r98  
    4343     * @param productName 
    4444     *            name of the product 
    45      * @return true of the results ofr the given product and experiment are contained in the result 
    46      *         storage 
     45     * @return number of contained resultsfor the given product and experiment 
    4746     */ 
    48     public boolean containsResult(String experimentName, String productName); 
     47    public int containsResult(String experimentName, String productName); 
    4948} 
  • trunk/CrossPare/src/de/ugoe/cs/cpdp/eval/MySQLResultStorage.java

    r97 r98  
    162162     */ 
    163163    @Override 
    164     public boolean containsResult(String experimentName, String productName) { 
     164    public int containsResult(String experimentName, String productName) { 
    165165        String sql = "SELECT COUNT(*) as cnt FROM crosspare.results WHERE configurationName=\'" + 
    166166            experimentName + "\' AND productName=\'" + productName + "\';"; 
    167167        Statement stmt; 
    168         boolean contained = false; 
    169168        try { 
    170169            stmt = connectionPool.getConnection().createStatement(); 
    171170            ResultSet results = stmt.executeQuery(sql); 
    172171            results.next(); 
    173             int count = results.getInt("cnt"); 
    174             contained = count > 0; 
     172            return results.getInt("cnt"); 
    175173        } 
    176174        catch (SQLException e) { 
     
    179177            Console.printerr("SQLState: " + e.getSQLState() + "\n"); 
    180178            Console.printerr("VendorError: " + e.getErrorCode() + "\n"); 
    181             Console.printerr("\nskipping product since we could not check if the results is available"); 
    182             contained = true; 
     179            return 0; 
    183180        } 
    184         return contained; 
    185181    } 
    186182} 
  • trunk/CrossPare/src/de/ugoe/cs/cpdp/execution/AbstractCrossProjectExperiment.java

    r86 r98  
    148148        int versionCount = 1; 
    149149        int testVersionCount = 0; 
     150        int numTrainers = 0; 
    150151 
    151152        for (SoftwareVersion testVersion : versions) { 
     
    154155            } 
    155156        } 
     157         
     158        numTrainers += config.getSetWiseTrainers().size(); 
     159        numTrainers += config.getSetWiseTestdataAwareTrainers().size(); 
     160        numTrainers += config.getTrainers().size(); 
     161        numTrainers += config.getTestAwareTrainers().size(); 
    156162 
    157163        // sort versions 
     
    164170                                              config.getExperimentName(), versionCount, 
    165171                                              testVersionCount, testVersion.getVersion())); 
    166                 if (resultsAvailable(testVersion)) { 
     172                int numResultsAvailable = resultsAvailable(testVersion); 
     173                if (numResultsAvailable >= numTrainers*config.getRepetitions()) { 
    167174                    Console.traceln(Level.INFO, 
    168175                                    String.format( 
     
    339346    } 
    340347 
    341     private boolean resultsAvailable(SoftwareVersion version) { 
     348    private int resultsAvailable(SoftwareVersion version) { 
    342349        if (config.getResultStorages().isEmpty()) { 
    343             return false; 
    344         } 
    345         boolean available = true; 
     350            return 0; 
     351        } 
     352        int available = Integer.MAX_VALUE; 
    346353        for (IResultStorage storage : config.getResultStorages()) { 
    347             available &= storage.containsResult(config.getExperimentName(), version.getVersion()); 
     354            int curAvailable = storage.containsResult(config.getExperimentName(), version.getVersion()); 
     355            if( curAvailable<available ) { 
     356                available = curAvailable; 
     357            } 
    348358        } 
    349359        return available; 
Note: See TracChangeset for help on using the changeset viewer.