Changeset 14870


Ignore:
Timestamp:
04/14/17 09:07:17 (13 days ago)
Author:
gkronber
Message:

#2699: merged changesets from trunk to branch

Location:
branches/RBFRegression/HeuristicLab.Algorithms.DataAnalysis/3.4
Files:
3 edited
1 copied

Legend:

Unmodified
Added
Removed
  • branches/RBFRegression/HeuristicLab.Algorithms.DataAnalysis/3.4

  • branches/RBFRegression/HeuristicLab.Algorithms.DataAnalysis/3.4/CrossValidation.cs

    r14869 r14870  
    3333using HeuristicLab.Problems.DataAnalysis;
    3434using HeuristicLab.Problems.DataAnalysis.Symbolic;
     35using HeuristicLab.Random;
    3536
    3637namespace HeuristicLab.Algorithms.DataAnalysis {
     
    5657      samplesStart = new IntValue(0);
    5758      samplesEnd = new IntValue(0);
     59      shuffleSamples = new BoolValue(false);
    5860      storeAlgorithmInEachRun = false;
    5961
     
    8991      samplesStart = cloner.Clone(original.samplesStart);
    9092      samplesEnd = cloner.Clone(original.samplesEnd);
     93      shuffleSamples = cloner.Clone(original.shuffleSamples);
    9194      RegisterEvents();
    9295      if (Algorithm != null) RegisterAlgorithmEvents();
     
    170173      get { return results; }
    171174    }
    172 
     175    [Storable]
     176    private BoolValue shuffleSamples;
     177    public BoolValue ShuffleSamples {
     178      get { return shuffleSamples; }
     179    }
    173180    [Storable]
    174181    private IntValue folds;
     
    274281        if (clonedAlgorithms.Count == 0) {
    275282          int testSamplesCount = (SamplesEnd.Value - SamplesStart.Value) / Folds.Value;
    276 
     283          IDataset shuffledDataset = null;
    277284          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);
    279293            clonedAlgorithm.Name = algorithm.Name + " Fold " + i;
    280294            IDataAnalysisProblem problem = clonedAlgorithm.Problem as IDataAnalysisProblem;
     
    590604    private void Algorithm_ExecutionStateChanged(object sender, EventArgs e) {
    591605      switch (Algorithm.ExecutionState) {
    592         case ExecutionState.Prepared: OnPrepared();
     606        case ExecutionState.Prepared:
     607          OnPrepared();
    593608          break;
    594609        case ExecutionState.Started: throw new InvalidOperationException("Algorithm template can not be started.");
    595610        case ExecutionState.Paused: throw new InvalidOperationException("Algorithm template can not be paused.");
    596         case ExecutionState.Stopped: OnStopped();
     611        case ExecutionState.Stopped:
     612          OnStopped();
    597613          break;
    598614      }
     
    724740      AggregateResultValues(collectedResults);
    725741      results.AddRange(collectedResults.Select(x => new Result(x.Key, x.Value)).Cast<IResult>().ToArray());
     742      clonedAlgorithms.Clear();
    726743      runsCounter++;
    727744      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  
    406406    </Compile>
    407407    <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" />
    408421  </ItemGroup>
    409422  <ItemGroup>
Note: See TracChangeset for help on using the changeset viewer.