Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
07/19/20 19:07:40 (4 years ago)
Author:
fbaching
Message:

#1837: merged changes from trunk

  • apply changes from Attic release to all SlidingWindow specific code files (replace StorableClass with StorableType)
Location:
branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification
Files:
44 edited
3 copied

Legend:

Unmodified
Added
Removed
  • branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification

  • branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification-3.4.csproj

    r10682 r17687  
    1111    <RootNamespace>HeuristicLab.Problems.DataAnalysis.Symbolic.Classification</RootNamespace>
    1212    <AssemblyName>HeuristicLab.Problems.DataAnalysis.Symbolic.Classification-3.4</AssemblyName>
    13     <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
     13    <TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
    1414    <TargetFrameworkProfile>
    1515    </TargetFrameworkProfile>
     
    4141    <DebugType>full</DebugType>
    4242    <Optimize>false</Optimize>
    43     <OutputPath>..\..\..\..\trunk\sources\bin\</OutputPath>
     43    <OutputPath>..\..\..\..\trunk\bin\</OutputPath>
    4444    <DefineConstants>DEBUG;TRACE</DefineConstants>
    4545    <ErrorReport>prompt</ErrorReport>
    4646    <WarningLevel>4</WarningLevel>
    4747    <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
     48    <Prefer32Bit>false</Prefer32Bit>
    4849  </PropertyGroup>
    4950  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
    5051    <DebugType>pdbonly</DebugType>
    5152    <Optimize>true</Optimize>
    52     <OutputPath>..\..\..\..\trunk\sources\bin\</OutputPath>
     53    <OutputPath>$(SolutionDir)\bin\</OutputPath>
    5354    <DefineConstants>TRACE</DefineConstants>
    5455    <ErrorReport>prompt</ErrorReport>
    5556    <WarningLevel>4</WarningLevel>
    5657    <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
     58    <Prefer32Bit>false</Prefer32Bit>
    5759  </PropertyGroup>
    5860  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x64' ">
    5961    <DebugSymbols>true</DebugSymbols>
    60     <OutputPath>..\..\..\..\trunk\sources\bin\</OutputPath>
     62    <OutputPath>$(SolutionDir)\bin\</OutputPath>
    6163    <DefineConstants>DEBUG;TRACE</DefineConstants>
    6264    <DebugType>full</DebugType>
     
    6466    <ErrorReport>prompt</ErrorReport>
    6567    <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
     68    <Prefer32Bit>false</Prefer32Bit>
    6669  </PropertyGroup>
    6770  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x64' ">
    68     <OutputPath>..\..\..\..\trunk\sources\bin\</OutputPath>
     71    <OutputPath>$(SolutionDir)\bin\</OutputPath>
    6972    <DefineConstants>TRACE</DefineConstants>
    7073    <Optimize>true</Optimize>
     
    7376    <ErrorReport>prompt</ErrorReport>
    7477    <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
     78    <Prefer32Bit>false</Prefer32Bit>
    7579  </PropertyGroup>
    7680  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
    7781    <DebugSymbols>true</DebugSymbols>
    78     <OutputPath>..\..\..\..\trunk\sources\bin\</OutputPath>
     82    <OutputPath>$(SolutionDir)\bin\</OutputPath>
    7983    <DefineConstants>DEBUG;TRACE</DefineConstants>
    8084    <DebugType>full</DebugType>
     
    8286    <ErrorReport>prompt</ErrorReport>
    8387    <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
     88    <Prefer32Bit>false</Prefer32Bit>
    8489  </PropertyGroup>
    8590  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
    86     <OutputPath>..\..\..\..\trunk\sources\bin\</OutputPath>
     91    <OutputPath>$(SolutionDir)\bin\</OutputPath>
    8792    <DefineConstants>TRACE</DefineConstants>
    8893    <Optimize>true</Optimize>
     
    9196    <ErrorReport>prompt</ErrorReport>
    9297    <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
    93   </PropertyGroup>
    94   <ItemGroup>
    95     <Reference Include="ALGLIB-3.7.0">
    96       <HintPath>..\..\..\..\trunk\sources\bin\ALGLIB-3.7.0.dll</HintPath>
     98    <Prefer32Bit>false</Prefer32Bit>
     99  </PropertyGroup>
     100  <ItemGroup>
     101    <Reference Include="ALGLIB-3.7.0, Version=3.7.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
     102      <HintPath>..\..\bin\ALGLIB-3.7.0.dll</HintPath>
    97103      <Private>False</Private>
    98104    </Reference>
    99     <Reference Include="HeuristicLab.Analysis-3.3">
    100       <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Analysis-3.3.dll</HintPath>
    101       <Private>False</Private>
    102     </Reference>
    103     <Reference Include="HeuristicLab.Collections-3.3">
    104       <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Collections-3.3.dll</HintPath>
    105       <Private>False</Private>
    106     </Reference>
    107     <Reference Include="HeuristicLab.Common-3.3">
    108       <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Common-3.3.dll</HintPath>
    109       <Private>False</Private>
    110     </Reference>
    111     <Reference Include="HeuristicLab.Common.Resources-3.3">
    112       <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Common.Resources-3.3.dll</HintPath>
    113       <Private>False</Private>
    114     </Reference>
    115     <Reference Include="HeuristicLab.Core-3.3">
    116       <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Core-3.3.dll</HintPath>
    117       <Private>False</Private>
    118     </Reference>
    119     <Reference Include="HeuristicLab.Data-3.3">
    120       <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Data-3.3.dll</HintPath>
    121       <Private>False</Private>
    122     </Reference>
    123     <Reference Include="HeuristicLab.Encodings.SymbolicExpressionTreeEncoding-3.4">
    124       <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Encodings.SymbolicExpressionTreeEncoding-3.4.dll</HintPath>
    125       <Private>False</Private>
    126     </Reference>
    127     <Reference Include="HeuristicLab.Operators-3.3">
    128       <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Operators-3.3.dll</HintPath>
    129       <Private>False</Private>
    130     </Reference>
    131     <Reference Include="HeuristicLab.Optimization-3.3">
    132       <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Optimization-3.3.dll</HintPath>
    133       <Private>False</Private>
    134     </Reference>
    135     <Reference Include="HeuristicLab.Parameters-3.3">
    136       <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Parameters-3.3.dll</HintPath>
    137       <Private>False</Private>
    138     </Reference>
    139     <Reference Include="HeuristicLab.Persistence-3.3">
    140       <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Persistence-3.3.dll</HintPath>
    141       <Private>False</Private>
    142     </Reference>
    143     <Reference Include="HeuristicLab.PluginInfrastructure-3.3">
    144       <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.PluginInfrastructure-3.3.dll</HintPath>
    145       <Private>False</Private>
    146     </Reference>
    147     <Reference Include="HeuristicLab.Problems.DataAnalysis-3.4">
    148       <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Problems.DataAnalysis-3.4.dll</HintPath>
    149       <Private>False</Private>
    150     </Reference>
    151     <Reference Include="HeuristicLab.Problems.Instances-3.3">
    152       <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Problems.Instances-3.3.dll</HintPath>
    153       <Private>False</Private>
     105    <Reference Include="HeuristicLab.Analysis-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
     106      <SpecificVersion>False</SpecificVersion>
     107      <HintPath>..\..\..\..\trunk\bin\HeuristicLab.Analysis-3.3.dll</HintPath>
     108    </Reference>
     109    <Reference Include="HeuristicLab.Collections-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
     110      <SpecificVersion>False</SpecificVersion>
     111      <HintPath>..\..\..\..\trunk\bin\HeuristicLab.Collections-3.3.dll</HintPath>
     112    </Reference>
     113    <Reference Include="HeuristicLab.Common-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
     114      <SpecificVersion>False</SpecificVersion>
     115      <HintPath>..\..\..\..\trunk\bin\HeuristicLab.Common-3.3.dll</HintPath>
     116    </Reference>
     117    <Reference Include="HeuristicLab.Common.Resources-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
     118      <SpecificVersion>False</SpecificVersion>
     119      <HintPath>..\..\..\..\trunk\bin\HeuristicLab.Common.Resources-3.3.dll</HintPath>
     120    </Reference>
     121    <Reference Include="HeuristicLab.Core-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
     122      <SpecificVersion>False</SpecificVersion>
     123      <HintPath>..\..\..\..\trunk\bin\HeuristicLab.Core-3.3.dll</HintPath>
     124    </Reference>
     125    <Reference Include="HeuristicLab.Data-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
     126      <SpecificVersion>False</SpecificVersion>
     127      <HintPath>..\..\..\..\trunk\bin\HeuristicLab.Data-3.3.dll</HintPath>
     128    </Reference>
     129    <Reference Include="HeuristicLab.Encodings.SymbolicExpressionTreeEncoding-3.4, Version=3.4.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
     130      <SpecificVersion>False</SpecificVersion>
     131      <HintPath>..\..\..\..\trunk\bin\HeuristicLab.Encodings.SymbolicExpressionTreeEncoding-3.4.dll</HintPath>
     132    </Reference>
     133    <Reference Include="HeuristicLab.Operators-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
     134      <SpecificVersion>False</SpecificVersion>
     135      <HintPath>..\..\..\..\trunk\bin\HeuristicLab.Operators-3.3.dll</HintPath>
     136    </Reference>
     137    <Reference Include="HeuristicLab.Optimization-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
     138      <SpecificVersion>False</SpecificVersion>
     139      <HintPath>..\..\..\..\trunk\bin\HeuristicLab.Optimization-3.3.dll</HintPath>
     140    </Reference>
     141    <Reference Include="HeuristicLab.Optimization.Operators-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
     142      <SpecificVersion>False</SpecificVersion>
     143      <HintPath>..\..\..\..\trunk\bin\HeuristicLab.Optimization.Operators-3.3.dll</HintPath>
     144    </Reference>
     145    <Reference Include="HeuristicLab.Parameters-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
     146      <SpecificVersion>False</SpecificVersion>
     147      <HintPath>..\..\..\..\trunk\bin\HeuristicLab.Parameters-3.3.dll</HintPath>
     148    </Reference>
     149    <Reference Include="HeuristicLab.Persistence-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
     150      <SpecificVersion>False</SpecificVersion>
     151      <HintPath>..\..\..\..\trunk\bin\HeuristicLab.Persistence-3.3.dll</HintPath>
     152    </Reference>
     153    <Reference Include="HeuristicLab.PluginInfrastructure-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
     154      <SpecificVersion>False</SpecificVersion>
     155      <HintPath>..\..\..\..\trunk\bin\HeuristicLab.PluginInfrastructure-3.3.dll</HintPath>
     156    </Reference>
     157    <Reference Include="HeuristicLab.Problems.DataAnalysis-3.4, Version=3.4.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
     158      <SpecificVersion>False</SpecificVersion>
     159      <HintPath>..\..\..\..\trunk\bin\HeuristicLab.Problems.DataAnalysis-3.4.dll</HintPath>
     160    </Reference>
     161    <Reference Include="HeuristicLab.Problems.Instances-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
     162      <SpecificVersion>False</SpecificVersion>
     163      <HintPath>..\..\..\..\trunk\bin\HeuristicLab.Problems.Instances-3.3.dll</HintPath>
    154164    </Reference>
    155165    <Reference Include="System" />
     
    176186    <Compile Include="ModelCreators\NormalDistributedThresholdsModelCreator.cs" />
    177187    <Compile Include="MultiObjective\SymbolicClassificationMultiObjectiveValidationBestSolutionAnalyzer.cs" />
     188    <Compile Include="SingleObjective\SymbolicClassificationSingleObjectiveWeightedPerformanceMeasuresEvaluator.cs" />
     189    <Compile Include="SingleObjective\SymbolicClassificationSingleObjectiveWeightedResidualsMeanSquaredErrorEvaluator.cs" />
    178190    <Compile Include="Sliding Window\GenerationalClassificationSlidingWindowAnalyzer.cs" />
    179191    <Compile Include="Sliding Window\OffspringSelectionClassificationSlidingWindowAnalyzer.cs" />
    180192    <Compile Include="Sliding Window\SlidingWindowBestClassificationSolutionsCollection.cs" />
     193    <Compile Include="SymbolicClassificationPhenotypicDiversityAnalyzer.cs" />
    181194    <Compile Include="SymbolicClassificationPruningAnalyzer.cs" />
    182195    <Compile Include="SymbolicClassificationSolutionImpactValuesCalculator.cs" />
     
    236249  </ItemGroup>
    237250  <ItemGroup>
     251    <Reference Include="HEAL.Attic, Version=1.0.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
     252      <SpecificVersion>False</SpecificVersion>
     253      <HintPath>..\..\..\..\trunk\bin\HEAL.Attic.dll</HintPath>
     254      <Private>False</Private>
     255    </Reference>
     256  </ItemGroup>
     257  <ItemGroup>
    238258    <ProjectReference Include="..\..\HeuristicLab.Problems.DataAnalysis.Symbolic\3.4\HeuristicLab.Problems.DataAnalysis.Symbolic-3.4.csproj">
    239       <Project>{3D28463F-EC96-4D82-AFEE-38BE91A0CA00}</Project>
     259      <Project>{3d28463f-ec96-4d82-afee-38be91a0ca00}</Project>
    240260      <Name>HeuristicLab.Problems.DataAnalysis.Symbolic-3.4</Name>
    241       <Private>False</Private>
    242261    </ProjectReference>
    243262  </ItemGroup>
     
    265284</PreBuildEvent>
    266285  </PropertyGroup>
     286  <PropertyGroup>
     287    <PreBuildEvent />
     288  </PropertyGroup>
    267289</Project>
  • branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/Interfaces/ISymbolicClassificationEvaluator.cs

    r9456 r17687  
    1 #region License Information
     1using HEAL.Attic;
     2#region License Information
    23/* HeuristicLab
    3  * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     4 * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
    45 *
    56 * This file is part of HeuristicLab.
     
    2122
    2223namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Classification {
     24  [StorableType("ee5a6071-4942-4358-ad21-7ba1bd4224ad")]
    2325  public interface ISymbolicClassificationEvaluator : ISymbolicDataAnalysisEvaluator<IClassificationProblemData> {
    2426  }
  • branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/Interfaces/ISymbolicClassificationModel.cs

    r9587 r17687  
    11#region License Information
    22/* HeuristicLab
    3  * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     3 * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
    44 *
    55 * This file is part of HeuristicLab.
     
    2121
    2222using System.Collections.Generic;
     23using HEAL.Attic;
     24
    2325namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Classification {
     26  [StorableType("64a5d560-0657-4022-87a0-9f3210062a84")]
    2427  public interface ISymbolicClassificationModel : IClassificationModel, ISymbolicDataAnalysisModel {
    2528    void RecalculateModelParameters(IClassificationProblemData problemData, IEnumerable<int> rows);
  • branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/Interfaces/ISymbolicClassificationModelCreator.cs

    r9456 r17687  
    22
    33/* HeuristicLab
    4  * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     4 * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
    55 *
    66 * This file is part of HeuristicLab.
     
    2323using HeuristicLab.Core;
    2424using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
     25using HEAL.Attic;
    2526
    2627namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Classification {
     28  [StorableType("a21179da-5417-4e8c-8f8a-6ddc83b16ab1")]
    2729  public interface ISymbolicClassificationModelCreator : IItem {
    28     ISymbolicClassificationModel CreateSymbolicClassificationModel(ISymbolicExpressionTree tree, ISymbolicDataAnalysisExpressionTreeInterpreter interpreter, double lowerEstimationLimit, double upperEstimationLimit);
     30    ISymbolicClassificationModel CreateSymbolicClassificationModel(string targetVariable, ISymbolicExpressionTree tree, ISymbolicDataAnalysisExpressionTreeInterpreter interpreter, double lowerEstimationLimit, double upperEstimationLimit);
    2931  }
    3032}
  • branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/Interfaces/ISymbolicClassificationModelCreatorOperator.cs

    r9456 r17687  
    22
    33/* HeuristicLab
    4  * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     4 * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
    55 *
    66 * This file is part of HeuristicLab.
     
    2323
    2424using HeuristicLab.Core;
     25using HEAL.Attic;
    2526
    2627namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Classification {
     28  [StorableType("7d19cbcd-dde9-449e-b6d6-ea3e752638d2")]
    2729  public interface ISymbolicClassificationModelCreatorOperator : IOperator {
    2830    ILookupParameter<ISymbolicClassificationModelCreator> ModelCreatorParameter { get; }
  • branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/Interfaces/ISymbolicClassificationMultiObjectiveEvaluator.cs

    r9456 r17687  
    1 #region License Information
     1using HEAL.Attic;
     2#region License Information
    23/* HeuristicLab
    3  * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     4 * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
    45 *
    56 * This file is part of HeuristicLab.
     
    2122
    2223namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Classification {
     24  [StorableType("715dc79f-e2b9-4586-a66c-abf3a35f0012")]
    2325  public interface ISymbolicClassificationMultiObjectiveEvaluator : ISymbolicClassificationEvaluator, ISymbolicDataAnalysisMultiObjectiveEvaluator<IClassificationProblemData> {
    2426  }
  • branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/Interfaces/ISymbolicClassificationSingleObjectiveEvaluator.cs

    r9456 r17687  
    1 #region License Information
     1using HEAL.Attic;
     2#region License Information
    23/* HeuristicLab
    3  * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     4 * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
    45 *
    56 * This file is part of HeuristicLab.
     
    2122
    2223namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Classification {
     24  [StorableType("18a4eeab-5066-4e52-8f37-992a5f7563f1")]
    2325  public interface ISymbolicClassificationSingleObjectiveEvaluator : ISymbolicClassificationEvaluator, ISymbolicDataAnalysisSingleObjectiveEvaluator<IClassificationProblemData> {
    2426  }
  • branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/Interfaces/ISymbolicClassificationSolution.cs

    r9456 r17687  
    1 #region License Information
     1using HEAL.Attic;
     2#region License Information
    23/* HeuristicLab
    3  * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     4 * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
    45 *
    56 * This file is part of HeuristicLab.
     
    2122
    2223
    23 using HeuristicLab.Problems.DataAnalysis.Symbolic;
    24 using System.Collections.Generic;
    25 using System;
    2624namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Classification {
     25  [StorableType("82ba1ea2-e8e9-4b77-b797-c752c1256840")]
    2726  public interface ISymbolicClassificationSolution : IClassificationSolution, ISymbolicDataAnalysisSolution {
    2827    new ISymbolicClassificationModel Model { get; }
  • branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/Interfaces/ISymbolicDiscriminantFunctionClassificationModel.cs

    r9456 r17687  
    1 #region License Information
     1using HEAL.Attic;
     2#region License Information
    23/* HeuristicLab
    3  * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     4 * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
    45 *
    56 * This file is part of HeuristicLab.
     
    2122
    2223namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Classification {
     24  [StorableType("3f2e5443-226c-408a-9121-973d162c590b")]
    2325  public interface ISymbolicDiscriminantFunctionClassificationModel : IDiscriminantFunctionClassificationModel, ISymbolicClassificationModel {
    2426
  • branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/Interfaces/ISymbolicDiscriminantFunctionClassificationModelCreator.cs

    r9456 r17687  
    22
    33/* HeuristicLab
    4  * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     4 * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
    55 *
    66 * This file is part of HeuristicLab.
     
    2222#endregion
    2323using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
     24using HEAL.Attic;
    2425
    2526namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Classification {
     27  [StorableType("fc2ba966-c965-462b-8c5d-8c40998548a7")]
    2628  public interface ISymbolicDiscriminantFunctionClassificationModelCreator : ISymbolicClassificationModelCreator {
    27     ISymbolicDiscriminantFunctionClassificationModel CreateSymbolicDiscriminantFunctionClassificationModel(ISymbolicExpressionTree tree, ISymbolicDataAnalysisExpressionTreeInterpreter interpreter, double lowerEstimationLimit, double upperEstimationLimit);
     29    ISymbolicDiscriminantFunctionClassificationModel CreateSymbolicDiscriminantFunctionClassificationModel(string targetVariable, ISymbolicExpressionTree tree, ISymbolicDataAnalysisExpressionTreeInterpreter interpreter, double lowerEstimationLimit, double upperEstimationLimit);
    2830  }
    2931}
  • branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/ModelCreators/AccuracyMaximizingThresholdsModelCreator.cs

    r9456 r17687  
    22
    33/* HeuristicLab
    4  * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     4 * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
    55 *
    66 * This file is part of HeuristicLab.
     
    2525using HeuristicLab.Core;
    2626using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
    27 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
     27using HEAL.Attic;
    2828
    2929namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Classification {
    30   [StorableClass]
     30  [StorableType("5D9D21D0-F9A8-4145-80CF-2EE9FC0D884C")]
    3131  [Item("AccuracyMaximizingThresholdsModelCreator", "")]
    3232  public sealed class AccuracyMaximizingThresholdsModelCreator : Item, ISymbolicDiscriminantFunctionClassificationModelCreator {
     
    3838    }
    3939    [StorableConstructor]
    40     private AccuracyMaximizingThresholdsModelCreator(bool deserializing) : base(deserializing) { }
     40    private AccuracyMaximizingThresholdsModelCreator(StorableConstructorFlag _) : base(_) { }
    4141    private AccuracyMaximizingThresholdsModelCreator(AccuracyMaximizingThresholdsModelCreator original, Cloner cloner) : base(original, cloner) { }
    4242    public AccuracyMaximizingThresholdsModelCreator() : base() { }
     
    4545
    4646
    47     public ISymbolicClassificationModel CreateSymbolicClassificationModel(ISymbolicExpressionTree tree, ISymbolicDataAnalysisExpressionTreeInterpreter interpreter, double lowerEstimationLimit = double.MinValue, double upperEstimationLimit = double.MaxValue) {
    48       return CreateSymbolicDiscriminantFunctionClassificationModel(tree, interpreter, lowerEstimationLimit, upperEstimationLimit);
     47    public ISymbolicClassificationModel CreateSymbolicClassificationModel(string targetVariable, ISymbolicExpressionTree tree, ISymbolicDataAnalysisExpressionTreeInterpreter interpreter, double lowerEstimationLimit = double.MinValue, double upperEstimationLimit = double.MaxValue) {
     48      return CreateSymbolicDiscriminantFunctionClassificationModel(targetVariable, tree, interpreter, lowerEstimationLimit, upperEstimationLimit);
    4949    }
    50     public ISymbolicDiscriminantFunctionClassificationModel CreateSymbolicDiscriminantFunctionClassificationModel(ISymbolicExpressionTree tree, ISymbolicDataAnalysisExpressionTreeInterpreter interpreter, double lowerEstimationLimit = double.MinValue, double upperEstimationLimit = double.MaxValue) {
    51       return new SymbolicDiscriminantFunctionClassificationModel(tree, interpreter, new AccuracyMaximizationThresholdCalculator(), lowerEstimationLimit, upperEstimationLimit);
     50    public ISymbolicDiscriminantFunctionClassificationModel CreateSymbolicDiscriminantFunctionClassificationModel(string targetVariable, ISymbolicExpressionTree tree, ISymbolicDataAnalysisExpressionTreeInterpreter interpreter, double lowerEstimationLimit = double.MinValue, double upperEstimationLimit = double.MaxValue) {
     51      return new SymbolicDiscriminantFunctionClassificationModel(targetVariable, tree, interpreter, new AccuracyMaximizationThresholdCalculator(), lowerEstimationLimit, upperEstimationLimit);
    5252    }
    5353
  • branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/ModelCreators/NearestNeighborModelCreator.cs

    r9456 r17687  
    11#region License Information
    22/* HeuristicLab
    3  * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     3 * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
    44 *
    55 * This file is part of HeuristicLab.
     
    2626using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
    2727using HeuristicLab.Parameters;
    28 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
     28using HEAL.Attic;
    2929
    3030namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Classification {
    31   [StorableClass]
     31  [StorableType("B96EB322-8027-48F7-AB5B-4E22546B74DD")]
    3232  [Item("NearestNeighborModelCreator", "")]
    3333  public sealed class NearestNeighborModelCreator : ParameterizedNamedItem, ISymbolicClassificationModelCreator {
     
    4444
    4545    [StorableConstructor]
    46     private NearestNeighborModelCreator(bool deserializing) : base(deserializing) { }
     46    private NearestNeighborModelCreator(StorableConstructorFlag _) : base(_) { }
    4747    private NearestNeighborModelCreator(NearestNeighborModelCreator original, Cloner cloner) : base(original, cloner) { }
    4848    public NearestNeighborModelCreator()
     
    5454
    5555
    56     public ISymbolicClassificationModel CreateSymbolicClassificationModel(ISymbolicExpressionTree tree, ISymbolicDataAnalysisExpressionTreeInterpreter interpreter, double lowerEstimationLimit = double.MinValue, double upperEstimationLimit = double.MaxValue) {
    57       return new SymbolicNearestNeighbourClassificationModel(KParameter.Value.Value, tree, interpreter, lowerEstimationLimit, upperEstimationLimit);
     56    public ISymbolicClassificationModel CreateSymbolicClassificationModel(string targetVariable, ISymbolicExpressionTree tree, ISymbolicDataAnalysisExpressionTreeInterpreter interpreter, double lowerEstimationLimit = double.MinValue, double upperEstimationLimit = double.MaxValue) {
     57      return new SymbolicNearestNeighbourClassificationModel(targetVariable, KParameter.Value.Value, tree, interpreter, lowerEstimationLimit, upperEstimationLimit);
    5858    }
    5959
  • branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/ModelCreators/NormalDistributedThresholdsModelCreator.cs

    r9456 r17687  
    22
    33/* HeuristicLab
    4  * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     4 * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
    55 *
    66 * This file is part of HeuristicLab.
     
    2626using HeuristicLab.Core;
    2727using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
    28 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
     28using HEAL.Attic;
    2929
    3030namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Classification {
    31   [StorableClass]
     31  [StorableType("87C4FF17-FC59-4D0F-80F5-2C84499E1222")]
    3232  [Item("NormalDistributedThresholdsModelCreator", "")]
    3333  public sealed class NormalDistributedThresholdsModelCreator : Item, ISymbolicDiscriminantFunctionClassificationModelCreator {
     
    3939    }
    4040    [StorableConstructor]
    41     private NormalDistributedThresholdsModelCreator(bool deserializing) : base(deserializing) { }
     41    private NormalDistributedThresholdsModelCreator(StorableConstructorFlag _) : base(_) { }
    4242    private NormalDistributedThresholdsModelCreator(NormalDistributedThresholdsModelCreator original, Cloner cloner) : base(original, cloner) { }
    4343    public NormalDistributedThresholdsModelCreator() : base() { }
     
    4646
    4747
    48     public ISymbolicClassificationModel CreateSymbolicClassificationModel(ISymbolicExpressionTree tree, ISymbolicDataAnalysisExpressionTreeInterpreter interpreter, double lowerEstimationLimit = double.MinValue, double upperEstimationLimit = double.MaxValue) {
    49       return CreateSymbolicDiscriminantFunctionClassificationModel(tree, interpreter, lowerEstimationLimit, upperEstimationLimit);
     48    public ISymbolicClassificationModel CreateSymbolicClassificationModel(string targetVariable, ISymbolicExpressionTree tree, ISymbolicDataAnalysisExpressionTreeInterpreter interpreter, double lowerEstimationLimit = double.MinValue, double upperEstimationLimit = double.MaxValue) {
     49      return CreateSymbolicDiscriminantFunctionClassificationModel(targetVariable, tree, interpreter, lowerEstimationLimit, upperEstimationLimit);
    5050    }
    51     public ISymbolicDiscriminantFunctionClassificationModel CreateSymbolicDiscriminantFunctionClassificationModel(ISymbolicExpressionTree tree, ISymbolicDataAnalysisExpressionTreeInterpreter interpreter, double lowerEstimationLimit = double.MinValue, double upperEstimationLimit = double.MaxValue) {
    52       return new SymbolicDiscriminantFunctionClassificationModel(tree, interpreter, new NormalDistributionCutPointsThresholdCalculator(), lowerEstimationLimit, upperEstimationLimit);
     51    public ISymbolicDiscriminantFunctionClassificationModel CreateSymbolicDiscriminantFunctionClassificationModel(string targetVariable, ISymbolicExpressionTree tree, ISymbolicDataAnalysisExpressionTreeInterpreter interpreter, double lowerEstimationLimit = double.MinValue, double upperEstimationLimit = double.MaxValue) {
     52      return new SymbolicDiscriminantFunctionClassificationModel(targetVariable, tree, interpreter, new NormalDistributionCutPointsThresholdCalculator(), lowerEstimationLimit, upperEstimationLimit);
    5353    }
    5454
  • branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/MultiObjective/SymbolicClassificationMultiObjectiveEvaluator.cs

    r9456 r17687  
    11#region License Information
    22/* HeuristicLab
    3  * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     3 * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
    44 *
    55 * This file is part of HeuristicLab.
     
    2121
    2222using HeuristicLab.Common;
    23 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
     23using HEAL.Attic;
    2424
    2525namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Classification {
     26  [StorableType("5AC365B5-2F64-4F10-8BD3-E98790E8F3C4")]
    2627  public abstract class SymbolicClassificationMultiObjectiveEvaluator : SymbolicDataAnalysisMultiObjectiveEvaluator<IClassificationProblemData>, ISymbolicClassificationMultiObjectiveEvaluator {
    2728    [StorableConstructor]
    28     protected SymbolicClassificationMultiObjectiveEvaluator(bool deserializing) : base(deserializing) { }
     29    protected SymbolicClassificationMultiObjectiveEvaluator(StorableConstructorFlag _) : base(_) { }
    2930    protected SymbolicClassificationMultiObjectiveEvaluator(SymbolicClassificationMultiObjectiveEvaluator original, Cloner cloner)
    3031      : base(original, cloner) {
  • branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/MultiObjective/SymbolicClassificationMultiObjectiveMeanSquaredErrorTreeSizeEvaluator.cs

    r10291 r17687  
    11#region License Information
    22/* HeuristicLab
    3  * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     3 * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
    44 *
    55 * This file is part of HeuristicLab.
     
    2525using HeuristicLab.Data;
    2626using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
    27 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
     27using HEAL.Attic;
    2828
    2929namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Classification {
    3030  [Item("Mean squared error & Tree size Evaluator", "Calculates the mean squared error and the tree size of a symbolic classification solution.")]
    31   [StorableClass]
     31  [StorableType("1D1693A0-6479-45D1-990F-125FFCEC430E")]
    3232  public class SymbolicClassificationMultiObjectiveMeanSquaredErrorTreeSizeEvaluator : SymbolicClassificationMultiObjectiveEvaluator {
    3333    [StorableConstructor]
    34     protected SymbolicClassificationMultiObjectiveMeanSquaredErrorTreeSizeEvaluator(bool deserializing) : base(deserializing) { }
     34    protected SymbolicClassificationMultiObjectiveMeanSquaredErrorTreeSizeEvaluator(StorableConstructorFlag _) : base(_) { }
    3535    protected SymbolicClassificationMultiObjectiveMeanSquaredErrorTreeSizeEvaluator(SymbolicClassificationMultiObjectiveMeanSquaredErrorTreeSizeEvaluator original, Cloner cloner)
    3636      : base(original, cloner) {
  • branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/MultiObjective/SymbolicClassificationMultiObjectivePearsonRSquaredTreeSizeEvaluator.cs

    r10291 r17687  
    11#region License Information
    22/* HeuristicLab
    3  * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     3 * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
    44 *
    55 * This file is part of HeuristicLab.
     
    2525using HeuristicLab.Data;
    2626using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
    27 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
     27using HEAL.Attic;
    2828
    2929namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Classification {
    3030  [Item("Pearson R² & Tree size Evaluator", "Calculates the Pearson R² and the tree size of a symbolic classification solution.")]
    31   [StorableClass]
     31  [StorableType("3131A57B-5F87-4CAD-A0BE-E1E03D6D8276")]
    3232  public class SymbolicClassificationMultiObjectivePearsonRSquaredTreeSizeEvaluator : SymbolicClassificationMultiObjectiveEvaluator {
    3333    [StorableConstructor]
    34     protected SymbolicClassificationMultiObjectivePearsonRSquaredTreeSizeEvaluator(bool deserializing) : base(deserializing) { }
     34    protected SymbolicClassificationMultiObjectivePearsonRSquaredTreeSizeEvaluator(StorableConstructorFlag _) : base(_) { }
    3535    protected SymbolicClassificationMultiObjectivePearsonRSquaredTreeSizeEvaluator(SymbolicClassificationMultiObjectivePearsonRSquaredTreeSizeEvaluator original, Cloner cloner)
    3636      : base(original, cloner) {
     
    5757      OnlineCalculatorError errorState;
    5858
    59       double r2;
     59      double r;
    6060      if (applyLinearScaling) {
    61         var r2Calculator = new OnlinePearsonsRSquaredCalculator();
    62         CalculateWithScaling(targetValues, estimatedValues, lowerEstimationLimit, upperEstimationLimit, r2Calculator, problemData.Dataset.Rows);
    63         errorState = r2Calculator.ErrorState;
    64         r2 = r2Calculator.RSquared;
     61        var rCalculator = new OnlinePearsonsRCalculator();
     62        CalculateWithScaling(targetValues, estimatedValues, lowerEstimationLimit, upperEstimationLimit, rCalculator, problemData.Dataset.Rows);
     63        errorState = rCalculator.ErrorState;
     64        r = rCalculator.R;
    6565      } else {
    6666        IEnumerable<double> boundedEstimatedValues = estimatedValues.LimitToRange(lowerEstimationLimit, upperEstimationLimit);
    67         r2 = OnlinePearsonsRSquaredCalculator.Calculate(targetValues, boundedEstimatedValues, out errorState);
     67        r = OnlinePearsonsRCalculator.Calculate(targetValues, boundedEstimatedValues, out errorState);
    6868      }
    6969
    70       if (errorState != OnlineCalculatorError.None) r2 = double.NaN;
    71       return new double[2] { r2, solution.Length };
     70      if (errorState != OnlineCalculatorError.None) r = double.NaN;
     71      return new double[2] { r*r, solution.Length };
    7272
    7373    }
  • branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/MultiObjective/SymbolicClassificationMultiObjectiveProblem.cs

    r9456 r17687  
    11#region License Information
    22/* HeuristicLab
    3  * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     3 * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
    44 *
    55 * This file is part of HeuristicLab.
     
    2323using HeuristicLab.Core;
    2424using HeuristicLab.Data;
     25using HeuristicLab.Optimization;
    2526using HeuristicLab.Parameters;
    26 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
     27using HEAL.Attic;
    2728
    2829namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Classification {
    29   [Item("Symbolic Classification Problem (multi objective)", "Represents a multi objective symbolic classfication problem.")]
    30   [StorableClass]
    31   [Creatable("Problems")]
     30  [Item("Symbolic Classification Problem (multi-objective)", "Represents a multi objective symbolic classfication problem.")]
     31  [StorableType("3CD66D22-59F2-43BA-A357-AA84C403EE61")]
     32  [Creatable(CreatableAttribute.Categories.GeneticProgrammingProblems, Priority = 130)]
    3233  public class SymbolicClassificationMultiObjectiveProblem : SymbolicDataAnalysisMultiObjectiveProblem<IClassificationProblemData, ISymbolicClassificationMultiObjectiveEvaluator, ISymbolicDataAnalysisSolutionCreator>, IClassificationProblem {
    3334    private const double PunishmentFactor = 10;
     
    5657    #endregion
    5758    [StorableConstructor]
    58     protected SymbolicClassificationMultiObjectiveProblem(bool deserializing) : base(deserializing) { }
     59    protected SymbolicClassificationMultiObjectiveProblem(StorableConstructorFlag _) : base(_) { }
    5960    protected SymbolicClassificationMultiObjectiveProblem(SymbolicClassificationMultiObjectiveProblem original, Cloner cloner)
    6061      : base(original, cloner) {
     
    105106      Operators.Add(new SymbolicClassificationMultiObjectiveTrainingBestSolutionAnalyzer());
    106107      Operators.Add(new SymbolicClassificationMultiObjectiveValidationBestSolutionAnalyzer());
     108      Operators.Add(new SymbolicExpressionTreePhenotypicSimilarityCalculator());
     109      Operators.Add(new SymbolicClassificationPhenotypicDiversityAnalyzer(Operators.OfType<SymbolicExpressionTreePhenotypicSimilarityCalculator>()));
    107110      ParameterizeOperators();
    108111    }
     
    135138          op.ModelCreatorParameter.ActualName = ModelCreatorParameter.Name;
    136139      }
     140
     141      foreach (var op in Operators.OfType<ISolutionSimilarityCalculator>()) {
     142        op.SolutionVariableName = SolutionCreator.SymbolicExpressionTreeParameter.ActualName;
     143        op.QualityVariableName = Evaluator.QualitiesParameter.ActualName;
     144
     145        if (op is SymbolicExpressionTreePhenotypicSimilarityCalculator) {
     146          var phenotypicSimilarityCalculator = (SymbolicExpressionTreePhenotypicSimilarityCalculator)op;
     147          phenotypicSimilarityCalculator.ProblemData = ProblemData;
     148          phenotypicSimilarityCalculator.Interpreter = SymbolicExpressionTreeInterpreter;
     149        }
     150      }
    137151    }
    138152  }
  • branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/MultiObjective/SymbolicClassificationMultiObjectiveTrainingBestSolutionAnalyzer.cs

    r9456 r17687  
    11#region License Information
    22/* HeuristicLab
    3  * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     3 * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
    44 *
    55 * This file is part of HeuristicLab.
     
    2020#endregion
    2121
     22using System.Collections.Generic;
     23using System.Linq;
     24using HEAL.Attic;
     25using HeuristicLab.Analysis;
    2226using HeuristicLab.Common;
    2327using HeuristicLab.Core;
     28using HeuristicLab.Data;
    2429using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
     30using HeuristicLab.Optimization;
    2531using HeuristicLab.Parameters;
    26 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    2732
    2833namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Classification {
     
    3136  /// </summary>
    3237  [Item("SymbolicClassificationMultiObjectiveTrainingBestSolutionAnalyzer", "An operator that analyzes the training best symbolic classification solution for multi objective symbolic classification problems.")]
    33   [StorableClass]
     38  [StorableType("EC30DC99-A5A8-43B0-81C1-BA9016A0A74C")]
    3439  public sealed class SymbolicClassificationMultiObjectiveTrainingBestSolutionAnalyzer : SymbolicDataAnalysisMultiObjectiveTrainingBestSolutionAnalyzer<ISymbolicClassificationSolution>,
    3540    ISymbolicDataAnalysisInterpreterOperator, ISymbolicDataAnalysisBoundedOperator, ISymbolicClassificationModelCreatorOperator {
     
    3843    private const string SymbolicDataAnalysisTreeInterpreterParameterName = "SymbolicDataAnalysisTreeInterpreter";
    3944    private const string EstimationLimitsParameterName = "EstimationLimits";
     45    private const string MaximumSymbolicExpressionTreeLengthParameterName = "MaximumSymbolicExpressionTreeLength";
     46    private const string ValidationPartitionParameterName = "ValidationPartition";
     47    private const string AnalyzeTestErrorParameterName = "Analyze Test Error";
    4048
    4149    #region parameter properties
     
    5563      get { return (IValueLookupParameter<DoubleLimit>)Parameters[EstimationLimitsParameterName]; }
    5664    }
     65    public ILookupParameter<IntValue> MaximumSymbolicExpressionTreeLengthParameter {
     66      get { return (ILookupParameter<IntValue>)Parameters[MaximumSymbolicExpressionTreeLengthParameterName]; }
     67    }
     68    public IValueLookupParameter<IntRange> ValidationPartitionParameter {
     69      get { return (IValueLookupParameter<IntRange>)Parameters[ValidationPartitionParameterName]; }
     70    }
     71    public IFixedValueParameter<BoolValue> AnalyzeTestErrorParameter {
     72      get { return (IFixedValueParameter<BoolValue>)Parameters[AnalyzeTestErrorParameterName]; }
     73    }
     74    public bool AnalyzeTestError {
     75      get { return AnalyzeTestErrorParameter.Value.Value; }
     76      set { AnalyzeTestErrorParameter.Value.Value = value; }
     77    }
    5778    #endregion
    5879
    5980    [StorableConstructor]
    60     private SymbolicClassificationMultiObjectiveTrainingBestSolutionAnalyzer(bool deserializing) : base(deserializing) { }
     81    private SymbolicClassificationMultiObjectiveTrainingBestSolutionAnalyzer(StorableConstructorFlag _) : base(_) { }
    6182    private SymbolicClassificationMultiObjectiveTrainingBestSolutionAnalyzer(SymbolicClassificationMultiObjectiveTrainingBestSolutionAnalyzer original, Cloner cloner) : base(original, cloner) { }
    6283    public SymbolicClassificationMultiObjectiveTrainingBestSolutionAnalyzer()
     
    6687      Parameters.Add(new LookupParameter<ISymbolicDataAnalysisExpressionTreeInterpreter>(SymbolicDataAnalysisTreeInterpreterParameterName, "The symbolic data analysis tree interpreter for the symbolic expression tree."));
    6788      Parameters.Add(new ValueLookupParameter<DoubleLimit>(EstimationLimitsParameterName, "The lower and upper limit for the estimated values produced by the symbolic classification model."));
     89      Parameters.Add(new LookupParameter<IntValue>(MaximumSymbolicExpressionTreeLengthParameterName, "Maximal length of the symbolic expression.") { Hidden = true });
     90      Parameters.Add(new ValueLookupParameter<IntRange>(ValidationPartitionParameterName, "The validation partition."));
     91      Parameters.Add(new FixedValueParameter<BoolValue>(AnalyzeTestErrorParameterName, "Flag whether the test error should be displayed in the Pareto-Front", new BoolValue(false)));
     92
    6893    }
    6994    public override IDeepCloneable Clone(Cloner cloner) {
     
    81106
    82107    protected override ISymbolicClassificationSolution CreateSolution(ISymbolicExpressionTree bestTree, double[] bestQuality) {
    83       var model = ModelCreatorParameter.ActualValue.CreateSymbolicClassificationModel((ISymbolicExpressionTree)bestTree.Clone(), SymbolicDataAnalysisTreeInterpreterParameter.ActualValue, EstimationLimitsParameter.ActualValue.Lower, EstimationLimitsParameter.ActualValue.Upper);
     108      var model = ModelCreatorParameter.ActualValue.CreateSymbolicClassificationModel(ProblemDataParameter.ActualValue.TargetVariable, (ISymbolicExpressionTree)bestTree.Clone(), SymbolicDataAnalysisTreeInterpreterParameter.ActualValue, EstimationLimitsParameter.ActualValue.Lower, EstimationLimitsParameter.ActualValue.Upper);
    84109      if (ApplyLinearScalingParameter.ActualValue.Value) model.Scale(ProblemDataParameter.ActualValue);
    85110
     
    87112      return model.CreateClassificationSolution((IClassificationProblemData)ProblemDataParameter.ActualValue.Clone());
    88113    }
     114
     115    public override IOperation Apply() {
     116      var operation = base.Apply();
     117      var paretoFront = TrainingBestSolutionsParameter.ActualValue;
     118
     119      IResult result;
     120      ScatterPlot qualityToTreeSize;
     121      if (!ResultCollection.TryGetValue("Pareto Front Analysis", out result)) {
     122        qualityToTreeSize = new ScatterPlot("Quality vs Tree Size", "");
     123        qualityToTreeSize.VisualProperties.XAxisMinimumAuto = false;
     124        qualityToTreeSize.VisualProperties.XAxisMaximumAuto = false;
     125        qualityToTreeSize.VisualProperties.YAxisMinimumAuto = false;
     126        qualityToTreeSize.VisualProperties.YAxisMaximumAuto = false;
     127
     128        qualityToTreeSize.VisualProperties.XAxisMinimumFixedValue = 0;
     129        qualityToTreeSize.VisualProperties.XAxisMaximumFixedValue = MaximumSymbolicExpressionTreeLengthParameter.ActualValue.Value;
     130        qualityToTreeSize.VisualProperties.YAxisMinimumFixedValue = 0;
     131        qualityToTreeSize.VisualProperties.YAxisMaximumFixedValue = 1;
     132        ResultCollection.Add(new Result("Pareto Front Analysis", qualityToTreeSize));
     133      } else {
     134        qualityToTreeSize = (ScatterPlot)result.Value;
     135      }
     136
     137      int previousTreeLength = -1;
     138      var sizeParetoFront = new LinkedList<ISymbolicClassificationSolution>();
     139      foreach (var solution in paretoFront.OrderBy(s => s.Model.SymbolicExpressionTree.Length)) {
     140        int treeLength = solution.Model.SymbolicExpressionTree.Length;
     141        if (!sizeParetoFront.Any()) sizeParetoFront.AddLast(solution);
     142        if (solution.TrainingAccuracy > sizeParetoFront.Last.Value.TrainingAccuracy) {
     143          if (treeLength == previousTreeLength)
     144            sizeParetoFront.RemoveLast();
     145          sizeParetoFront.AddLast(solution);
     146        }
     147        previousTreeLength = treeLength;
     148      }
     149
     150      qualityToTreeSize.Rows.Clear();
     151      var trainingRow = new ScatterPlotDataRow("Training Accuracy", "", sizeParetoFront.Select(x => new Point2D<double>(x.Model.SymbolicExpressionTree.Length, x.TrainingAccuracy, x)));
     152      trainingRow.VisualProperties.PointSize = 8;
     153      qualityToTreeSize.Rows.Add(trainingRow);
     154
     155      if (AnalyzeTestError) {
     156        var testRow = new ScatterPlotDataRow("Test Accuracy", "",
     157          sizeParetoFront.Select(x => new Point2D<double>(x.Model.SymbolicExpressionTree.Length, x.TestAccuracy, x)));
     158        testRow.VisualProperties.PointSize = 8;
     159        qualityToTreeSize.Rows.Add(testRow);
     160      }
     161
     162      var validationPartition = ValidationPartitionParameter.ActualValue;
     163      if (validationPartition.Size != 0) {
     164        var problemData = ProblemDataParameter.ActualValue;
     165        var validationIndizes = Enumerable.Range(validationPartition.Start, validationPartition.Size).ToList();
     166        var targetValues = problemData.Dataset.GetDoubleValues(problemData.TargetVariable, validationIndizes).ToList();
     167        OnlineCalculatorError error;
     168        var validationRow = new ScatterPlotDataRow("Validation Accuracy", "",
     169          sizeParetoFront.Select(x => new Point2D<double>(x.Model.SymbolicExpressionTree.Length,
     170          OnlineAccuracyCalculator.Calculate(targetValues, x.GetEstimatedClassValues(validationIndizes), out error))));
     171        validationRow.VisualProperties.PointSize = 7;
     172        qualityToTreeSize.Rows.Add(validationRow);
     173      }
     174
     175      return operation;
     176    }
    89177  }
    90178}
  • branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/MultiObjective/SymbolicClassificationMultiObjectiveValidationBestSolutionAnalyzer.cs

    r9456 r17687  
    11#region License Information
    22/* HeuristicLab
    3  * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     3 * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
    44 *
    55 * This file is part of HeuristicLab.
     
    2424using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
    2525using HeuristicLab.Parameters;
    26 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
     26using HEAL.Attic;
    2727
    2828namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Classification {
     
    3131  /// </summary>
    3232  [Item("SymbolicClassificationMultiObjectiveValidationBestSolutionAnalyzer", "An operator that analyzes the validation best symbolic classification solution for multi objective symbolic classification problems.")]
    33   [StorableClass]
     33  [StorableType("223AECFF-0EA7-4271-A342-9F2E5BF3EDC0")]
    3434  public sealed class SymbolicClassificationMultiObjectiveValidationBestSolutionAnalyzer : SymbolicDataAnalysisMultiObjectiveValidationBestSolutionAnalyzer<ISymbolicClassificationSolution, ISymbolicClassificationMultiObjectiveEvaluator, IClassificationProblemData>,
    3535  ISymbolicDataAnalysisBoundedOperator, ISymbolicClassificationModelCreatorOperator {
     
    5050
    5151    [StorableConstructor]
    52     private SymbolicClassificationMultiObjectiveValidationBestSolutionAnalyzer(bool deserializing) : base(deserializing) { }
     52    private SymbolicClassificationMultiObjectiveValidationBestSolutionAnalyzer(StorableConstructorFlag _) : base(_) { }
    5353    private SymbolicClassificationMultiObjectiveValidationBestSolutionAnalyzer(SymbolicClassificationMultiObjectiveValidationBestSolutionAnalyzer original, Cloner cloner) : base(original, cloner) { }
    5454    public SymbolicClassificationMultiObjectiveValidationBestSolutionAnalyzer()
     
    7171
    7272    protected override ISymbolicClassificationSolution CreateSolution(ISymbolicExpressionTree bestTree, double[] bestQualities) {
    73       var model = ModelCreatorParameter.ActualValue.CreateSymbolicClassificationModel((ISymbolicExpressionTree)bestTree.Clone(), SymbolicDataAnalysisTreeInterpreterParameter.ActualValue, EstimationLimitsParameter.ActualValue.Lower, EstimationLimitsParameter.ActualValue.Upper);
     73      var model = ModelCreatorParameter.ActualValue.CreateSymbolicClassificationModel(ProblemDataParameter.ActualValue.TargetVariable, (ISymbolicExpressionTree)bestTree.Clone(), SymbolicDataAnalysisTreeInterpreterParameter.ActualValue, EstimationLimitsParameter.ActualValue.Lower, EstimationLimitsParameter.ActualValue.Upper);
    7474      if (ApplyLinearScalingParameter.ActualValue.Value) model.Scale(ProblemDataParameter.ActualValue);
    7575
  • branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/Plugin.cs.frame

    r10037 r17687  
    11#region License Information
    22/* HeuristicLab
    3  * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     3 * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
    44 *
    55 * This file is part of HeuristicLab.
     
    2626
    2727namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Classification {
    28   [Plugin("HeuristicLab.Problems.DataAnalysis.Symbolic.Classification","Provides classes to perform symbolic classification (single- or multiobjective).", "3.4.5.$WCREV$")]
     28  [Plugin("HeuristicLab.Problems.DataAnalysis.Symbolic.Classification","Provides classes to perform symbolic classification (single- or multiobjective).", "3.4.12.$WCREV$")]
    2929  [PluginFile("HeuristicLab.Problems.DataAnalysis.Symbolic.Classification-3.4.dll", PluginFileType.Assembly)]
    3030  [PluginDependency("HeuristicLab.ALGLIB", "3.7.0")]
     
    3939  [PluginDependency("HeuristicLab.Optimization", "3.3")]
    4040  [PluginDependency("HeuristicLab.Parameters", "3.3")]
    41   [PluginDependency("HeuristicLab.Persistence", "3.3")]
     41  [PluginDependency("HeuristicLab.Attic", "1.0")]
    4242  [PluginDependency("HeuristicLab.Problems.DataAnalysis", "3.4")]
    4343  [PluginDependency("HeuristicLab.Problems.DataAnalysis.Symbolic", "3.4")]
  • branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/Properties/AssemblyInfo.cs.frame

    r10037 r17687  
    11#region License Information
    22/* HeuristicLab
    3  * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     3 * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
    44 *
    55 * This file is part of HeuristicLab.
     
    3131[assembly: AssemblyCompany("")]
    3232[assembly: AssemblyProduct("HeuristicLab")]
    33 [assembly: AssemblyCopyright("(c) 2002-2013 HEAL")]
     33[assembly: AssemblyCopyright("(c) HEAL")]
    3434[assembly: AssemblyTrademark("")]
    3535[assembly: AssemblyCulture("")]
     
    5353// by using the '*' as shown below:
    5454[assembly: AssemblyVersion("3.4.0.0")]
    55 [assembly: AssemblyFileVersion("3.4.5.$WCREV$")]
     55[assembly: AssemblyFileVersion("3.4.12.$WCREV$")]
  • branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/SingleObjective/SymbolicClassificationSingleObjectiveBoundedMeanSquaredErrorEvaluator.cs

    r10291 r17687  
    11#region License Information
    22/* HeuristicLab
    3  * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     3 * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
    44 *
    55 * This file is part of HeuristicLab.
     
    2727using HeuristicLab.Data;
    2828using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
    29 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
     29using HEAL.Attic;
    3030
    3131namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Classification.SingleObjective {
    3232  [Item("Bounded Mean squared error Evaluator", "Calculates the bounded mean squared error of a symbolic classification solution (estimations above or below the class values are only penaltilized linearly.")]
    33   [StorableClass]
     33  [StorableType("3C4C86ED-3F6A-464F-B7B6-326A220085EC")]
    3434  public class SymbolicClassificationSingleObjectiveBoundedMeanSquaredErrorEvaluator : SymbolicClassificationSingleObjectiveEvaluator {
    3535    [StorableConstructor]
    36     protected SymbolicClassificationSingleObjectiveBoundedMeanSquaredErrorEvaluator(bool deserializing) : base(deserializing) { }
     36    protected SymbolicClassificationSingleObjectiveBoundedMeanSquaredErrorEvaluator(StorableConstructorFlag _) : base(_) { }
    3737    protected SymbolicClassificationSingleObjectiveBoundedMeanSquaredErrorEvaluator(SymbolicClassificationSingleObjectiveBoundedMeanSquaredErrorEvaluator original, Cloner cloner) : base(original, cloner) { }
    3838    public override IDeepCloneable Clone(Cloner cloner) {
  • branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/SingleObjective/SymbolicClassificationSingleObjectiveEvaluator.cs

    r9456 r17687  
    11#region License Information
    22/* HeuristicLab
    3  * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     3 * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
    44 *
    55 * This file is part of HeuristicLab.
     
    2121
    2222using HeuristicLab.Common;
    23 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
     23using HEAL.Attic;
    2424
    2525namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Classification {
    26   [StorableClass]
     26  [StorableType("48C7BDD3-9EED-4D61-AF72-A895556052A7")]
    2727  public abstract class SymbolicClassificationSingleObjectiveEvaluator : SymbolicDataAnalysisSingleObjectiveEvaluator<IClassificationProblemData>, ISymbolicClassificationSingleObjectiveEvaluator {
    2828    [StorableConstructor]
    29     protected SymbolicClassificationSingleObjectiveEvaluator(bool deserializing) : base(deserializing) { }
     29    protected SymbolicClassificationSingleObjectiveEvaluator(StorableConstructorFlag _) : base(_) { }
    3030    protected SymbolicClassificationSingleObjectiveEvaluator(SymbolicClassificationSingleObjectiveEvaluator original, Cloner cloner)
    3131      : base(original, cloner) {
  • branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/SingleObjective/SymbolicClassificationSingleObjectiveMeanSquaredErrorEvaluator.cs

    r10291 r17687  
    11#region License Information
    22/* HeuristicLab
    3  * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     3 * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
    44 *
    55 * This file is part of HeuristicLab.
     
    2626using HeuristicLab.Data;
    2727using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
    28 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
     28using HEAL.Attic;
    2929
    3030namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Classification {
    3131  [Item("Mean squared error Evaluator", "Calculates the mean squared error of a symbolic classification solution.")]
    32   [StorableClass]
     32  [StorableType("E738C902-4293-4B2C-BBAC-1EE79381657D")]
    3333  public class SymbolicClassificationSingleObjectiveMeanSquaredErrorEvaluator : SymbolicClassificationSingleObjectiveEvaluator {
    3434    [StorableConstructor]
    35     protected SymbolicClassificationSingleObjectiveMeanSquaredErrorEvaluator(bool deserializing) : base(deserializing) { }
     35    protected SymbolicClassificationSingleObjectiveMeanSquaredErrorEvaluator(StorableConstructorFlag _) : base(_) { }
    3636    protected SymbolicClassificationSingleObjectiveMeanSquaredErrorEvaluator(SymbolicClassificationSingleObjectiveMeanSquaredErrorEvaluator original, Cloner cloner)
    3737      : base(original, cloner) {
  • branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/SingleObjective/SymbolicClassificationSingleObjectiveOverfittingAnalyzer.cs

    r10576 r17687  
    11#region License Information
    22/* HeuristicLab
    3  * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     3 * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
    44 *
    55 * This file is part of HeuristicLab.
     
    2828using HeuristicLab.Optimization;
    2929using HeuristicLab.Parameters;
    30 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
     30using HEAL.Attic;
    3131
    3232namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Classification {
    3333  [Item("SymbolicClassificationSingleObjectiveOverfittingAnalyzer", "Calculates and tracks correlation of training and validation fitness of symbolic classification models.")]
    34   [StorableClass]
     34  [StorableType("551DB3E3-56F8-4E92-B538-D453DBA23D77")]
    3535  public sealed class SymbolicClassificationSingleObjectiveOverfittingAnalyzer : SymbolicDataAnalysisSingleObjectiveValidationAnalyzer<ISymbolicClassificationSingleObjectiveEvaluator, IClassificationProblemData> {
    3636    private const string TrainingValidationCorrelationParameterName = "Training and validation fitness correlation";
     
    5959
    6060    [StorableConstructor]
    61     private SymbolicClassificationSingleObjectiveOverfittingAnalyzer(bool deserializing) : base(deserializing) { }
     61    private SymbolicClassificationSingleObjectiveOverfittingAnalyzer(StorableConstructorFlag _) : base(_) { }
    6262    private SymbolicClassificationSingleObjectiveOverfittingAnalyzer(SymbolicClassificationSingleObjectiveOverfittingAnalyzer original, Cloner cloner) : base(original, cloner) { }
    6363    public SymbolicClassificationSingleObjectiveOverfittingAnalyzer()
  • branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/SingleObjective/SymbolicClassificationSingleObjectivePearsonRSquaredEvaluator.cs

    r10291 r17687  
    11#region License Information
    22/* HeuristicLab
    3  * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     3 * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
    44 *
    55 * This file is part of HeuristicLab.
     
    2525using HeuristicLab.Data;
    2626using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
    27 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
     27using HEAL.Attic;
    2828
    2929namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Classification {
    3030  [Item("Pearson R² evaluator", "Calculates the square of the pearson correlation coefficient (also known as coefficient of determination) of a symbolic classification solution.")]
    31   [StorableClass]
     31  [StorableType("F6F480F9-21DC-4D22-9D5C-5951906BEB79")]
    3232  public class SymbolicClassificationSingleObjectivePearsonRSquaredEvaluator : SymbolicClassificationSingleObjectiveEvaluator {
    3333    [StorableConstructor]
    34     protected SymbolicClassificationSingleObjectivePearsonRSquaredEvaluator(bool deserializing) : base(deserializing) { }
     34    protected SymbolicClassificationSingleObjectivePearsonRSquaredEvaluator(StorableConstructorFlag _) : base(_) { }
    3535    protected SymbolicClassificationSingleObjectivePearsonRSquaredEvaluator(SymbolicClassificationSingleObjectivePearsonRSquaredEvaluator original, Cloner cloner)
    3636      : base(original, cloner) {
     
    5757      OnlineCalculatorError errorState;
    5858
    59       double r2;
     59      double r;
    6060      if (applyLinearScaling) {
    61         var r2Calculator = new OnlinePearsonsRSquaredCalculator();
    62         CalculateWithScaling(targetValues, estimatedValues, lowerEstimationLimit, upperEstimationLimit, r2Calculator, problemData.Dataset.Rows);
    63         errorState = r2Calculator.ErrorState;
    64         r2 = r2Calculator.RSquared;
     61        var rCalculator = new OnlinePearsonsRCalculator();
     62        CalculateWithScaling(targetValues, estimatedValues, lowerEstimationLimit, upperEstimationLimit, rCalculator, problemData.Dataset.Rows);
     63        errorState = rCalculator.ErrorState;
     64        r = rCalculator.R;
    6565      } else {
    6666        IEnumerable<double> boundedEstimatedValues = estimatedValues.LimitToRange(lowerEstimationLimit, upperEstimationLimit);
    67         r2 = OnlinePearsonsRSquaredCalculator.Calculate(targetValues, boundedEstimatedValues, out errorState);
     67        r = OnlinePearsonsRCalculator.Calculate(targetValues, boundedEstimatedValues, out errorState);
    6868      }
    6969      if (errorState != OnlineCalculatorError.None) return double.NaN;
    70       return r2;
     70      return r*r;
    7171    }
    7272
  • branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/SingleObjective/SymbolicClassificationSingleObjectivePenaltyScoreEvaluator.cs

    r10291 r17687  
    11#region License Information
    22/* HeuristicLab
    3  * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     3 * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
    44 *
    55 * This file is part of HeuristicLab.
     
    2626using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
    2727using HeuristicLab.Parameters;
    28 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
     28using HEAL.Attic;
    2929
    3030namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Classification {
    3131  [Item("Penalty Score Evaluator", "Calculates the penalty score of a symbolic classification solution.")]
    32   [StorableClass]
     32  [StorableType("59D79396-2CBD-4033-9752-52A44243D554")]
    3333  public class SymbolicClassificationSingleObjectivePenaltyScoreEvaluator : SymbolicClassificationSingleObjectiveEvaluator, ISymbolicClassificationModelCreatorOperator {
    3434    private const string ModelCreatorParameterName = "ModelCreator";
     
    4343
    4444    [StorableConstructor]
    45     protected SymbolicClassificationSingleObjectivePenaltyScoreEvaluator(bool deserializing) : base(deserializing) { }
     45    protected SymbolicClassificationSingleObjectivePenaltyScoreEvaluator(StorableConstructorFlag _) : base(_) { }
    4646    protected SymbolicClassificationSingleObjectivePenaltyScoreEvaluator(SymbolicClassificationSingleObjectivePenaltyScoreEvaluator original, Cloner cloner) : base(original, cloner) { }
    4747    public SymbolicClassificationSingleObjectivePenaltyScoreEvaluator()
     
    9191      ApplyLinearScalingParameter.ExecutionContext = context;
    9292
    93       var model = ModelCreatorParameter.ActualValue.CreateSymbolicClassificationModel(tree, SymbolicDataAnalysisTreeInterpreterParameter.ActualValue, EstimationLimitsParameter.ActualValue.Lower, EstimationLimitsParameter.ActualValue.Upper);
     93      var model = ModelCreatorParameter.ActualValue.CreateSymbolicClassificationModel(problemData.TargetVariable, tree, SymbolicDataAnalysisTreeInterpreterParameter.ActualValue, EstimationLimitsParameter.ActualValue.Lower, EstimationLimitsParameter.ActualValue.Upper);
    9494      if (ApplyLinearScalingParameter.ActualValue.Value) model.Scale(problemData);
    9595      model.RecalculateModelParameters(problemData, rows);
  • branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/SingleObjective/SymbolicClassificationSingleObjectiveProblem.cs

    r9456 r17687  
    11#region License Information
    22/* HeuristicLab
    3  * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     3 * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
    44 *
    55 * This file is part of HeuristicLab.
     
    2222using HeuristicLab.Common;
    2323using HeuristicLab.Core;
     24using HeuristicLab.Optimization;
    2425using HeuristicLab.Parameters;
    25 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
     26using HEAL.Attic;
    2627
    2728namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Classification {
    28   [Item("Symbolic Classification Problem (single objective)", "Represents a single objective symbolic classfication problem.")]
    29   [StorableClass]
    30   [Creatable("Problems")]
     29  [Item("Symbolic Classification Problem (single-objective)", "Represents a single objective symbolic classfication problem.")]
     30  [StorableType("9C6166E7-9F34-403B-8654-22FFC77A2CAE")]
     31  [Creatable(CreatableAttribute.Categories.GeneticProgrammingProblems, Priority = 120)]
    3132  public class SymbolicClassificationSingleObjectiveProblem : SymbolicDataAnalysisSingleObjectiveProblem<IClassificationProblemData, ISymbolicClassificationSingleObjectiveEvaluator, ISymbolicDataAnalysisSolutionCreator>, IClassificationProblem {
    3233    private const double PunishmentFactor = 10;
     
    5455    #endregion
    5556    [StorableConstructor]
    56     protected SymbolicClassificationSingleObjectiveProblem(bool deserializing) : base(deserializing) { }
     57    protected SymbolicClassificationSingleObjectiveProblem(StorableConstructorFlag _) : base(_) { }
    5758    protected SymbolicClassificationSingleObjectiveProblem(SymbolicClassificationSingleObjectiveProblem original, Cloner cloner)
    5859      : base(original, cloner) {
     
    115116      Operators.Add(new SymbolicClassificationSingleObjectiveTrainingParetoBestSolutionAnalyzer());
    116117      Operators.Add(new SymbolicClassificationSingleObjectiveValidationParetoBestSolutionAnalyzer());
     118      Operators.Add(new SymbolicExpressionTreePhenotypicSimilarityCalculator());
     119      Operators.Add(new SymbolicClassificationPhenotypicDiversityAnalyzer(Operators.OfType<SymbolicExpressionTreePhenotypicSimilarityCalculator>()));
    117120      ParameterizeOperators();
    118121    }
     
    145148          op.ModelCreatorParameter.ActualName = ModelCreatorParameter.Name;
    146149      }
     150
     151      foreach (var op in Operators.OfType<ISolutionSimilarityCalculator>()) {
     152        op.SolutionVariableName = SolutionCreator.SymbolicExpressionTreeParameter.ActualName;
     153        op.QualityVariableName = Evaluator.QualityParameter.ActualName;
     154
     155        if (op is SymbolicExpressionTreePhenotypicSimilarityCalculator) {
     156          var phenotypicSimilarityCalculator = (SymbolicExpressionTreePhenotypicSimilarityCalculator)op;
     157          phenotypicSimilarityCalculator.ProblemData = ProblemData;
     158          phenotypicSimilarityCalculator.Interpreter = SymbolicExpressionTreeInterpreter;
     159        }
     160      }
    147161    }
    148162  }
  • branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/SingleObjective/SymbolicClassificationSingleObjectiveTrainingBestSolutionAnalyzer.cs

    r9456 r17687  
    11#region License Information
    22/* HeuristicLab
    3  * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     3 * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
    44 *
    55 * This file is part of HeuristicLab.
     
    2424using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
    2525using HeuristicLab.Parameters;
    26 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
     26using HEAL.Attic;
    2727
    2828namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Classification {
     
    3131  /// </summary>
    3232  [Item("SymbolicClassificationSingleObjectiveTrainingBestSolutionAnalyzer", "An operator that analyzes the training best symbolic classification solution for single objective symbolic classification problems.")]
    33   [StorableClass]
     33  [StorableType("1E179E22-DD6C-4914-8FAA-AB8F7F9B7F7F")]
    3434  public sealed class SymbolicClassificationSingleObjectiveTrainingBestSolutionAnalyzer : SymbolicDataAnalysisSingleObjectiveTrainingBestSolutionAnalyzer<ISymbolicClassificationSolution>,
    3535    ISymbolicDataAnalysisInterpreterOperator, ISymbolicDataAnalysisBoundedOperator, ISymbolicClassificationModelCreatorOperator {
     
    5858
    5959    [StorableConstructor]
    60     private SymbolicClassificationSingleObjectiveTrainingBestSolutionAnalyzer(bool deserializing) : base(deserializing) { }
     60    private SymbolicClassificationSingleObjectiveTrainingBestSolutionAnalyzer(StorableConstructorFlag _) : base(_) { }
    6161    private SymbolicClassificationSingleObjectiveTrainingBestSolutionAnalyzer(SymbolicClassificationSingleObjectiveTrainingBestSolutionAnalyzer original, Cloner cloner) : base(original, cloner) { }
    6262    public SymbolicClassificationSingleObjectiveTrainingBestSolutionAnalyzer()
     
    8181
    8282    protected override ISymbolicClassificationSolution CreateSolution(ISymbolicExpressionTree bestTree, double bestQuality) {
    83       var model = ModelCreatorParameter.ActualValue.CreateSymbolicClassificationModel((ISymbolicExpressionTree)bestTree.Clone(), SymbolicDataAnalysisTreeInterpreterParameter.ActualValue, EstimationLimitsParameter.ActualValue.Lower, EstimationLimitsParameter.ActualValue.Upper);
     83      var model = ModelCreatorParameter.ActualValue.CreateSymbolicClassificationModel(ProblemDataParameter.ActualValue.TargetVariable, (ISymbolicExpressionTree)bestTree.Clone(), SymbolicDataAnalysisTreeInterpreterParameter.ActualValue, EstimationLimitsParameter.ActualValue.Lower, EstimationLimitsParameter.ActualValue.Upper);
    8484      if (ApplyLinearScalingParameter.ActualValue.Value) model.Scale(ProblemDataParameter.ActualValue);
    8585
  • branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/SingleObjective/SymbolicClassificationSingleObjectiveTrainingParetoBestSolutionAnalyzer.cs

    r9456 r17687  
    11#region License Information
    22/* HeuristicLab
    3  * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     3 * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
    44 *
    55 * This file is part of HeuristicLab.
     
    2424using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
    2525using HeuristicLab.Parameters;
    26 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
     26using HEAL.Attic;
    2727
    2828namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Classification {
     
    3131  /// </summary>
    3232  [Item("SymbolicClassificationSingleObjectiveTrainingParetoBestSolutionAnalyzer", "An operator that collects the training Pareto-best symbolic classification solutions for single objective symbolic classification problems.")]
    33   [StorableClass]
     33  [StorableType("881573CA-7246-4203-B5C9-10793325A008")]
    3434  public sealed class SymbolicClassificationSingleObjectiveTrainingParetoBestSolutionAnalyzer : SymbolicDataAnalysisSingleObjectiveTrainingParetoBestSolutionAnalyzer<IClassificationProblemData, ISymbolicClassificationSolution>, ISymbolicClassificationModelCreatorOperator {
    3535    private const string ModelCreatorParameterName = "ModelCreator";
     
    4444
    4545    [StorableConstructor]
    46     private SymbolicClassificationSingleObjectiveTrainingParetoBestSolutionAnalyzer(bool deserializing) : base(deserializing) { }
     46    private SymbolicClassificationSingleObjectiveTrainingParetoBestSolutionAnalyzer(StorableConstructorFlag _) : base(_) { }
    4747    private SymbolicClassificationSingleObjectiveTrainingParetoBestSolutionAnalyzer(SymbolicClassificationSingleObjectiveTrainingParetoBestSolutionAnalyzer original, Cloner cloner) : base(original, cloner) { }
    4848    public SymbolicClassificationSingleObjectiveTrainingParetoBestSolutionAnalyzer()
     
    6464
    6565    protected override ISymbolicClassificationSolution CreateSolution(ISymbolicExpressionTree bestTree) {
    66       var model = ModelCreatorParameter.ActualValue.CreateSymbolicClassificationModel((ISymbolicExpressionTree)bestTree.Clone(), SymbolicDataAnalysisTreeInterpreterParameter.ActualValue, EstimationLimitsParameter.ActualValue.Lower, EstimationLimitsParameter.ActualValue.Upper);
     66      var model = ModelCreatorParameter.ActualValue.CreateSymbolicClassificationModel(ProblemDataParameter.ActualValue.TargetVariable, (ISymbolicExpressionTree)bestTree.Clone(), SymbolicDataAnalysisTreeInterpreterParameter.ActualValue, EstimationLimitsParameter.ActualValue.Lower, EstimationLimitsParameter.ActualValue.Upper);
    6767      if (ApplyLinearScalingParameter.ActualValue.Value) model.Scale(ProblemDataParameter.ActualValue);
    6868
  • branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/SingleObjective/SymbolicClassificationSingleObjectiveValidationBestSolutionAnalyzer.cs

    r9456 r17687  
    11#region License Information
    22/* HeuristicLab
    3  * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     3 * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
    44 *
    55 * This file is part of HeuristicLab.
     
    2424using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
    2525using HeuristicLab.Parameters;
    26 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
     26using HEAL.Attic;
    2727
    2828namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Classification {
     
    3131  /// </summary>
    3232  [Item("SymbolicClassificationSingleObjectiveValidationBestSolutionAnalyzer", "An operator that analyzes the validation best symbolic classification solution for single objective symbolic classification problems.")]
    33   [StorableClass]
     33  [StorableType("4BEB7C5A-0B3A-4276-95C6-689F8BA8E0E6")]
    3434  public sealed class SymbolicClassificationSingleObjectiveValidationBestSolutionAnalyzer : SymbolicDataAnalysisSingleObjectiveValidationBestSolutionAnalyzer<ISymbolicClassificationSolution, ISymbolicClassificationSingleObjectiveEvaluator, IClassificationProblemData>,
    3535  ISymbolicDataAnalysisBoundedOperator, ISymbolicClassificationModelCreatorOperator {
     
    5050
    5151    [StorableConstructor]
    52     private SymbolicClassificationSingleObjectiveValidationBestSolutionAnalyzer(bool deserializing) : base(deserializing) { }
     52    private SymbolicClassificationSingleObjectiveValidationBestSolutionAnalyzer(StorableConstructorFlag _) : base(_) { }
    5353    private SymbolicClassificationSingleObjectiveValidationBestSolutionAnalyzer(SymbolicClassificationSingleObjectiveValidationBestSolutionAnalyzer original, Cloner cloner) : base(original, cloner) { }
    5454    public SymbolicClassificationSingleObjectiveValidationBestSolutionAnalyzer()
     
    7171
    7272    protected override ISymbolicClassificationSolution CreateSolution(ISymbolicExpressionTree bestTree, double bestQuality) {
    73       var model = ModelCreatorParameter.ActualValue.CreateSymbolicClassificationModel((ISymbolicExpressionTree)bestTree.Clone(), SymbolicDataAnalysisTreeInterpreterParameter.ActualValue, EstimationLimitsParameter.ActualValue.Lower, EstimationLimitsParameter.ActualValue.Upper);
     73      var model = ModelCreatorParameter.ActualValue.CreateSymbolicClassificationModel(ProblemDataParameter.ActualValue.TargetVariable, (ISymbolicExpressionTree)bestTree.Clone(), SymbolicDataAnalysisTreeInterpreterParameter.ActualValue, EstimationLimitsParameter.ActualValue.Lower, EstimationLimitsParameter.ActualValue.Upper);
    7474      if (ApplyLinearScalingParameter.ActualValue.Value) model.Scale(ProblemDataParameter.ActualValue);
    7575
  • branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/SingleObjective/SymbolicClassificationSingleObjectiveValidationParetoBestSolutionAnalyzer.cs

    r9456 r17687  
    11#region License Information
    22/* HeuristicLab
    3  * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     3 * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
    44 *
    55 * This file is part of HeuristicLab.
     
    2424using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
    2525using HeuristicLab.Parameters;
    26 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
     26using HEAL.Attic;
    2727
    2828namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Classification {
     
    3131  /// </summary>
    3232  [Item("SymbolicClassificationSingleObjectiveValidationParetoBestSolutionAnalyzer", "An operator that collects the validation Pareto-best symbolic classification solutions for single objective symbolic classification problems.")]
    33   [StorableClass]
     33  [StorableType("DCD4AFE1-B6E5-4A97-BEB3-1BF3E336DD78")]
    3434  public sealed class SymbolicClassificationSingleObjectiveValidationParetoBestSolutionAnalyzer : SymbolicDataAnalysisSingleObjectiveValidationParetoBestSolutionAnalyzer<ISymbolicClassificationSolution, ISymbolicClassificationSingleObjectiveEvaluator, IClassificationProblemData>, ISymbolicClassificationModelCreatorOperator {
    3535    private const string ModelCreatorParameterName = "ModelCreator";
     
    4444
    4545    [StorableConstructor]
    46     private SymbolicClassificationSingleObjectiveValidationParetoBestSolutionAnalyzer(bool deserializing) : base(deserializing) { }
     46    private SymbolicClassificationSingleObjectiveValidationParetoBestSolutionAnalyzer(StorableConstructorFlag _) : base(_) { }
    4747    private SymbolicClassificationSingleObjectiveValidationParetoBestSolutionAnalyzer(SymbolicClassificationSingleObjectiveValidationParetoBestSolutionAnalyzer original, Cloner cloner) : base(original, cloner) { }
    4848    public SymbolicClassificationSingleObjectiveValidationParetoBestSolutionAnalyzer()
     
    6464
    6565    protected override ISymbolicClassificationSolution CreateSolution(ISymbolicExpressionTree bestTree) {
    66       var model = ModelCreatorParameter.ActualValue.CreateSymbolicClassificationModel((ISymbolicExpressionTree)bestTree.Clone(), SymbolicDataAnalysisTreeInterpreterParameter.ActualValue, EstimationLimitsParameter.ActualValue.Lower, EstimationLimitsParameter.ActualValue.Upper);
     66      var model = ModelCreatorParameter.ActualValue.CreateSymbolicClassificationModel(ProblemDataParameter.ActualValue.TargetVariable, (ISymbolicExpressionTree)bestTree.Clone(), SymbolicDataAnalysisTreeInterpreterParameter.ActualValue, EstimationLimitsParameter.ActualValue.Lower, EstimationLimitsParameter.ActualValue.Upper);
    6767      if (ApplyLinearScalingParameter.ActualValue.Value) model.Scale(ProblemDataParameter.ActualValue);
    6868
  • branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/Sliding Window/GenerationalClassificationSlidingWindowAnalyzer.cs

    r10681 r17687  
    2424using HeuristicLab.Optimization;
    2525using HeuristicLab.Parameters;
    26 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
     26using HEAL.Attic;
    2727
    2828namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Classification {
    29   [StorableClass]
    3029  [Item("Generational Classification Sliding Window Analyzer", "")]
     30  [StorableType("62291FAE-D74F-41FC-98D0-A5B23450B39F")]
    3131  public class GenerationalClassificationSlidingWindowAnalyzer : GenerationalSlidingWindowAnalyzer {
    3232    private const string ModelCreatorParameterName = "ModelCreator";
     
    4343    #endregion
    4444    [StorableConstructor]
    45     protected GenerationalClassificationSlidingWindowAnalyzer(bool deserializing) : base(deserializing) { }
     45    protected GenerationalClassificationSlidingWindowAnalyzer(StorableConstructorFlag _) : base(_) { }
    4646    [StorableHook(HookType.AfterDeserialization)]
    4747    private void AfterDeserialization() { }
  • branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/Sliding Window/OffspringSelectionClassificationSlidingWindowAnalyzer.cs

    r10681 r17687  
    2525using HeuristicLab.Parameters;
    2626using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
     27using HEAL.Attic;
    2728
    2829namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Classification {
    29   [StorableClass]
    3030  [Item("Offspring Selection Classification Sliding Window Analyzer", "")]
     31  [StorableType("D9D8C0D5-47D2-4FDF-B480-1A17D5D21EB1")]
    3132  public class OffspringSelectionClassificationSlidingWindowAnalyzer : OffspringSelectionSlidingWindowAnalyzer {
    3233    private const string ModelCreatorParameterName = "ModelCreator";
     
    4344    #endregion
    4445    [StorableConstructor]
    45     protected OffspringSelectionClassificationSlidingWindowAnalyzer(bool deserializing) : base(deserializing) { }
     46    protected OffspringSelectionClassificationSlidingWindowAnalyzer(StorableConstructorFlag _) : base(_) { }
    4647    [StorableHook(HookType.AfterDeserialization)]
    4748    private void AfterDeserialization() { }
  • branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/Sliding Window/SlidingWindowBestClassificationSolutionsCollection.cs

    r10681 r17687  
    2323using HeuristicLab.Core;
    2424using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
    25 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
     25using HEAL.Attic;
    2626
    2727namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Classification {
    28   [StorableClass]
    2928  [Item("Sliding Window Best Classification Solutions Collection", "A collection of best sliding window solutions for symbolic classification.")]
     29  [StorableType("65F9CF37-643A-4236-AA36-8721BA03B006")]
    3030  public class SlidingWindowBestClassificationSolutionsCollection : SlidingWindowBestSolutionsCollection {
    3131    public new IClassificationProblemData ProblemData {
     
    3535    public ISymbolicClassificationModelCreator ModelCreator { get; set; }
    3636    [StorableConstructor]
    37     protected SlidingWindowBestClassificationSolutionsCollection(bool deserializing) : base(deserializing) { }
     37    protected SlidingWindowBestClassificationSolutionsCollection(StorableConstructorFlag _) : base(_) { }
    3838    [StorableHook(HookType.AfterDeserialization)]
    3939    private void AfterDeserialization() { }
     
    4747    public override ISymbolicDataAnalysisModel CreateModel(ISymbolicExpressionTree tree, ISymbolicDataAnalysisExpressionTreeInterpreter interpreter,
    4848      double lowerEstimationLimit = double.MinValue, double upperEstimationLimit = double.MaxValue) {
    49       var model = ModelCreator.CreateSymbolicClassificationModel(tree, interpreter, lowerEstimationLimit, upperEstimationLimit);
     49      var model = ModelCreator.CreateSymbolicClassificationModel(ProblemData.TargetVariable,tree, interpreter, lowerEstimationLimit, upperEstimationLimit);
    5050      model.RecalculateModelParameters(ProblemData, ProblemData.TrainingIndices);
    5151      return model;
  • branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/SymbolicClassificationModel.cs

    r9587 r17687  
    11#region License Information
    22/* HeuristicLab
    3  * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     3 * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
    44 *
    55 * This file is part of HeuristicLab.
     
    2020#endregion
    2121
     22using System;
    2223using System.Collections.Generic;
    2324using HeuristicLab.Common;
    2425using HeuristicLab.Core;
    2526using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
    26 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
     27using HEAL.Attic;
    2728
    2829namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Classification {
     
    3031  /// Represents a symbolic classification model
    3132  /// </summary>
    32   [StorableClass]
     33  [StorableType("8AEAF4A5-839D-4070-A348-440E79110C74")]
    3334  [Item(Name = "SymbolicClassificationModel", Description = "Represents a symbolic classification model.")]
    3435  public abstract class SymbolicClassificationModel : SymbolicDataAnalysisModel, ISymbolicClassificationModel {
     36    [Storable]
     37    private string targetVariable;
     38    public string TargetVariable {
     39      get { return targetVariable; }
     40      set {
     41        if (string.IsNullOrEmpty(value) || targetVariable == value) return;
     42        targetVariable = value;
     43        OnTargetVariableChanged(this, EventArgs.Empty);
     44      }
     45    }
    3546
    3647    [StorableConstructor]
    37     protected SymbolicClassificationModel(bool deserializing) : base(deserializing) { }
    38     protected SymbolicClassificationModel(SymbolicClassificationModel original, Cloner cloner) : base(original, cloner) { }
    39     protected SymbolicClassificationModel(ISymbolicExpressionTree tree, ISymbolicDataAnalysisExpressionTreeInterpreter interpreter,
    40       double lowerEstimationLimit = double.MinValue, double upperEstimationLimit = double.MaxValue)
    41       : base(tree, interpreter, lowerEstimationLimit, upperEstimationLimit) { }
     48    protected SymbolicClassificationModel(StorableConstructorFlag _) : base(_) {
     49      targetVariable = string.Empty;
     50    }
    4251
    43     public abstract IEnumerable<double> GetEstimatedClassValues(Dataset dataset, IEnumerable<int> rows);
     52    protected SymbolicClassificationModel(SymbolicClassificationModel original, Cloner cloner)
     53      : base(original, cloner) {
     54      targetVariable = original.targetVariable;
     55    }
     56
     57    protected SymbolicClassificationModel(string targetVariable, ISymbolicExpressionTree tree, ISymbolicDataAnalysisExpressionTreeInterpreter interpreter, double lowerEstimationLimit = double.MinValue, double upperEstimationLimit = double.MaxValue)
     58      : base(tree, interpreter, lowerEstimationLimit, upperEstimationLimit) {
     59      this.targetVariable = targetVariable;
     60    }
     61
     62    public abstract IEnumerable<double> GetEstimatedClassValues(IDataset dataset, IEnumerable<int> rows);
    4463    public abstract void RecalculateModelParameters(IClassificationProblemData problemData, IEnumerable<int> rows);
    4564
     
    5372      Scale(problemData, problemData.TargetVariable);
    5473    }
     74
     75    public virtual bool IsProblemDataCompatible(IClassificationProblemData problemData, out string errorMessage) {
     76      return ClassificationModel.IsProblemDataCompatible(this, problemData, out errorMessage);
     77    }
     78
     79    public override bool IsProblemDataCompatible(IDataAnalysisProblemData problemData, out string errorMessage) {
     80      if (problemData == null) throw new ArgumentNullException("problemData", "The provided problemData is null.");
     81      var classificationProblemData = problemData as IClassificationProblemData;
     82      if (classificationProblemData == null)
     83        throw new ArgumentException("The problem data is not compatible with this classification model. Instead a " + problemData.GetType().GetPrettyName() + " was provided.", "problemData");
     84      return IsProblemDataCompatible(classificationProblemData, out errorMessage);
     85    }
     86
     87    #region events
     88    public event EventHandler TargetVariableChanged;
     89    private void OnTargetVariableChanged(object sender, EventArgs args) {
     90      var changed = TargetVariableChanged;
     91      if (changed != null)
     92        changed(sender, args);
     93    }
     94    #endregion
    5595  }
    5696}
  • branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/SymbolicClassificationPhenotypicDiversityAnalyzer.cs

    r15681 r17687  
    11#region License Information
    22/* HeuristicLab
    3  * Copyright (C) 2002-2018 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     3 * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
    44 *
    55 * This file is part of HeuristicLab.
     
    2929using HeuristicLab.Optimization;
    3030using HeuristicLab.Parameters;
    31 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
     31using HEAL.Attic;
    3232
    3333namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Classification {
    3434  [Item("SymbolicClassificationPhenotypicDiversityAnalyzer", "An analyzer which calculates diversity based on the phenotypic distance between trees")]
    35   [StorableClass]
     35  [StorableType("D09C1CC5-2BFB-4B5C-A496-F8EA98741C37")]
    3636  public class SymbolicClassificationPhenotypicDiversityAnalyzer : PopulationSimilarityAnalyzer,
    3737    ISymbolicDataAnalysisBoundedOperator, ISymbolicDataAnalysisInterpreterOperator, ISymbolicExpressionTreeAnalyzer {
     
    9494
    9595    [StorableConstructor]
    96     protected SymbolicClassificationPhenotypicDiversityAnalyzer(bool deserializing)
    97       : base(deserializing) {
     96    protected SymbolicClassificationPhenotypicDiversityAnalyzer(StorableConstructorFlag _) : base(_) {
    9897    }
    9998
  • branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/SymbolicClassificationPruningAnalyzer.cs

    r10469 r17687  
    11#region License Information
    22/* HeuristicLab
    3  * Copyright (C) 2002-2014 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     3 * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
    44 *
    55 * This file is part of HeuristicLab.
     
    2222using HeuristicLab.Common;
    2323using HeuristicLab.Core;
     24using HeuristicLab.Data;
    2425using HeuristicLab.Parameters;
    25 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
     26using HEAL.Attic;
    2627
    2728namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Classification {
    2829  [Item("SymbolicClassificationPruningAnalyzer", "An analyzer that prunes introns from the population.")]
    29   [StorableClass]
     30  [StorableType("26701D59-DEB6-4CBF-89DC-C5C3F310B634")]
    3031  public sealed class SymbolicClassificationPruningAnalyzer : SymbolicDataAnalysisSingleObjectivePruningAnalyzer {
    31     private const string ImpactValuesCalculatorParameterName = "ImpactValuesCalculator";
    3232    private const string PruningOperatorParameterName = "PruningOperator";
    33     private SymbolicClassificationPruningAnalyzer(SymbolicClassificationPruningAnalyzer original, Cloner cloner)
    34       : base(original, cloner) {
    35     }
    36     public override IDeepCloneable Clone(Cloner cloner) {
    37       return new SymbolicClassificationPruningAnalyzer(this, cloner);
     33    public IValueParameter<SymbolicClassificationPruningOperator> PruningOperatorParameter {
     34      get { return (IValueParameter<SymbolicClassificationPruningOperator>)Parameters[PruningOperatorParameterName]; }
    3835    }
    3936
     37    protected override SymbolicDataAnalysisExpressionPruningOperator PruningOperator {
     38      get { return PruningOperatorParameter.Value; }
     39    }
     40
     41    private SymbolicClassificationPruningAnalyzer(SymbolicClassificationPruningAnalyzer original, Cloner cloner) : base(original, cloner) { }
     42    public override IDeepCloneable Clone(Cloner cloner) { return new SymbolicClassificationPruningAnalyzer(this, cloner); }
     43
    4044    [StorableConstructor]
    41     private SymbolicClassificationPruningAnalyzer(bool deserializing) : base(deserializing) { }
     45    private SymbolicClassificationPruningAnalyzer(StorableConstructorFlag _) : base(_) { }
    4246
    4347    public SymbolicClassificationPruningAnalyzer() {
    44       Parameters.Add(new ValueParameter<SymbolicDataAnalysisSolutionImpactValuesCalculator>(ImpactValuesCalculatorParameterName, "The impact values calculator", new SymbolicClassificationSolutionImpactValuesCalculator()));
    45       Parameters.Add(new ValueParameter<SymbolicDataAnalysisExpressionPruningOperator>(PruningOperatorParameterName, "The operator used to prune trees", new SymbolicClassificationPruningOperator()));
     48      Parameters.Add(new ValueParameter<SymbolicClassificationPruningOperator>(PruningOperatorParameterName, "The operator used to prune trees", new SymbolicClassificationPruningOperator(new SymbolicClassificationSolutionImpactValuesCalculator())));
     49    }
     50
     51    [StorableHook(HookType.AfterDeserialization)]
     52    private void AfterDeserialization() {
     53      // BackwardsCompatibility3.3
     54
     55      #region Backwards compatible code, remove with 3.4
     56      if (Parameters.ContainsKey(PruningOperatorParameterName)) {
     57        var oldParam = Parameters[PruningOperatorParameterName] as ValueParameter<SymbolicDataAnalysisExpressionPruningOperator>;
     58        if (oldParam != null) {
     59          Parameters.Remove(oldParam);
     60          Parameters.Add(new ValueParameter<SymbolicClassificationPruningOperator>(PruningOperatorParameterName, "The operator used to prune trees", new SymbolicClassificationPruningOperator(new SymbolicClassificationSolutionImpactValuesCalculator())));
     61        }
     62      } else {
     63        // not yet contained
     64        Parameters.Add(new ValueParameter<SymbolicClassificationPruningOperator>(PruningOperatorParameterName, "The operator used to prune trees", new SymbolicClassificationPruningOperator(new SymbolicClassificationSolutionImpactValuesCalculator())));
     65      }
     66
     67      if (Parameters.ContainsKey("PruneOnlyZeroImpactNodes")) {
     68        PruningOperator.PruneOnlyZeroImpactNodes = ((IFixedValueParameter<BoolValue>)Parameters["PruneOnlyZeroImpactNodes"]).Value.Value;
     69        Parameters.Remove(Parameters["PruneOnlyZeroImpactNodes"]);
     70      }
     71      if (Parameters.ContainsKey("ImpactThreshold")) {
     72        PruningOperator.NodeImpactThreshold = ((IFixedValueParameter<DoubleValue>)Parameters["ImpactThreshold"]).Value.Value;
     73        Parameters.Remove(Parameters["ImpactThreshold"]);
     74      }
     75      if (Parameters.ContainsKey("ImpactValuesCalculator")) {
     76        PruningOperator.ImpactValuesCalculator = ((ValueParameter<SymbolicDataAnalysisSolutionImpactValuesCalculator>)Parameters["ImpactValuesCalculator"]).Value;
     77        Parameters.Remove(Parameters["ImpactValuesCalculator"]);
     78      }
     79      #endregion
    4680    }
    4781  }
  • branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/SymbolicClassificationPruningOperator.cs

    r10681 r17687  
    1 using System.Linq;
     1#region License Information
     2
     3/* HeuristicLab
     4 * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     5 *
     6 * This file is part of HeuristicLab.
     7 *
     8 * HeuristicLab is free software: you can redistribute it and/or modify
     9 * it under the terms of the GNU General Public License as published by
     10 * the Free Software Foundation, either version 3 of the License, or
     11 * (at your option) any later version.
     12 *
     13 * HeuristicLab is distributed in the hope that it will be useful,
     14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
     15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     16 * GNU General Public License for more details.
     17 *
     18 * You should have received a copy of the GNU General Public License
     19 * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
     20 */
     21
     22#endregion
     23
     24using System.Collections.Generic;
     25using System.Linq;
    226using HeuristicLab.Common;
    327using HeuristicLab.Core;
    4 using HeuristicLab.Data;
     28using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
    529using HeuristicLab.Parameters;
    6 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
     30using HEAL.Attic;
    731
    832namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Classification {
    9   [StorableClass]
     33  [StorableType("F213025F-ACE7-4E43-A149-70C3AD824D19")]
    1034  [Item("SymbolicClassificationPruningOperator", "An operator which prunes symbolic classificaton trees.")]
    1135  public class SymbolicClassificationPruningOperator : SymbolicDataAnalysisExpressionPruningOperator {
    12     private const string ImpactValuesCalculatorParameterName = "ImpactValuesCalculator";
    1336    private const string ModelCreatorParameterName = "ModelCreator";
    14     private const string ApplyLinearScalingParmameterName = "ApplyLinearScaling";
     37    private const string EvaluatorParameterName = "Evaluator";
    1538
    1639    #region parameter properties
     
    1942    }
    2043
    21     public ILookupParameter<BoolValue> ApplyLinearScalingParameter {
    22       get { return (ILookupParameter<BoolValue>)Parameters[ApplyLinearScalingParmameterName]; }
     44    public ILookupParameter<ISymbolicClassificationSingleObjectiveEvaluator> EvaluatorParameter {
     45      get {
     46        return (ILookupParameter<ISymbolicClassificationSingleObjectiveEvaluator>)Parameters[EvaluatorParameterName];
     47      }
    2348    }
    2449    #endregion
    25     #region properties
    26     private ISymbolicClassificationModelCreator ModelCreator { get { return ModelCreatorParameter.ActualValue; } }
    27     private BoolValue ApplyLinearScaling { get { return ApplyLinearScalingParameter.ActualValue; } }
    28     #endregion
    2950
    30     protected SymbolicClassificationPruningOperator(SymbolicClassificationPruningOperator
    31       original, Cloner cloner)
    32       : base(original, cloner) {
    33     }
    34     public override IDeepCloneable Clone(Cloner cloner) {
    35       return new SymbolicClassificationPruningOperator(this, cloner);
     51    protected SymbolicClassificationPruningOperator(SymbolicClassificationPruningOperator original, Cloner cloner) : base(original, cloner) { }
     52    public override IDeepCloneable Clone(Cloner cloner) { return new SymbolicClassificationPruningOperator(this, cloner); }
     53
     54    [StorableConstructor]
     55    protected SymbolicClassificationPruningOperator(StorableConstructorFlag _) : base(_) { }
     56
     57    public SymbolicClassificationPruningOperator(ISymbolicDataAnalysisSolutionImpactValuesCalculator impactValuesCalculator)
     58      : base(impactValuesCalculator) {
     59      Parameters.Add(new LookupParameter<ISymbolicClassificationModelCreator>(ModelCreatorParameterName));
     60      Parameters.Add(new LookupParameter<ISymbolicClassificationSingleObjectiveEvaluator>(EvaluatorParameterName));
    3661    }
    3762
    38     [StorableConstructor]
    39     protected SymbolicClassificationPruningOperator(bool deserializing) : base(deserializing) { }
    40 
    41     public SymbolicClassificationPruningOperator() {
    42       Parameters.Add(new ValueParameter<ISymbolicDataAnalysisSolutionImpactValuesCalculator>(ImpactValuesCalculatorParameterName, new SymbolicClassificationSolutionImpactValuesCalculator()));
    43       Parameters.Add(new LookupParameter<ISymbolicClassificationModelCreator>(ModelCreatorParameterName));
     63    [StorableHook(HookType.AfterDeserialization)]
     64    private void AfterDeserialization() {
     65      // BackwardsCompatibility3.3
     66      #region Backwards compatible code, remove with 3.4
     67      base.ImpactValuesCalculator = new SymbolicClassificationSolutionImpactValuesCalculator();
     68      if (!Parameters.ContainsKey(EvaluatorParameterName)) {
     69        Parameters.Add(new LookupParameter<ISymbolicClassificationSingleObjectiveEvaluator>(EvaluatorParameterName));
     70      }
     71      #endregion
    4472    }
    4573
    46     protected override ISymbolicDataAnalysisModel CreateModel() {
    47       var model = ModelCreator.CreateSymbolicClassificationModel(SymbolicExpressionTree, Interpreter, EstimationLimits.Lower, EstimationLimits.Upper);
    48       var rows = Enumerable.Range(FitnessCalculationPartition.Start, FitnessCalculationPartition.Size);
    49       var problemData = (IClassificationProblemData)ProblemData;
    50       model.RecalculateModelParameters(problemData, rows);
     74    protected override ISymbolicDataAnalysisModel CreateModel(ISymbolicExpressionTree tree, ISymbolicDataAnalysisExpressionTreeInterpreter interpreter, IDataAnalysisProblemData problemData, DoubleLimit estimationLimits) {
     75      var classificationProblemData = (IClassificationProblemData)problemData;
     76      var model = ModelCreatorParameter.ActualValue.CreateSymbolicClassificationModel(classificationProblemData.TargetVariable, tree, interpreter, estimationLimits.Lower, estimationLimits.Upper);
     77
     78      var rows = classificationProblemData.TrainingIndices;
     79      model.RecalculateModelParameters(classificationProblemData, rows);
    5180      return model;
    5281    }
    5382
    5483    protected override double Evaluate(IDataAnalysisModel model) {
    55       var classificationModel = (IClassificationModel)model;
    56       var classificationProblemData = (IClassificationProblemData)ProblemData;
    57       var trainingIndices = ProblemData.TrainingIndices.ToList();
    58       var estimatedValues = classificationModel.GetEstimatedClassValues(ProblemData.Dataset, trainingIndices);
    59       var targetValues = ProblemData.Dataset.GetDoubleValues(classificationProblemData.TargetVariable, trainingIndices);
    60       OnlineCalculatorError errorState;
    61       var quality = OnlinePearsonsRSquaredCalculator.Calculate(targetValues, estimatedValues, out errorState);
    62       if (errorState != OnlineCalculatorError.None) return double.NaN;
    63       return quality;
     84      var evaluator = EvaluatorParameter.ActualValue;
     85      var classificationModel = (ISymbolicClassificationModel)model;
     86      var classificationProblemData = (IClassificationProblemData)ProblemDataParameter.ActualValue;
     87      var rows = Enumerable.Range(FitnessCalculationPartitionParameter.ActualValue.Start, FitnessCalculationPartitionParameter.ActualValue.Size);
     88      return evaluator.Evaluate(this.ExecutionContext, classificationModel.SymbolicExpressionTree, classificationProblemData, rows);
     89    }
     90
     91    public static ISymbolicExpressionTree Prune(ISymbolicExpressionTree tree, ISymbolicClassificationModelCreator modelCreator,
     92      SymbolicClassificationSolutionImpactValuesCalculator impactValuesCalculator, ISymbolicDataAnalysisExpressionTreeInterpreter interpreter,
     93      IClassificationProblemData problemData, DoubleLimit estimationLimits, IEnumerable<int> rows,
     94      double nodeImpactThreshold = 0.0, bool pruneOnlyZeroImpactNodes = false) {
     95      var clonedTree = (ISymbolicExpressionTree)tree.Clone();
     96      var model = modelCreator.CreateSymbolicClassificationModel(problemData.TargetVariable, clonedTree, interpreter, estimationLimits.Lower, estimationLimits.Upper);
     97
     98      var nodes = clonedTree.Root.GetSubtree(0).GetSubtree(0).IterateNodesPrefix().ToList();
     99      double qualityForImpactsCalculation = double.NaN;
     100
     101      for (int i = 0; i < nodes.Count; ++i) {
     102        var node = nodes[i];
     103        if (node is ConstantTreeNode) continue;
     104
     105        double impactValue, replacementValue, newQualityForImpactsCalculation;
     106        impactValuesCalculator.CalculateImpactAndReplacementValues(model, node, problemData, rows, out impactValue, out replacementValue, out newQualityForImpactsCalculation, qualityForImpactsCalculation);
     107
     108        if (pruneOnlyZeroImpactNodes && !impactValue.IsAlmost(0.0)) continue;
     109        if (!pruneOnlyZeroImpactNodes && impactValue > nodeImpactThreshold) continue;
     110
     111        var constantNode = (ConstantTreeNode)node.Grammar.GetSymbol("Constant").CreateTreeNode();
     112        constantNode.Value = replacementValue;
     113
     114        ReplaceWithConstant(node, constantNode);
     115        i += node.GetLength() - 1; // skip subtrees under the node that was folded
     116
     117        qualityForImpactsCalculation = newQualityForImpactsCalculation;
     118      }
     119      return model.SymbolicExpressionTree;
    64120    }
    65121  }
  • branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/SymbolicClassificationSolution.cs

    r9456 r17687  
    11#region License Information
    22/* HeuristicLab
    3  * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     3 * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
    44 *
    55 * This file is part of HeuristicLab.
     
    2020#endregion
    2121
     22using System.Linq;
    2223using HeuristicLab.Common;
    2324using HeuristicLab.Core;
    2425using HeuristicLab.Data;
     26using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
    2527using HeuristicLab.Optimization;
    26 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
     28using HEAL.Attic;
    2729
    2830namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Classification {
     
    3032  /// Represents a symbolic classification solution (model + data) and attributes of the solution like accuracy and complexity
    3133  /// </summary>
    32   [StorableClass]
     34  [StorableType("C2829CEB-8D34-4FAB-B9AE-23937071B53F")]
    3335  [Item(Name = "SymbolicClassificationSolution", Description = "Represents a symbolic classification solution (model + data) and attributes of the solution like accuracy and complexity.")]
    3436  public sealed class SymbolicClassificationSolution : ClassificationSolution, ISymbolicClassificationSolution {
     
    5557
    5658    [StorableConstructor]
    57     private SymbolicClassificationSolution(bool deserializing) : base(deserializing) { }
     59    private SymbolicClassificationSolution(StorableConstructorFlag _) : base(_) { }
    5860    private SymbolicClassificationSolution(SymbolicClassificationSolution original, Cloner cloner)
    5961      : base(original, cloner) {
     
    6163    public SymbolicClassificationSolution(ISymbolicClassificationModel model, IClassificationProblemData problemData)
    6264      : base(model, problemData) {
     65      foreach (var node in model.SymbolicExpressionTree.Root.IterateNodesPrefix().OfType<SymbolicExpressionTreeTopLevelNode>())
     66        node.SetGrammar(null);
     67
    6368      Add(new Result(ModelLengthResultName, "Length of the symbolic classification model.", new IntValue()));
    6469      Add(new Result(ModelDepthResultName, "Depth of the symbolic classification model.", new IntValue()));
  • branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/SymbolicClassificationSolutionImpactValuesCalculator.cs

    r10469 r17687  
    11#region License Information
    22/* HeuristicLab
    3  * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     3 * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
    44 *
    55 * This file is part of HeuristicLab.
     
    2020#endregion
    2121
    22 using System;
    2322using System.Collections.Generic;
    2423using HeuristicLab.Common;
    2524using HeuristicLab.Core;
    26 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
    27 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
     25using HEAL.Attic;
    2826
    2927namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Classification {
    30   [StorableClass]
     28  [StorableType("54D82779-7A37-43E4-AFD6-0C3E8D24F6EE")]
    3129  [Item("SymbolicClassificationSolutionImpactValuesCalculator", "Calculate symbolic expression tree node impact values for classification problems.")]
    3230  public class SymbolicClassificationSolutionImpactValuesCalculator : SymbolicDataAnalysisSolutionImpactValuesCalculator {
     
    3836    }
    3937    [StorableConstructor]
    40     protected SymbolicClassificationSolutionImpactValuesCalculator(bool deserializing) : base(deserializing) { }
     38    protected SymbolicClassificationSolutionImpactValuesCalculator(StorableConstructorFlag _) : base(_) { }
    4139
    42     public override double CalculateReplacementValue(ISymbolicDataAnalysisModel model, ISymbolicExpressionTreeNode node, IDataAnalysisProblemData problemData, IEnumerable<int> rows) {
     40    protected override double CalculateQualityForImpacts(ISymbolicDataAnalysisModel model, IDataAnalysisProblemData problemData, IEnumerable<int> rows) {
    4341      var classificationModel = (ISymbolicClassificationModel)model;
    4442      var classificationProblemData = (IClassificationProblemData)problemData;
    45 
    46       return CalculateReplacementValue(node, classificationModel.SymbolicExpressionTree, classificationModel.Interpreter, classificationProblemData.Dataset, rows);
    47     }
    48 
    49     public override double CalculateImpactValue(ISymbolicDataAnalysisModel model, ISymbolicExpressionTreeNode node, IDataAnalysisProblemData problemData, IEnumerable<int> rows, double originalQuality = double.NaN) {
    50       double impactValue, replacementValue;
    51       CalculateImpactAndReplacementValues(model, node, problemData, rows, out impactValue, out replacementValue, originalQuality);
    52       return impactValue;
    53     }
    54 
    55     public override void CalculateImpactAndReplacementValues(ISymbolicDataAnalysisModel model, ISymbolicExpressionTreeNode node,
    56       IDataAnalysisProblemData problemData, IEnumerable<int> rows, out double impactValue, out double replacementValue,
    57       double originalQuality = Double.NaN) {
    58       var classificationModel = (ISymbolicClassificationModel)model;
    59       var classificationProblemData = (IClassificationProblemData)problemData;
    60 
    61       var dataset = classificationProblemData.Dataset;
     43      OnlineCalculatorError errorState;
     44      var dataset = problemData.Dataset;
     45      classificationModel.RecalculateModelParameters(classificationProblemData, rows);
    6246      var targetClassValues = dataset.GetDoubleValues(classificationProblemData.TargetVariable, rows);
    63 
    64       OnlineCalculatorError errorState;
    65       if (double.IsNaN(originalQuality)) {
    66         var originalClassValues = classificationModel.GetEstimatedClassValues(dataset, rows);
    67         originalQuality = OnlineAccuracyCalculator.Calculate(targetClassValues, originalClassValues, out errorState);
    68         if (errorState != OnlineCalculatorError.None) originalQuality = 0.0;
    69       }
    70 
    71       replacementValue = CalculateReplacementValue(classificationModel, node, classificationProblemData, rows);
    72       var constantNode = new ConstantTreeNode(new Constant()) { Value = replacementValue };
    73 
    74       var cloner = new Cloner();
    75       var tempModel = cloner.Clone(classificationModel);
    76       var tempModelNode = (ISymbolicExpressionTreeNode)cloner.GetClone(node);
    77 
    78       var tempModelParentNode = tempModelNode.Parent;
    79       int i = tempModelParentNode.IndexOfSubtree(tempModelNode);
    80       tempModelParentNode.RemoveSubtree(i);
    81       tempModelParentNode.InsertSubtree(i, constantNode);
    82 
    83       var estimatedClassValues = tempModel.GetEstimatedClassValues(dataset, rows);
    84       double newQuality = OnlineAccuracyCalculator.Calculate(targetClassValues, estimatedClassValues, out errorState);
    85       if (errorState != OnlineCalculatorError.None) newQuality = 0.0;
    86 
    87       impactValue = originalQuality - newQuality;
     47      var originalClassValues = classificationModel.GetEstimatedClassValues(dataset, rows);
     48      var qualityForImpactsCalculation = OnlineAccuracyCalculator.Calculate(targetClassValues, originalClassValues, out errorState);
     49      if (errorState != OnlineCalculatorError.None) qualityForImpactsCalculation = 0.0;
     50      return qualityForImpactsCalculation;
    8851    }
    8952  }
  • branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/SymbolicDiscriminantFunctionClassificationModel.cs

    r9456 r17687  
    11#region License Information
    22/* HeuristicLab
    3  * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     3 * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
    44 *
    55 * This file is part of HeuristicLab.
     
    2626using HeuristicLab.Core;
    2727using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
    28 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
     28using HEAL.Attic;
    2929
    3030namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Classification {
     
    3232  /// Represents a symbolic classification model
    3333  /// </summary>
    34   [StorableClass]
     34  [StorableType("99332204-4097-496A-AB05-4DB9478DB159")]
    3535  [Item(Name = "SymbolicDiscriminantFunctionClassificationModel", Description = "Represents a symbolic classification model unsing a discriminant function.")]
    3636  public class SymbolicDiscriminantFunctionClassificationModel : SymbolicClassificationModel, ISymbolicDiscriminantFunctionClassificationModel {
     
    5858
    5959    [StorableConstructor]
    60     protected SymbolicDiscriminantFunctionClassificationModel(bool deserializing) : base(deserializing) { }
     60    protected SymbolicDiscriminantFunctionClassificationModel(StorableConstructorFlag _) : base(_) { }
    6161    protected SymbolicDiscriminantFunctionClassificationModel(SymbolicDiscriminantFunctionClassificationModel original, Cloner cloner)
    6262      : base(original, cloner) {
     
    6565      thresholdCalculator = cloner.Clone(original.thresholdCalculator);
    6666    }
    67     public SymbolicDiscriminantFunctionClassificationModel(ISymbolicExpressionTree tree, ISymbolicDataAnalysisExpressionTreeInterpreter interpreter, IDiscriminantFunctionThresholdCalculator thresholdCalculator,
     67    public SymbolicDiscriminantFunctionClassificationModel(string targetVariable, ISymbolicExpressionTree tree, ISymbolicDataAnalysisExpressionTreeInterpreter interpreter, IDiscriminantFunctionThresholdCalculator thresholdCalculator,
    6868      double lowerEstimationLimit = double.MinValue, double upperEstimationLimit = double.MaxValue)
    69       : base(tree, interpreter, lowerEstimationLimit, upperEstimationLimit) {
     69      : base(targetVariable, tree, interpreter, lowerEstimationLimit, upperEstimationLimit) {
    7070      this.thresholds = new double[0];
    7171      this.classValues = new double[0];
     
    8888      var classValuesArr = classValues.ToArray();
    8989      var thresholdsArr = thresholds.ToArray();
    90       if (thresholdsArr.Length != classValuesArr.Length || thresholdsArr.Length < 1) 
     90      if (thresholdsArr.Length != classValuesArr.Length || thresholdsArr.Length < 1)
    9191        throw new ArgumentException();
    92       if (!double.IsNegativeInfinity(thresholds.First())) 
     92      if (!double.IsNegativeInfinity(thresholds.First()))
    9393        throw new ArgumentException();
    9494
     
    107107    }
    108108
    109     public IEnumerable<double> GetEstimatedValues(Dataset dataset, IEnumerable<int> rows) {
     109    public IEnumerable<double> GetEstimatedValues(IDataset dataset, IEnumerable<int> rows) {
    110110      return Interpreter.GetSymbolicExpressionTreeValues(SymbolicExpressionTree, dataset, rows).LimitToRange(LowerEstimationLimit, UpperEstimationLimit);
    111111    }
    112112
    113     public override IEnumerable<double> GetEstimatedClassValues(Dataset dataset, IEnumerable<int> rows) {
     113    public override IEnumerable<double> GetEstimatedClassValues(IDataset dataset, IEnumerable<int> rows) {
     114      var estimatedValues = GetEstimatedValues(dataset, rows);
     115      return GetEstimatedClassValues(estimatedValues);
     116    }
     117    public IEnumerable<double> GetEstimatedClassValues(IEnumerable<double> estimatedValues) {
    114118      if (!Thresholds.Any() && !ClassValues.Any()) throw new ArgumentException("No thresholds and class values were set for the current symbolic classification model.");
    115       foreach (var x in GetEstimatedValues(dataset, rows)) {
     119      foreach (var x in estimatedValues) {
    116120        int classIndex = 0;
    117121        // find first threshold value which is larger than x => class index = threshold index + 1
     
    123127      }
    124128    }
    125 
    126129
    127130    public override ISymbolicClassificationSolution CreateClassificationSolution(IClassificationProblemData problemData) {
  • branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/SymbolicDiscriminantFunctionClassificationSolution.cs

    r9456 r17687  
    11#region License Information
    22/* HeuristicLab
    3  * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     3 * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
    44 *
    55 * This file is part of HeuristicLab.
     
    2424using HeuristicLab.Core;
    2525using HeuristicLab.Data;
     26using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
    2627using HeuristicLab.Optimization;
    27 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
     28using HEAL.Attic;
    2829
    2930namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Classification {
     
    3132  /// Represents a symbolic classification solution (model + data) and attributes of the solution like accuracy and complexity
    3233  /// </summary>
    33   [StorableClass]
     34  [StorableType("83BEB8F0-DEF7-4E51-876D-9819BA10F2E8")]
    3435  [Item(Name = "SymbolicDiscriminantFunctionClassificationSolution", Description = "Represents a symbolic classification solution (model + data) and attributes of the solution like accuracy and complexity.")]
    3536  public sealed class SymbolicDiscriminantFunctionClassificationSolution : DiscriminantFunctionClassificationSolution, ISymbolicClassificationSolution {
     
    101102
    102103    [StorableConstructor]
    103     private SymbolicDiscriminantFunctionClassificationSolution(bool deserializing) : base(deserializing) { }
     104    private SymbolicDiscriminantFunctionClassificationSolution(StorableConstructorFlag _) : base(_) { }
    104105    private SymbolicDiscriminantFunctionClassificationSolution(SymbolicDiscriminantFunctionClassificationSolution original, Cloner cloner)
    105106      : base(original, cloner) {
     
    107108    public SymbolicDiscriminantFunctionClassificationSolution(ISymbolicDiscriminantFunctionClassificationModel model, IClassificationProblemData problemData)
    108109      : base(model, problemData) {
     110      foreach (var node in model.SymbolicExpressionTree.Root.IterateNodesPrefix().OfType<SymbolicExpressionTreeTopLevelNode>())
     111        node.SetGrammar(null);
     112
    109113      Add(new Result(ModelLengthResultName, "Length of the symbolic classification model.", new IntValue()));
    110114      Add(new Result(ModelDepthResultName, "Depth of the symbolic classification model.", new IntValue()));
    111 
    112115
    113116      ResultCollection estimationLimitResults = new ResultCollection();
  • branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/SymbolicNearestNeighbourClassificationModel.cs

    r9456 r17687  
    11#region License Information
    22/* HeuristicLab
    3  * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     3 * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
    44 *
    55 * This file is part of HeuristicLab.
     
    2626using HeuristicLab.Core;
    2727using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
    28 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
     28using HEAL.Attic;
    2929
    3030namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Classification {
     
    3232  /// Represents a nearest neighbour model for regression and classification
    3333  /// </summary>
    34   [StorableClass]
     34  [StorableType("B9F8A753-B102-4356-8821-76E31634A0C6")]
    3535  [Item("SymbolicNearestNeighbourClassificationModel", "Represents a nearest neighbour model for symbolic classification.")]
    3636  public sealed class SymbolicNearestNeighbourClassificationModel : SymbolicClassificationModel {
     
    4747
    4848    [StorableConstructor]
    49     private SymbolicNearestNeighbourClassificationModel(bool deserializing) : base(deserializing) { }
     49    private SymbolicNearestNeighbourClassificationModel(StorableConstructorFlag _) : base(_) { }
    5050    private SymbolicNearestNeighbourClassificationModel(SymbolicNearestNeighbourClassificationModel original, Cloner cloner)
    5151      : base(original, cloner) {
     
    5555      trainedClasses = new List<double>(original.trainedClasses);
    5656    }
    57     public SymbolicNearestNeighbourClassificationModel(int k, ISymbolicExpressionTree tree, ISymbolicDataAnalysisExpressionTreeInterpreter interpreter, double lowerEstimationLimit = double.MinValue, double upperEstimationLimit = double.MaxValue)
    58       : base(tree, interpreter, lowerEstimationLimit, upperEstimationLimit) {
     57    public SymbolicNearestNeighbourClassificationModel(string targetVariable, int k, ISymbolicExpressionTree tree, ISymbolicDataAnalysisExpressionTreeInterpreter interpreter, double lowerEstimationLimit = double.MinValue, double upperEstimationLimit = double.MaxValue)
     58      : base(targetVariable, tree, interpreter, lowerEstimationLimit, upperEstimationLimit) {
    5959      this.k = k;
    6060      frequencyComparer = new ClassFrequencyComparer();
     
    6666    }
    6767
    68     public override IEnumerable<double> GetEstimatedClassValues(Dataset dataset, IEnumerable<int> rows) {
     68    public override IEnumerable<double> GetEstimatedClassValues(IDataset dataset, IEnumerable<int> rows) {
    6969      var estimatedValues = Interpreter.GetSymbolicExpressionTreeValues(SymbolicExpressionTree, dataset, rows)
    7070                                       .LimitToRange(LowerEstimationLimit, UpperEstimationLimit);
     
    143143  }
    144144
    145   [StorableClass]
     145  [StorableType("523AFB5D-3758-4547-BD6E-1181A01A02B4")]
    146146  internal sealed class ClassFrequencyComparer : IComparer<double> {
    147147    [Storable]
     
    149149
    150150    [StorableConstructor]
    151     private ClassFrequencyComparer(bool deserializing) { }
     151    private ClassFrequencyComparer(StorableConstructorFlag _) { }
    152152    public ClassFrequencyComparer() {
    153153      classFrequencies = new Dictionary<double, int>();
Note: See TracChangeset for help on using the changeset viewer.