Changeset 14870
- Timestamp:
- 04/14/17 09:07:17 (8 years ago)
- Location:
- branches/RBFRegression/HeuristicLab.Algorithms.DataAnalysis/3.4
- Files:
-
- 3 edited
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
branches/RBFRegression/HeuristicLab.Algorithms.DataAnalysis/3.4
- Property svn:mergeinfo changed
/trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4 merged: 14862-14864
- Property svn:mergeinfo changed
-
branches/RBFRegression/HeuristicLab.Algorithms.DataAnalysis/3.4/CrossValidation.cs
r14869 r14870 33 33 using HeuristicLab.Problems.DataAnalysis; 34 34 using HeuristicLab.Problems.DataAnalysis.Symbolic; 35 using HeuristicLab.Random; 35 36 36 37 namespace HeuristicLab.Algorithms.DataAnalysis { … … 56 57 samplesStart = new IntValue(0); 57 58 samplesEnd = new IntValue(0); 59 shuffleSamples = new BoolValue(false); 58 60 storeAlgorithmInEachRun = false; 59 61 … … 89 91 samplesStart = cloner.Clone(original.samplesStart); 90 92 samplesEnd = cloner.Clone(original.samplesEnd); 93 shuffleSamples = cloner.Clone(original.shuffleSamples); 91 94 RegisterEvents(); 92 95 if (Algorithm != null) RegisterAlgorithmEvents(); … … 170 173 get { return results; } 171 174 } 172 175 [Storable] 176 private BoolValue shuffleSamples; 177 public BoolValue ShuffleSamples { 178 get { return shuffleSamples; } 179 } 173 180 [Storable] 174 181 private IntValue folds; … … 274 281 if (clonedAlgorithms.Count == 0) { 275 282 int testSamplesCount = (SamplesEnd.Value - SamplesStart.Value) / Folds.Value; 276 283 IDataset shuffledDataset = null; 277 284 for (int i = 0; i < Folds.Value; i++) { 278 IAlgorithm clonedAlgorithm = (IAlgorithm)algorithm.Clone(); 285 var cloner = new Cloner(); 286 if (ShuffleSamples.Value) { 287 var dataAnalysisProblem = (IDataAnalysisProblem)algorithm.Problem; 288 var dataset = (Dataset)dataAnalysisProblem.ProblemData.Dataset; 289 shuffledDataset = shuffledDataset ?? dataset.Shuffle(new FastRandom()); 290 cloner.RegisterClonedObject(dataset, shuffledDataset); 291 } 292 IAlgorithm clonedAlgorithm = cloner.Clone(Algorithm); 279 293 clonedAlgorithm.Name = algorithm.Name + " Fold " + i; 280 294 IDataAnalysisProblem problem = clonedAlgorithm.Problem as IDataAnalysisProblem; … … 590 604 private void Algorithm_ExecutionStateChanged(object sender, EventArgs e) { 591 605 switch (Algorithm.ExecutionState) { 592 case ExecutionState.Prepared: OnPrepared(); 606 case ExecutionState.Prepared: 607 OnPrepared(); 593 608 break; 594 609 case ExecutionState.Started: throw new InvalidOperationException("Algorithm template can not be started."); 595 610 case ExecutionState.Paused: throw new InvalidOperationException("Algorithm template can not be paused."); 596 case ExecutionState.Stopped: OnStopped(); 611 case ExecutionState.Stopped: 612 OnStopped(); 597 613 break; 598 614 } … … 724 740 AggregateResultValues(collectedResults); 725 741 results.AddRange(collectedResults.Select(x => new Result(x.Key, x.Value)).Cast<IResult>().ToArray()); 742 clonedAlgorithms.Clear(); 726 743 runsCounter++; 727 744 runs.Add(new Run(string.Format("{0} Run {1}", Name, runsCounter), this)); -
branches/RBFRegression/HeuristicLab.Algorithms.DataAnalysis/3.4/HeuristicLab.Algorithms.DataAnalysis-3.4.csproj
r14869 r14870 406 406 </Compile> 407 407 <Compile Include="TimeSeries\AutoregressiveModeling.cs" /> 408 <Compile Include="TSNE\Distances\DistanceBase.cs" /> 409 <Compile Include="TSNE\Distances\EuclideanDistance.cs" /> 410 <Compile Include="TSNE\Distances\IndexedItemDistance.cs" /> 411 <Compile Include="TSNE\Distances\InnerProductDistance.cs" /> 412 <Compile Include="TSNE\Interfaces\IDistance.cs" /> 413 <Compile Include="TSNE\Interfaces\ISpacePartitioningTree.cs" /> 414 <Compile Include="TSNE\Interfaces\IVantagePointTree.cs" /> 415 <Compile Include="TSNE\PriorityQueue.cs" /> 416 <Compile Include="TSNE\SpacePartitioningTree.cs" /> 417 <Compile Include="TSNE\TSNEAlgorithm.cs" /> 418 <Compile Include="TSNE\TSNEStatic.cs" /> 419 <Compile Include="TSNE\TSNEUtils.cs" /> 420 <Compile Include="TSNE\VantagePointTree.cs" /> 408 421 </ItemGroup> 409 422 <ItemGroup>
Note: See TracChangeset
for help on using the changeset viewer.