Changeset 13656 for branches/WebJobManager/HeuristicLab.Algorithms.DataAnalysis/3.4/CrossValidation.cs
- Timestamp:
- 03/07/16 10:18:05 (9 years ago)
- Location:
- branches/WebJobManager
- Files:
-
- 1 edited
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
branches/WebJobManager/HeuristicLab.Algorithms.DataAnalysis/3.4/CrossValidation.cs
r13238 r13656 101 101 [Storable] 102 102 private IAlgorithm algorithm; 103 public IAlgorithm Algorithm { 103 public IAlgorithm Algorithm 104 { 104 105 get { return algorithm; } 105 set { 106 set 107 { 106 108 if (ExecutionState != ExecutionState.Prepared && ExecutionState != ExecutionState.Stopped) 107 109 throw new InvalidOperationException("Changing the algorithm is only allowed if the CrossValidation is stopped or prepared."); … … 128 130 [Storable] 129 131 private IDataAnalysisProblem problem; 130 public IDataAnalysisProblem Problem { 131 get { 132 public IDataAnalysisProblem Problem 133 { 134 get 135 { 132 136 if (algorithm == null) 133 137 return null; 134 138 return (IDataAnalysisProblem)algorithm.Problem; 135 139 } 136 set { 140 set 141 { 137 142 if (ExecutionState != ExecutionState.Prepared && ExecutionState != ExecutionState.Stopped) 138 143 throw new InvalidOperationException("Changing the problem is only allowed if the CrossValidation is stopped or prepared."); … … 143 148 } 144 149 145 IProblem IAlgorithm.Problem { 150 IProblem IAlgorithm.Problem 151 { 146 152 get { return Problem; } 147 set { 153 set 154 { 148 155 if (value != null && !ProblemType.IsInstanceOfType(value)) 149 156 throw new ArgumentException("Only DataAnalysisProblems could be used for the cross validation."); … … 151 158 } 152 159 } 153 public Type ProblemType { 160 public Type ProblemType 161 { 154 162 get { return typeof(IDataAnalysisProblem); } 155 163 } … … 158 166 private ItemCollection<IAlgorithm> clonedAlgorithms; 159 167 160 public IEnumerable<IOptimizer> NestedOptimizers { 161 get { 168 public IEnumerable<IOptimizer> NestedOptimizers 169 { 170 get 171 { 162 172 if (Algorithm == null) yield break; 163 173 yield return Algorithm; … … 167 177 [Storable] 168 178 private ResultCollection results; 169 public ResultCollection Results { 179 public ResultCollection Results 180 { 170 181 get { return results; } 171 182 } … … 173 184 [Storable] 174 185 private IntValue folds; 175 public IntValue Folds { 186 public IntValue Folds 187 { 176 188 get { return folds; } 177 189 } 178 190 [Storable] 179 191 private IntValue samplesStart; 180 public IntValue SamplesStart { 192 public IntValue SamplesStart 193 { 181 194 get { return samplesStart; } 182 195 } 183 196 [Storable] 184 197 private IntValue samplesEnd; 185 public IntValue SamplesEnd { 198 public IntValue SamplesEnd 199 { 186 200 get { return samplesEnd; } 187 201 } 188 202 [Storable] 189 203 private IntValue numberOfWorkers; 190 public IntValue NumberOfWorkers { 204 public IntValue NumberOfWorkers 205 { 191 206 get { return numberOfWorkers; } 192 207 } … … 194 209 [Storable] 195 210 private bool storeAlgorithmInEachRun; 196 public bool StoreAlgorithmInEachRun { 211 public bool StoreAlgorithmInEachRun 212 { 197 213 get { return storeAlgorithmInEachRun; } 198 set { 214 set 215 { 199 216 if (storeAlgorithmInEachRun != value) { 200 217 storeAlgorithmInEachRun = value; … … 208 225 [Storable] 209 226 private RunCollection runs; 210 public RunCollection Runs { 227 public RunCollection Runs 228 { 211 229 get { return runs; } 212 230 } … … 214 232 [Storable] 215 233 private ExecutionState executionState; 216 public ExecutionState ExecutionState { 234 public ExecutionState ExecutionState 235 { 217 236 get { return executionState; } 218 private set { 237 private set 238 { 219 239 if (executionState != value) { 220 240 executionState = value; … … 224 244 } 225 245 } 226 public static new Image StaticItemImage { 227 get { return HeuristicLab.Common.Resources.VSImageLibrary.Event; }228 }229 public override Image ItemImage {230 get{246 247 public override Image ItemImage 248 { 249 get 250 { 231 251 if (ExecutionState == ExecutionState.Prepared) return HeuristicLab.Common.Resources.VSImageLibrary.ExecutablePrepared; 232 252 else if (ExecutionState == ExecutionState.Started) return HeuristicLab.Common.Resources.VSImageLibrary.ExecutableStarted; … … 237 257 } 238 258 239 public TimeSpan ExecutionTime { 240 get { 259 public TimeSpan ExecutionTime 260 { 261 get 262 { 241 263 if (ExecutionState != ExecutionState.Prepared) 242 264 return TimeSpan.FromMilliseconds(clonedAlgorithms.Select(x => x.ExecutionTime.TotalMilliseconds).Sum()); … … 589 611 private void Algorithm_ExecutionStateChanged(object sender, EventArgs e) { 590 612 switch (Algorithm.ExecutionState) { 591 case ExecutionState.Prepared: OnPrepared(); 613 case ExecutionState.Prepared: 614 OnPrepared(); 592 615 break; 593 616 case ExecutionState.Started: throw new InvalidOperationException("Algorithm template can not be started."); 594 617 case ExecutionState.Paused: throw new InvalidOperationException("Algorithm template can not be paused."); 595 case ExecutionState.Stopped: OnStopped(); 618 case ExecutionState.Stopped: 619 OnStopped(); 596 620 break; 597 621 }
Note: See TracChangeset
for help on using the changeset viewer.