Free cookie consent management tool by TermsFeed Policy Generator

Changeset 10396


Ignore:
Timestamp:
01/26/14 01:42:09 (11 years ago)
Author:
bburlacu
Message:

#1837: Introduced the SlidingWindowBestSolutionsCollectionView which shows how well each individual sliding window solution performs on the other portions of the training data.

Location:
branches/Sliding Window GP
Files:
108 added
6 edited

Legend:

Unmodified
Added
Removed
  • branches/Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/HeuristicLab.Problems.DataAnalysis.Symbolic.Views-3.4.csproj

    r10364 r10396  
    4141    <DebugType>full</DebugType>
    4242    <Optimize>false</Optimize>
    43     <OutputPath>$(SolutionDir)\bin\</OutputPath>
     43    <OutputPath>..\..\..\..\trunk\sources\bin\</OutputPath>
    4444    <DefineConstants>DEBUG;TRACE</DefineConstants>
    4545    <ErrorReport>prompt</ErrorReport>
     
    9393  </PropertyGroup>
    9494  <ItemGroup>
    95     <Reference Include="ALGLIB-3.7.0, Version=3.7.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
    96       <HintPath>..\..\bin\ALGLIB-3.7.0.dll</HintPath>
     95    <Reference Include="ALGLIB-3.7.0">
     96      <HintPath>..\..\..\..\trunk\sources\bin\ALGLIB-3.7.0.dll</HintPath>
    9797      <Private>False</Private>
    9898    </Reference>
     
    100100      <SpecificVersion>False</SpecificVersion>
    101101      <HintPath>..\..\..\..\trunk\sources\bin\EPPlus-3.1.3.dll</HintPath>
     102      <Private>False</Private>
     103    </Reference>
     104    <Reference Include="HeuristicLab.Analysis-3.3">
     105      <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Analysis-3.3.dll</HintPath>
     106    </Reference>
     107    <Reference Include="HeuristicLab.Analysis.Views-3.3">
     108      <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Analysis.Views-3.3.dll</HintPath>
    102109      <Private>False</Private>
    103110    </Reference>
     
    192199  </ItemGroup>
    193200  <ItemGroup>
    194     <Compile Include="Exporters\SymbolicSolutionExcelExporter.cs" />
    195201    <Compile Include="InteractiveSymbolicExpressionTreeChart.cs">
    196202      <SubType>UserControl</SubType>
     
    206212    </Compile>
    207213    <Compile Include="Plugin.cs" />
     214    <Compile Include="SlidingWindowBestSolutionsCollectionView.cs">
     215      <SubType>UserControl</SubType>
     216    </Compile>
     217    <Compile Include="SlidingWindowBestSolutionsCollectionView.Designer.cs">
     218      <DependentUpon>SlidingWindowBestSolutionsCollectionView.cs</DependentUpon>
     219    </Compile>
    208220    <Compile Include="SlidingWindowDataView.cs">
    209221      <SubType>UserControl</SubType>
     
    319331  </ItemGroup>
    320332  <ItemGroup>
    321     <EmbeddedResource Include="SlidingWindowDataView.resx">
    322       <DependentUpon>SlidingWindowDataView.cs</DependentUpon>
     333    <Folder Include="Exporters\" />
     334  </ItemGroup>
     335  <ItemGroup>
     336    <EmbeddedResource Include="SlidingWindowBestSolutionsCollectionView.resx">
     337      <DependentUpon>SlidingWindowBestSolutionsCollectionView.cs</DependentUpon>
    323338    </EmbeddedResource>
    324339  </ItemGroup>
  • branches/Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Analyzers/SymbolicDataAnalysisSingleObjectivePruningAnalyzer.cs

    r10373 r10396  
    8888    protected BoolValue PruneOnlyZeroImpactNodes { get { return PruneOnlyZeroImpactNodesParameter.Value; } }
    8989    #endregion
     90
     91    [StorableConstructor]
     92    protected SymbolicDataAnalysisSingleObjectivePruningAnalyzer(bool deserializing) : base(deserializing) { }
    9093    protected SymbolicDataAnalysisSingleObjectivePruningAnalyzer(SymbolicDataAnalysisSingleObjectivePruningAnalyzer original, Cloner cloner)
    9194      : base(original, cloner) {
  • branches/Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/HeuristicLab.Problems.DataAnalysis.Symbolic-3.4.csproj

    r10373 r10396  
    158158    <Compile Include="Analyzers\SymbolicDataAnalysisSingleObjectivePruningAnalyzer.cs" />
    159159    <Compile Include="SlidingWindow\OffspringSelectionSlidingWindowAnalyzer.cs" />
     160    <Compile Include="SlidingWindow\SlidingWindowBestSolutionsCollection.cs">
     161      <SubType>Code</SubType>
     162    </Compile>
    160163    <Compile Include="SlidingWindow\SlidingWindowData.cs" />
    161164    <Compile Include="SlidingWindow\GenerationalSlidingWindowAnalyzer.cs" />
  • branches/Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/SlidingWindow/SlidingWindowAnalyzer.cs

    r9707 r10396  
    2020#endregion
    2121
     22using System;
     23using System.Linq;
    2224using HeuristicLab.Common;
    2325using HeuristicLab.Core;
    2426using HeuristicLab.Data;
     27using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
    2528using HeuristicLab.Operators;
    2629using HeuristicLab.Optimization;
     
    3134  [StorableClass]
    3235  [Item("Sliding Window GP Analyzer", "Base class for concrete sliding window GP analyzers.")]
    33   public abstract class SlidingWindowAnalyzer : SymbolicDataAnalysisAnalyzer {
     36  public abstract class SlidingWindowAnalyzer : SymbolicDataAnalysisSingleObjectiveAnalyzer {
    3437    private const string ProblemDataParameterName = "ProblemData";
    3538    private const string EvaluatorParameterName = "Evaluator";
     
    4144    private const string InitialSlidingWindowParameterName = "Initial Sliding Window";
    4245    private const string TerminateSlidingWindowParameterName = "TerminateSlidingWindow";
     46    private const string InterpreterParameterName = "SymbolicExpressionTreeInterpreter";
    4347
    4448    #region parameter properties
     49    private ILookupParameter<ISymbolicDataAnalysisExpressionTreeInterpreter> InterpreterParameter {
     50      get { return (ILookupParameter<ISymbolicDataAnalysisExpressionTreeInterpreter>)Parameters[InterpreterParameterName]; }
     51    }
    4552    public IValueLookupParameter<IDataAnalysisProblemData> ProblemDataParameter {
    4653      get { return (IValueLookupParameter<IDataAnalysisProblemData>)Parameters[ProblemDataParameterName]; }
     
    7582    public override bool EnabledByDefault { get { return false; } }
    7683    public IntValue SlidingWindowSize { get { return SlidingWindowSizeParameter.Value; } }
    77     public IntValue ValidiationSlidingWindowSize { get { return ValidationSlidingWindowSizeParameter.Value; } }
     84    public IntValue ValidationSlidingWindowSize { get { return ValidationSlidingWindowSizeParameter.Value; } }
    7885    public IntValue SlidingWindowStepWidth { get { return SlidingWindowStepWidthParameter.Value; } }
    7986    public IntRange InitialSlidingWindow { get { return InitialSlidingWindowParameter.Value; } }
     87    public ISymbolicDataAnalysisExpressionTreeInterpreter Interpreter { get { return InterpreterParameter.ActualValue; } }
     88    public IDataAnalysisProblemData ProblemData { get { return ProblemDataParameter.ActualValue; } }
    8089    #endregion
    81 
    8290
    8391    [StorableConstructor]
     
    97105      Parameters.Add(new FixedValueParameter<IntRange>(InitialSlidingWindowParameterName, "", new IntRange(0, 1)));
    98106      Parameters.Add(new LookupParameter<BoolValue>(TerminateSlidingWindowParameterName, ""));
     107      if (!Parameters.ContainsKey(InterpreterParameterName))
     108        Parameters.Add(new LookupParameter<ISymbolicDataAnalysisExpressionTreeInterpreter>(InterpreterParameterName, ""));
     109      if (!Parameters.ContainsKey("Quality"))
     110        Parameters.Add(new ScopeTreeLookupParameter<DoubleValue>("Quality", ""));
     111      if (!Parameters.ContainsKey("Maximization"))
     112        Parameters.Add(new LookupParameter<BoolValue>("Maximization", "The direction of optimization."));
     113      ProblemDataParameter.Hidden = true;
    99114
    100       ProblemDataParameter.Hidden = true;
    101115    }
    102116
     
    105119      if (!Parameters.ContainsKey(EvaluatorParameterName))
    106120        Parameters.Add(new LookupParameter<IEvaluator>(EvaluatorParameterName, ""));
     121      if (!Parameters.ContainsKey(InterpreterParameterName))
     122        Parameters.Add(new LookupParameter<ISymbolicDataAnalysisExpressionTreeInterpreter>(InterpreterParameterName, ""));
     123      if (!Parameters.ContainsKey("Quality"))
     124        Parameters.Add(new ScopeTreeLookupParameter<DoubleValue>("Quality", ""));
     125      if (!Parameters.ContainsKey("Maximization"))
     126        Parameters.Add(new LookupParameter<BoolValue>("Maximization", "The direction of optimization."));
     127      if (!Parameters.ContainsKey(ProblemDataParameterName))
     128        Parameters.Add(new LookupParameter<IDataAnalysisProblemData>(ProblemDataParameterName));
    107129    }
    108130
     
    112134        TerminateSlidingWindowParameter.ActualValue = new BoolValue(false);
    113135        FitnessCalculationPartitionParameter.ActualValue = (IntRange)InitialSlidingWindow.Clone();
    114         ValidationPartitionParameter.ActualValue = new IntRange(InitialSlidingWindow.End, InitialSlidingWindow.End + ValidiationSlidingWindowSize.Value);
     136        ValidationPartitionParameter.ActualValue = new IntRange(InitialSlidingWindow.End, InitialSlidingWindow.End + ValidationSlidingWindowSize.Value);
    115137        return base.Apply();
    116138      }
    117139
    118140      if (!CheckForUpdate()) return base.Apply();
     141
     142      SaveBestSolution();
    119143
    120144      //update necessary - move sliding window
     
    136160      FitnessCalculationPartitionParameter.ActualValue.End = fitnessPartition.End;
    137161      ValidationPartitionParameter.ActualValue.Start = fitnessPartition.End;
    138       ValidationPartitionParameter.ActualValue.End = ValidationPartitionParameter.ActualValue.Start + ValidiationSlidingWindowSize.Value;
     162      ValidationPartitionParameter.ActualValue.End = ValidationPartitionParameter.ActualValue.Start + ValidationSlidingWindowSize.Value;
    139163
    140164      //reevaluate all individuals with new sliding window
     
    147171    }
    148172
     173    private ISymbolicExpressionTree FindBestIndividual() {
     174      var pop = SymbolicExpressionTree.Zip(Quality, (t, q) => new { Tree = t, Quality = q.Value }).ToList();
     175      Func<double, double, int> comparer = (a, b) => Maximization.Value ? a.CompareTo(b) : b.CompareTo(a);
     176      pop.Sort((a, b) => comparer(a.Quality, b.Quality));
     177      return pop.Last().Tree;
     178    }
     179
     180    private void SaveBestSolution() {
     181      var bestSolutionsCollection = (SlidingWindowBestSolutionsCollection)ResultCollection["Best Solutions"].Value;
     182
     183      if (bestSolutionsCollection.ProblemData == null)
     184        bestSolutionsCollection.ProblemData = ProblemData;
     185
     186      if (bestSolutionsCollection.Interpreter == null)
     187        bestSolutionsCollection.Interpreter = Interpreter;
     188
     189      var fitnessPartition = FitnessCalculationPartitionParameter.ActualValue;
     190      var best = FindBestIndividual();
     191      var range = new IntRange(fitnessPartition.Start, fitnessPartition.End);
     192
     193      bestSolutionsCollection.Add(best, range);
     194    }
     195
    149196    protected abstract bool CheckForUpdate();
    150197  }
  • branches/Sliding Window GP/PreBuildEvent.cmd

    r7845 r10396  
    1 IF EXIST "%ProjectDir%\Properties\AssemblyInfo.cs.frame" SubWCRev "%ProjectDir%\" "%ProjectDir%\Properties\AssemblyInfo.cs.frame" "%ProjectDir%\Properties\AssemblyInfo.cs"
    2 IF EXIST "%ProjectDir%\Plugin.cs.frame" SubWCRev "%ProjectDir%\" "%ProjectDir%\Plugin.cs.frame" "%ProjectDir%\Plugin.cs"
     1REM IF EXIST "%ProjectDir%\Properties\AssemblyInfo.cs.frame" SubWCRev "%ProjectDir%\" "%ProjectDir%\Properties\AssemblyInfo.cs.frame" "%ProjectDir%\Properties\AssemblyInfo.cs"
     2REM IF EXIST "%ProjectDir%\Plugin.cs.frame" SubWCRev "%ProjectDir%\" "%ProjectDir%\Plugin.cs.frame" "%ProjectDir%\Plugin.cs"
  • branches/Sliding Window GP/Sliding Window GP.sln

    r7845 r10396  
    11
    2 Microsoft Visual Studio Solution File, Format Version 11.00
    3 # Visual Studio 2010
     2Microsoft Visual Studio Solution File, Format Version 12.00
     3# Visual Studio 2013
     4VisualStudioVersion = 12.0.30110.0
     5MinimumVisualStudioVersion = 10.0.40219.1
    46Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HeuristicLab.Problems.DataAnalysis.Symbolic-3.4", "HeuristicLab.Problems.DataAnalysis.Symbolic\3.4\HeuristicLab.Problems.DataAnalysis.Symbolic-3.4.csproj", "{3D28463F-EC96-4D82-AFEE-38BE91A0CA00}"
    57EndProject
     
    1012EndProject
    1113Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HeuristicLab.Problems.DataAnalysis.Symbolic.Views-3.4", "HeuristicLab.Problems.DataAnalysis.Symbolic.Views\3.4\HeuristicLab.Problems.DataAnalysis.Symbolic.Views-3.4.csproj", "{7A2531CE-3F7C-4F13-BCCA-ED6DC27A7086}"
     14EndProject
     15Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HeuristicLab.Problems.DataAnalysis.Symbolic.Classification-3.4", "HeuristicLab.Problems.DataAnalysis.Symbolic.Classification\3.4\HeuristicLab.Problems.DataAnalysis.Symbolic.Classification-3.4.csproj", "{05BAE4E1-A9FA-4644-AA77-42558720159E}"
     16EndProject
     17Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HeuristicLab.Problems.DataAnalysis.Symbolic.Regression-3.4", "HeuristicLab.Problems.DataAnalysis.Symbolic.Regression\3.4\HeuristicLab.Problems.DataAnalysis.Symbolic.Regression-3.4.csproj", "{5AC82412-911B-4FA2-A013-EDC5E3F3FCC2}"
    1218EndProject
    1319Global
     
    4551    {7A2531CE-3F7C-4F13-BCCA-ED6DC27A7086}.Release|x86.ActiveCfg = Release|x86
    4652    {7A2531CE-3F7C-4F13-BCCA-ED6DC27A7086}.Release|x86.Build.0 = Release|x86
     53    {05BAE4E1-A9FA-4644-AA77-42558720159E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
     54    {05BAE4E1-A9FA-4644-AA77-42558720159E}.Debug|Any CPU.Build.0 = Debug|Any CPU
     55    {05BAE4E1-A9FA-4644-AA77-42558720159E}.Debug|x64.ActiveCfg = Debug|x64
     56    {05BAE4E1-A9FA-4644-AA77-42558720159E}.Debug|x64.Build.0 = Debug|x64
     57    {05BAE4E1-A9FA-4644-AA77-42558720159E}.Debug|x86.ActiveCfg = Debug|x86
     58    {05BAE4E1-A9FA-4644-AA77-42558720159E}.Debug|x86.Build.0 = Debug|x86
     59    {05BAE4E1-A9FA-4644-AA77-42558720159E}.Release|Any CPU.ActiveCfg = Release|Any CPU
     60    {05BAE4E1-A9FA-4644-AA77-42558720159E}.Release|Any CPU.Build.0 = Release|Any CPU
     61    {05BAE4E1-A9FA-4644-AA77-42558720159E}.Release|x64.ActiveCfg = Release|x64
     62    {05BAE4E1-A9FA-4644-AA77-42558720159E}.Release|x64.Build.0 = Release|x64
     63    {05BAE4E1-A9FA-4644-AA77-42558720159E}.Release|x86.ActiveCfg = Release|x86
     64    {05BAE4E1-A9FA-4644-AA77-42558720159E}.Release|x86.Build.0 = Release|x86
     65    {5AC82412-911B-4FA2-A013-EDC5E3F3FCC2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
     66    {5AC82412-911B-4FA2-A013-EDC5E3F3FCC2}.Debug|Any CPU.Build.0 = Debug|Any CPU
     67    {5AC82412-911B-4FA2-A013-EDC5E3F3FCC2}.Debug|x64.ActiveCfg = Debug|x64
     68    {5AC82412-911B-4FA2-A013-EDC5E3F3FCC2}.Debug|x64.Build.0 = Debug|x64
     69    {5AC82412-911B-4FA2-A013-EDC5E3F3FCC2}.Debug|x86.ActiveCfg = Debug|x86
     70    {5AC82412-911B-4FA2-A013-EDC5E3F3FCC2}.Debug|x86.Build.0 = Debug|x86
     71    {5AC82412-911B-4FA2-A013-EDC5E3F3FCC2}.Release|Any CPU.ActiveCfg = Release|Any CPU
     72    {5AC82412-911B-4FA2-A013-EDC5E3F3FCC2}.Release|Any CPU.Build.0 = Release|Any CPU
     73    {5AC82412-911B-4FA2-A013-EDC5E3F3FCC2}.Release|x64.ActiveCfg = Release|x64
     74    {5AC82412-911B-4FA2-A013-EDC5E3F3FCC2}.Release|x64.Build.0 = Release|x64
     75    {5AC82412-911B-4FA2-A013-EDC5E3F3FCC2}.Release|x86.ActiveCfg = Release|x86
     76    {5AC82412-911B-4FA2-A013-EDC5E3F3FCC2}.Release|x86.Build.0 = Release|x86
    4777  EndGlobalSection
    4878  GlobalSection(SolutionProperties) = preSolution
Note: See TracChangeset for help on using the changeset viewer.