Ignore:
Timestamp:
05/05/15 16:29:40 (9 years ago)
Author:
ftrautsch
Message:

integrating decent into crosspare

File:
1 edited

Legend:

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

    r2 r32  
    119119         */ 
    120120        private List<IEvaluationStrategy> evaluators; 
     121         
     122        /** 
     123         * indicates, if the classifier should be saved 
     124         */ 
     125        private Boolean saveClassifier = null; 
     126         
     127        /** 
     128         * indicates, which execution strategy to choose 
     129         * (e.g. CrossProjectExperiment, ClassifierCreationExecution). 
     130         * Default is CrossProjectExperiment. 
     131         */ 
     132        private String executionStrategy = "CrossProjectExperiment"; 
    121133         
    122134        /** 
     
    315327        } 
    316328         
     329        /** 
     330         * returns boolean, if classifier should be saved 
     331         * @return boolean 
     332         */ 
     333        public boolean getSaveClassifier() { 
     334                return saveClassifier; 
     335        } 
     336         
     337        /** 
     338         * returns the execution strategy 
     339         * @return String execution strategy 
     340         */ 
     341        public String getExecutionStrategy() { 
     342                return executionStrategy; 
     343        } 
     344         
    317345        /* (non-Javadoc) 
    318346         * @see org.xml.sax.helpers.DefaultHandler#startElement(java.lang.String, java.lang.String, java.lang.String, org.xml.sax.Attributes) 
     
    393421                                final IEvaluationStrategy evaluator = (IEvaluationStrategy) Class.forName("de.ugoe.cs.cpdp.eval." + attributes.getValue("name")).newInstance(); 
    394422                                evaluators.add(evaluator); 
     423                        } 
     424                        else if( qName.equals("saveClassifier")) { 
     425                                saveClassifier = true; 
     426                        } 
     427                        else if( qName.equals("executionStrategy")) { 
     428                                executionStrategy = attributes.getValue("name"); 
    395429                        } 
    396430                        else if( qName.equals("partialconfig") ) { 
     
    423457         * If the current data path is the empty string (&quot;&quot;), it is override by the datapath of the other configuration. Otherwise, the current data path is kept. 
    424458         * @param other experiment whose information is added 
    425          */ 
    426         private void addConfigurations(ExperimentConfiguration other) { 
     459         * @throws ExperimentConfigurationException  
     460         */ 
     461        private void addConfigurations(ExperimentConfiguration other) throws ExperimentConfigurationException { 
    427462                if( "results".equals(resultsPath) ) { 
    428463                        resultsPath = other.resultsPath; 
     
    441476                trainers.addAll(other.trainers); 
    442477                evaluators.addAll(other.evaluators); 
     478                 
     479                if(!executionStrategy.equals(other.executionStrategy)) { 
     480                        throw new ExperimentConfigurationException("Executionstrategies must be the same, if config files should be added."); 
     481                } 
     482                 
     483                /* Only if saveClassifier is not set in the main config and 
     484                 * the other configs saveClassifier is true, it must be set. 
     485                 */ 
     486                if(saveClassifier == null && other.saveClassifier == true) { 
     487                        saveClassifier = other.saveClassifier; 
     488                } 
     489 
    443490        } 
    444491         
     
    464511                builder.append("Pointwise trainers: " + trainers.toString() + StringTools.ENDLINE); 
    465512                builder.append("Evaluators: " + evaluators.toString() + StringTools.ENDLINE); 
    466                  
     513                builder.append("Save Classifier?: " + saveClassifier + StringTools.ENDLINE); 
     514                builder.append("Execution Strategy: " + executionStrategy + StringTools.ENDLINE); 
     515                                 
    467516                return builder.toString(); 
    468517        } 
Note: See TracChangeset for help on using the changeset viewer.