Changeset 17687 for branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification
- Timestamp:
- 07/19/20 19:07:40 (4 years ago)
- 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
- Property svn:mergeinfo changed
-
branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification-3.4.csproj
r10682 r17687 11 11 <RootNamespace>HeuristicLab.Problems.DataAnalysis.Symbolic.Classification</RootNamespace> 12 12 <AssemblyName>HeuristicLab.Problems.DataAnalysis.Symbolic.Classification-3.4</AssemblyName> 13 <TargetFrameworkVersion>v4. 0</TargetFrameworkVersion>13 <TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion> 14 14 <TargetFrameworkProfile> 15 15 </TargetFrameworkProfile> … … 41 41 <DebugType>full</DebugType> 42 42 <Optimize>false</Optimize> 43 <OutputPath>..\..\..\..\trunk\ sources\bin\</OutputPath>43 <OutputPath>..\..\..\..\trunk\bin\</OutputPath> 44 44 <DefineConstants>DEBUG;TRACE</DefineConstants> 45 45 <ErrorReport>prompt</ErrorReport> 46 46 <WarningLevel>4</WarningLevel> 47 47 <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet> 48 <Prefer32Bit>false</Prefer32Bit> 48 49 </PropertyGroup> 49 50 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> 50 51 <DebugType>pdbonly</DebugType> 51 52 <Optimize>true</Optimize> 52 <OutputPath> ..\..\..\..\trunk\sources\bin\</OutputPath>53 <OutputPath>$(SolutionDir)\bin\</OutputPath> 53 54 <DefineConstants>TRACE</DefineConstants> 54 55 <ErrorReport>prompt</ErrorReport> 55 56 <WarningLevel>4</WarningLevel> 56 57 <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet> 58 <Prefer32Bit>false</Prefer32Bit> 57 59 </PropertyGroup> 58 60 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x64' "> 59 61 <DebugSymbols>true</DebugSymbols> 60 <OutputPath> ..\..\..\..\trunk\sources\bin\</OutputPath>62 <OutputPath>$(SolutionDir)\bin\</OutputPath> 61 63 <DefineConstants>DEBUG;TRACE</DefineConstants> 62 64 <DebugType>full</DebugType> … … 64 66 <ErrorReport>prompt</ErrorReport> 65 67 <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet> 68 <Prefer32Bit>false</Prefer32Bit> 66 69 </PropertyGroup> 67 70 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x64' "> 68 <OutputPath> ..\..\..\..\trunk\sources\bin\</OutputPath>71 <OutputPath>$(SolutionDir)\bin\</OutputPath> 69 72 <DefineConstants>TRACE</DefineConstants> 70 73 <Optimize>true</Optimize> … … 73 76 <ErrorReport>prompt</ErrorReport> 74 77 <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet> 78 <Prefer32Bit>false</Prefer32Bit> 75 79 </PropertyGroup> 76 80 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' "> 77 81 <DebugSymbols>true</DebugSymbols> 78 <OutputPath> ..\..\..\..\trunk\sources\bin\</OutputPath>82 <OutputPath>$(SolutionDir)\bin\</OutputPath> 79 83 <DefineConstants>DEBUG;TRACE</DefineConstants> 80 84 <DebugType>full</DebugType> … … 82 86 <ErrorReport>prompt</ErrorReport> 83 87 <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet> 88 <Prefer32Bit>false</Prefer32Bit> 84 89 </PropertyGroup> 85 90 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' "> 86 <OutputPath> ..\..\..\..\trunk\sources\bin\</OutputPath>91 <OutputPath>$(SolutionDir)\bin\</OutputPath> 87 92 <DefineConstants>TRACE</DefineConstants> 88 93 <Optimize>true</Optimize> … … 91 96 <ErrorReport>prompt</ErrorReport> 92 97 <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> 97 103 <Private>False</Private> 98 104 </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> 154 164 </Reference> 155 165 <Reference Include="System" /> … … 176 186 <Compile Include="ModelCreators\NormalDistributedThresholdsModelCreator.cs" /> 177 187 <Compile Include="MultiObjective\SymbolicClassificationMultiObjectiveValidationBestSolutionAnalyzer.cs" /> 188 <Compile Include="SingleObjective\SymbolicClassificationSingleObjectiveWeightedPerformanceMeasuresEvaluator.cs" /> 189 <Compile Include="SingleObjective\SymbolicClassificationSingleObjectiveWeightedResidualsMeanSquaredErrorEvaluator.cs" /> 178 190 <Compile Include="Sliding Window\GenerationalClassificationSlidingWindowAnalyzer.cs" /> 179 191 <Compile Include="Sliding Window\OffspringSelectionClassificationSlidingWindowAnalyzer.cs" /> 180 192 <Compile Include="Sliding Window\SlidingWindowBestClassificationSolutionsCollection.cs" /> 193 <Compile Include="SymbolicClassificationPhenotypicDiversityAnalyzer.cs" /> 181 194 <Compile Include="SymbolicClassificationPruningAnalyzer.cs" /> 182 195 <Compile Include="SymbolicClassificationSolutionImpactValuesCalculator.cs" /> … … 236 249 </ItemGroup> 237 250 <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> 238 258 <ProjectReference Include="..\..\HeuristicLab.Problems.DataAnalysis.Symbolic\3.4\HeuristicLab.Problems.DataAnalysis.Symbolic-3.4.csproj"> 239 <Project>{3 D28463F-EC96-4D82-AFEE-38BE91A0CA00}</Project>259 <Project>{3d28463f-ec96-4d82-afee-38be91a0ca00}</Project> 240 260 <Name>HeuristicLab.Problems.DataAnalysis.Symbolic-3.4</Name> 241 <Private>False</Private>242 261 </ProjectReference> 243 262 </ItemGroup> … … 265 284 </PreBuildEvent> 266 285 </PropertyGroup> 286 <PropertyGroup> 287 <PreBuildEvent /> 288 </PropertyGroup> 267 289 </Project> -
branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/Interfaces/ISymbolicClassificationEvaluator.cs
r9456 r17687 1 #region License Information 1 using HEAL.Attic; 2 #region License Information 2 3 /* HeuristicLab 3 * Copyright (C) 2002-2013Heuristic and Evolutionary Algorithms Laboratory (HEAL)4 * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 5 * 5 6 * This file is part of HeuristicLab. … … 21 22 22 23 namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Classification { 24 [StorableType("ee5a6071-4942-4358-ad21-7ba1bd4224ad")] 23 25 public interface ISymbolicClassificationEvaluator : ISymbolicDataAnalysisEvaluator<IClassificationProblemData> { 24 26 } -
branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/Interfaces/ISymbolicClassificationModel.cs
r9587 r17687 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-2013Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. … … 21 21 22 22 using System.Collections.Generic; 23 using HEAL.Attic; 24 23 25 namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Classification { 26 [StorableType("64a5d560-0657-4022-87a0-9f3210062a84")] 24 27 public interface ISymbolicClassificationModel : IClassificationModel, ISymbolicDataAnalysisModel { 25 28 void RecalculateModelParameters(IClassificationProblemData problemData, IEnumerable<int> rows); -
branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/Interfaces/ISymbolicClassificationModelCreator.cs
r9456 r17687 2 2 3 3 /* HeuristicLab 4 * Copyright (C) 2002-2013Heuristic and Evolutionary Algorithms Laboratory (HEAL)4 * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL) 5 5 * 6 6 * This file is part of HeuristicLab. … … 23 23 using HeuristicLab.Core; 24 24 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding; 25 using HEAL.Attic; 25 26 26 27 namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Classification { 28 [StorableType("a21179da-5417-4e8c-8f8a-6ddc83b16ab1")] 27 29 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); 29 31 } 30 32 } -
branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/Interfaces/ISymbolicClassificationModelCreatorOperator.cs
r9456 r17687 2 2 3 3 /* HeuristicLab 4 * Copyright (C) 2002-2013Heuristic and Evolutionary Algorithms Laboratory (HEAL)4 * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL) 5 5 * 6 6 * This file is part of HeuristicLab. … … 23 23 24 24 using HeuristicLab.Core; 25 using HEAL.Attic; 25 26 26 27 namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Classification { 28 [StorableType("7d19cbcd-dde9-449e-b6d6-ea3e752638d2")] 27 29 public interface ISymbolicClassificationModelCreatorOperator : IOperator { 28 30 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 1 using HEAL.Attic; 2 #region License Information 2 3 /* HeuristicLab 3 * Copyright (C) 2002-2013Heuristic and Evolutionary Algorithms Laboratory (HEAL)4 * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 5 * 5 6 * This file is part of HeuristicLab. … … 21 22 22 23 namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Classification { 24 [StorableType("715dc79f-e2b9-4586-a66c-abf3a35f0012")] 23 25 public interface ISymbolicClassificationMultiObjectiveEvaluator : ISymbolicClassificationEvaluator, ISymbolicDataAnalysisMultiObjectiveEvaluator<IClassificationProblemData> { 24 26 } -
branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/Interfaces/ISymbolicClassificationSingleObjectiveEvaluator.cs
r9456 r17687 1 #region License Information 1 using HEAL.Attic; 2 #region License Information 2 3 /* HeuristicLab 3 * Copyright (C) 2002-2013Heuristic and Evolutionary Algorithms Laboratory (HEAL)4 * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 5 * 5 6 * This file is part of HeuristicLab. … … 21 22 22 23 namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Classification { 24 [StorableType("18a4eeab-5066-4e52-8f37-992a5f7563f1")] 23 25 public interface ISymbolicClassificationSingleObjectiveEvaluator : ISymbolicClassificationEvaluator, ISymbolicDataAnalysisSingleObjectiveEvaluator<IClassificationProblemData> { 24 26 } -
branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/Interfaces/ISymbolicClassificationSolution.cs
r9456 r17687 1 #region License Information 1 using HEAL.Attic; 2 #region License Information 2 3 /* HeuristicLab 3 * Copyright (C) 2002-2013Heuristic and Evolutionary Algorithms Laboratory (HEAL)4 * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 5 * 5 6 * This file is part of HeuristicLab. … … 21 22 22 23 23 using HeuristicLab.Problems.DataAnalysis.Symbolic;24 using System.Collections.Generic;25 using System;26 24 namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Classification { 25 [StorableType("82ba1ea2-e8e9-4b77-b797-c752c1256840")] 27 26 public interface ISymbolicClassificationSolution : IClassificationSolution, ISymbolicDataAnalysisSolution { 28 27 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 1 using HEAL.Attic; 2 #region License Information 2 3 /* HeuristicLab 3 * Copyright (C) 2002-2013Heuristic and Evolutionary Algorithms Laboratory (HEAL)4 * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 5 * 5 6 * This file is part of HeuristicLab. … … 21 22 22 23 namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Classification { 24 [StorableType("3f2e5443-226c-408a-9121-973d162c590b")] 23 25 public interface ISymbolicDiscriminantFunctionClassificationModel : IDiscriminantFunctionClassificationModel, ISymbolicClassificationModel { 24 26 -
branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/Interfaces/ISymbolicDiscriminantFunctionClassificationModelCreator.cs
r9456 r17687 2 2 3 3 /* HeuristicLab 4 * Copyright (C) 2002-2013Heuristic and Evolutionary Algorithms Laboratory (HEAL)4 * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL) 5 5 * 6 6 * This file is part of HeuristicLab. … … 22 22 #endregion 23 23 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding; 24 using HEAL.Attic; 24 25 25 26 namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Classification { 27 [StorableType("fc2ba966-c965-462b-8c5d-8c40998548a7")] 26 28 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); 28 30 } 29 31 } -
branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/ModelCreators/AccuracyMaximizingThresholdsModelCreator.cs
r9456 r17687 2 2 3 3 /* HeuristicLab 4 * Copyright (C) 2002-2013Heuristic and Evolutionary Algorithms Laboratory (HEAL)4 * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL) 5 5 * 6 6 * This file is part of HeuristicLab. … … 25 25 using HeuristicLab.Core; 26 26 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding; 27 using H euristicLab.Persistence.Default.CompositeSerializers.Storable;27 using HEAL.Attic; 28 28 29 29 namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Classification { 30 [Storable Class]30 [StorableType("5D9D21D0-F9A8-4145-80CF-2EE9FC0D884C")] 31 31 [Item("AccuracyMaximizingThresholdsModelCreator", "")] 32 32 public sealed class AccuracyMaximizingThresholdsModelCreator : Item, ISymbolicDiscriminantFunctionClassificationModelCreator { … … 38 38 } 39 39 [StorableConstructor] 40 private AccuracyMaximizingThresholdsModelCreator( bool deserializing) : base(deserializing) { }40 private AccuracyMaximizingThresholdsModelCreator(StorableConstructorFlag _) : base(_) { } 41 41 private AccuracyMaximizingThresholdsModelCreator(AccuracyMaximizingThresholdsModelCreator original, Cloner cloner) : base(original, cloner) { } 42 42 public AccuracyMaximizingThresholdsModelCreator() : base() { } … … 45 45 46 46 47 public ISymbolicClassificationModel CreateSymbolicClassificationModel( ISymbolicExpressionTree tree, ISymbolicDataAnalysisExpressionTreeInterpreter interpreter, double lowerEstimationLimit = double.MinValue, double upperEstimationLimit = double.MaxValue) {48 return CreateSymbolicDiscriminantFunctionClassificationModel(t ree, 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); 49 49 } 50 public ISymbolicDiscriminantFunctionClassificationModel CreateSymbolicDiscriminantFunctionClassificationModel( ISymbolicExpressionTree tree, ISymbolicDataAnalysisExpressionTreeInterpreter interpreter, double lowerEstimationLimit = double.MinValue, double upperEstimationLimit = double.MaxValue) {51 return new SymbolicDiscriminantFunctionClassificationModel(t ree, 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); 52 52 } 53 53 -
branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/ModelCreators/NearestNeighborModelCreator.cs
r9456 r17687 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-2013Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. … … 26 26 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding; 27 27 using HeuristicLab.Parameters; 28 using H euristicLab.Persistence.Default.CompositeSerializers.Storable;28 using HEAL.Attic; 29 29 30 30 namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Classification { 31 [Storable Class]31 [StorableType("B96EB322-8027-48F7-AB5B-4E22546B74DD")] 32 32 [Item("NearestNeighborModelCreator", "")] 33 33 public sealed class NearestNeighborModelCreator : ParameterizedNamedItem, ISymbolicClassificationModelCreator { … … 44 44 45 45 [StorableConstructor] 46 private NearestNeighborModelCreator( bool deserializing) : base(deserializing) { }46 private NearestNeighborModelCreator(StorableConstructorFlag _) : base(_) { } 47 47 private NearestNeighborModelCreator(NearestNeighborModelCreator original, Cloner cloner) : base(original, cloner) { } 48 48 public NearestNeighborModelCreator() … … 54 54 55 55 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); 58 58 } 59 59 -
branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/ModelCreators/NormalDistributedThresholdsModelCreator.cs
r9456 r17687 2 2 3 3 /* HeuristicLab 4 * Copyright (C) 2002-2013Heuristic and Evolutionary Algorithms Laboratory (HEAL)4 * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL) 5 5 * 6 6 * This file is part of HeuristicLab. … … 26 26 using HeuristicLab.Core; 27 27 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding; 28 using H euristicLab.Persistence.Default.CompositeSerializers.Storable;28 using HEAL.Attic; 29 29 30 30 namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Classification { 31 [Storable Class]31 [StorableType("87C4FF17-FC59-4D0F-80F5-2C84499E1222")] 32 32 [Item("NormalDistributedThresholdsModelCreator", "")] 33 33 public sealed class NormalDistributedThresholdsModelCreator : Item, ISymbolicDiscriminantFunctionClassificationModelCreator { … … 39 39 } 40 40 [StorableConstructor] 41 private NormalDistributedThresholdsModelCreator( bool deserializing) : base(deserializing) { }41 private NormalDistributedThresholdsModelCreator(StorableConstructorFlag _) : base(_) { } 42 42 private NormalDistributedThresholdsModelCreator(NormalDistributedThresholdsModelCreator original, Cloner cloner) : base(original, cloner) { } 43 43 public NormalDistributedThresholdsModelCreator() : base() { } … … 46 46 47 47 48 public ISymbolicClassificationModel CreateSymbolicClassificationModel( ISymbolicExpressionTree tree, ISymbolicDataAnalysisExpressionTreeInterpreter interpreter, double lowerEstimationLimit = double.MinValue, double upperEstimationLimit = double.MaxValue) {49 return CreateSymbolicDiscriminantFunctionClassificationModel(t ree, 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); 50 50 } 51 public ISymbolicDiscriminantFunctionClassificationModel CreateSymbolicDiscriminantFunctionClassificationModel( ISymbolicExpressionTree tree, ISymbolicDataAnalysisExpressionTreeInterpreter interpreter, double lowerEstimationLimit = double.MinValue, double upperEstimationLimit = double.MaxValue) {52 return new SymbolicDiscriminantFunctionClassificationModel(t ree, 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); 53 53 } 54 54 -
branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/MultiObjective/SymbolicClassificationMultiObjectiveEvaluator.cs
r9456 r17687 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-2013Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. … … 21 21 22 22 using HeuristicLab.Common; 23 using H euristicLab.Persistence.Default.CompositeSerializers.Storable;23 using HEAL.Attic; 24 24 25 25 namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Classification { 26 [StorableType("5AC365B5-2F64-4F10-8BD3-E98790E8F3C4")] 26 27 public abstract class SymbolicClassificationMultiObjectiveEvaluator : SymbolicDataAnalysisMultiObjectiveEvaluator<IClassificationProblemData>, ISymbolicClassificationMultiObjectiveEvaluator { 27 28 [StorableConstructor] 28 protected SymbolicClassificationMultiObjectiveEvaluator( bool deserializing) : base(deserializing) { }29 protected SymbolicClassificationMultiObjectiveEvaluator(StorableConstructorFlag _) : base(_) { } 29 30 protected SymbolicClassificationMultiObjectiveEvaluator(SymbolicClassificationMultiObjectiveEvaluator original, Cloner cloner) 30 31 : base(original, cloner) { -
branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/MultiObjective/SymbolicClassificationMultiObjectiveMeanSquaredErrorTreeSizeEvaluator.cs
r10291 r17687 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-2013Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. … … 25 25 using HeuristicLab.Data; 26 26 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding; 27 using H euristicLab.Persistence.Default.CompositeSerializers.Storable;27 using HEAL.Attic; 28 28 29 29 namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Classification { 30 30 [Item("Mean squared error & Tree size Evaluator", "Calculates the mean squared error and the tree size of a symbolic classification solution.")] 31 [Storable Class]31 [StorableType("1D1693A0-6479-45D1-990F-125FFCEC430E")] 32 32 public class SymbolicClassificationMultiObjectiveMeanSquaredErrorTreeSizeEvaluator : SymbolicClassificationMultiObjectiveEvaluator { 33 33 [StorableConstructor] 34 protected SymbolicClassificationMultiObjectiveMeanSquaredErrorTreeSizeEvaluator( bool deserializing) : base(deserializing) { }34 protected SymbolicClassificationMultiObjectiveMeanSquaredErrorTreeSizeEvaluator(StorableConstructorFlag _) : base(_) { } 35 35 protected SymbolicClassificationMultiObjectiveMeanSquaredErrorTreeSizeEvaluator(SymbolicClassificationMultiObjectiveMeanSquaredErrorTreeSizeEvaluator original, Cloner cloner) 36 36 : base(original, cloner) { -
branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/MultiObjective/SymbolicClassificationMultiObjectivePearsonRSquaredTreeSizeEvaluator.cs
r10291 r17687 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-2013Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. … … 25 25 using HeuristicLab.Data; 26 26 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding; 27 using H euristicLab.Persistence.Default.CompositeSerializers.Storable;27 using HEAL.Attic; 28 28 29 29 namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Classification { 30 30 [Item("Pearson R² & Tree size Evaluator", "Calculates the Pearson R² and the tree size of a symbolic classification solution.")] 31 [Storable Class]31 [StorableType("3131A57B-5F87-4CAD-A0BE-E1E03D6D8276")] 32 32 public class SymbolicClassificationMultiObjectivePearsonRSquaredTreeSizeEvaluator : SymbolicClassificationMultiObjectiveEvaluator { 33 33 [StorableConstructor] 34 protected SymbolicClassificationMultiObjectivePearsonRSquaredTreeSizeEvaluator( bool deserializing) : base(deserializing) { }34 protected SymbolicClassificationMultiObjectivePearsonRSquaredTreeSizeEvaluator(StorableConstructorFlag _) : base(_) { } 35 35 protected SymbolicClassificationMultiObjectivePearsonRSquaredTreeSizeEvaluator(SymbolicClassificationMultiObjectivePearsonRSquaredTreeSizeEvaluator original, Cloner cloner) 36 36 : base(original, cloner) { … … 57 57 OnlineCalculatorError errorState; 58 58 59 double r 2;59 double r; 60 60 if (applyLinearScaling) { 61 var r 2Calculator = new OnlinePearsonsRSquaredCalculator();62 CalculateWithScaling(targetValues, estimatedValues, lowerEstimationLimit, upperEstimationLimit, r 2Calculator, problemData.Dataset.Rows);63 errorState = r 2Calculator.ErrorState;64 r 2 = 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; 65 65 } else { 66 66 IEnumerable<double> boundedEstimatedValues = estimatedValues.LimitToRange(lowerEstimationLimit, upperEstimationLimit); 67 r 2 = OnlinePearsonsRSquaredCalculator.Calculate(targetValues, boundedEstimatedValues, out errorState);67 r = OnlinePearsonsRCalculator.Calculate(targetValues, boundedEstimatedValues, out errorState); 68 68 } 69 69 70 if (errorState != OnlineCalculatorError.None) r 2= double.NaN;71 return new double[2] { r 2, solution.Length };70 if (errorState != OnlineCalculatorError.None) r = double.NaN; 71 return new double[2] { r*r, solution.Length }; 72 72 73 73 } -
branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/MultiObjective/SymbolicClassificationMultiObjectiveProblem.cs
r9456 r17687 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-2013Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. … … 23 23 using HeuristicLab.Core; 24 24 using HeuristicLab.Data; 25 using HeuristicLab.Optimization; 25 26 using HeuristicLab.Parameters; 26 using H euristicLab.Persistence.Default.CompositeSerializers.Storable;27 using HEAL.Attic; 27 28 28 29 namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Classification { 29 [Item("Symbolic Classification Problem (multi 30 [Storable Class]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)] 32 33 public class SymbolicClassificationMultiObjectiveProblem : SymbolicDataAnalysisMultiObjectiveProblem<IClassificationProblemData, ISymbolicClassificationMultiObjectiveEvaluator, ISymbolicDataAnalysisSolutionCreator>, IClassificationProblem { 33 34 private const double PunishmentFactor = 10; … … 56 57 #endregion 57 58 [StorableConstructor] 58 protected SymbolicClassificationMultiObjectiveProblem( bool deserializing) : base(deserializing) { }59 protected SymbolicClassificationMultiObjectiveProblem(StorableConstructorFlag _) : base(_) { } 59 60 protected SymbolicClassificationMultiObjectiveProblem(SymbolicClassificationMultiObjectiveProblem original, Cloner cloner) 60 61 : base(original, cloner) { … … 105 106 Operators.Add(new SymbolicClassificationMultiObjectiveTrainingBestSolutionAnalyzer()); 106 107 Operators.Add(new SymbolicClassificationMultiObjectiveValidationBestSolutionAnalyzer()); 108 Operators.Add(new SymbolicExpressionTreePhenotypicSimilarityCalculator()); 109 Operators.Add(new SymbolicClassificationPhenotypicDiversityAnalyzer(Operators.OfType<SymbolicExpressionTreePhenotypicSimilarityCalculator>())); 107 110 ParameterizeOperators(); 108 111 } … … 135 138 op.ModelCreatorParameter.ActualName = ModelCreatorParameter.Name; 136 139 } 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 } 137 151 } 138 152 } -
branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/MultiObjective/SymbolicClassificationMultiObjectiveTrainingBestSolutionAnalyzer.cs
r9456 r17687 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-2013Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. … … 20 20 #endregion 21 21 22 using System.Collections.Generic; 23 using System.Linq; 24 using HEAL.Attic; 25 using HeuristicLab.Analysis; 22 26 using HeuristicLab.Common; 23 27 using HeuristicLab.Core; 28 using HeuristicLab.Data; 24 29 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding; 30 using HeuristicLab.Optimization; 25 31 using HeuristicLab.Parameters; 26 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;27 32 28 33 namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Classification { … … 31 36 /// </summary> 32 37 [Item("SymbolicClassificationMultiObjectiveTrainingBestSolutionAnalyzer", "An operator that analyzes the training best symbolic classification solution for multi objective symbolic classification problems.")] 33 [Storable Class]38 [StorableType("EC30DC99-A5A8-43B0-81C1-BA9016A0A74C")] 34 39 public sealed class SymbolicClassificationMultiObjectiveTrainingBestSolutionAnalyzer : SymbolicDataAnalysisMultiObjectiveTrainingBestSolutionAnalyzer<ISymbolicClassificationSolution>, 35 40 ISymbolicDataAnalysisInterpreterOperator, ISymbolicDataAnalysisBoundedOperator, ISymbolicClassificationModelCreatorOperator { … … 38 43 private const string SymbolicDataAnalysisTreeInterpreterParameterName = "SymbolicDataAnalysisTreeInterpreter"; 39 44 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"; 40 48 41 49 #region parameter properties … … 55 63 get { return (IValueLookupParameter<DoubleLimit>)Parameters[EstimationLimitsParameterName]; } 56 64 } 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 } 57 78 #endregion 58 79 59 80 [StorableConstructor] 60 private SymbolicClassificationMultiObjectiveTrainingBestSolutionAnalyzer( bool deserializing) : base(deserializing) { }81 private SymbolicClassificationMultiObjectiveTrainingBestSolutionAnalyzer(StorableConstructorFlag _) : base(_) { } 61 82 private SymbolicClassificationMultiObjectiveTrainingBestSolutionAnalyzer(SymbolicClassificationMultiObjectiveTrainingBestSolutionAnalyzer original, Cloner cloner) : base(original, cloner) { } 62 83 public SymbolicClassificationMultiObjectiveTrainingBestSolutionAnalyzer() … … 66 87 Parameters.Add(new LookupParameter<ISymbolicDataAnalysisExpressionTreeInterpreter>(SymbolicDataAnalysisTreeInterpreterParameterName, "The symbolic data analysis tree interpreter for the symbolic expression tree.")); 67 88 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 68 93 } 69 94 public override IDeepCloneable Clone(Cloner cloner) { … … 81 106 82 107 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); 84 109 if (ApplyLinearScalingParameter.ActualValue.Value) model.Scale(ProblemDataParameter.ActualValue); 85 110 … … 87 112 return model.CreateClassificationSolution((IClassificationProblemData)ProblemDataParameter.ActualValue.Clone()); 88 113 } 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 } 89 177 } 90 178 } -
branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/MultiObjective/SymbolicClassificationMultiObjectiveValidationBestSolutionAnalyzer.cs
r9456 r17687 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-2013Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. … … 24 24 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding; 25 25 using HeuristicLab.Parameters; 26 using H euristicLab.Persistence.Default.CompositeSerializers.Storable;26 using HEAL.Attic; 27 27 28 28 namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Classification { … … 31 31 /// </summary> 32 32 [Item("SymbolicClassificationMultiObjectiveValidationBestSolutionAnalyzer", "An operator that analyzes the validation best symbolic classification solution for multi objective symbolic classification problems.")] 33 [Storable Class]33 [StorableType("223AECFF-0EA7-4271-A342-9F2E5BF3EDC0")] 34 34 public sealed class SymbolicClassificationMultiObjectiveValidationBestSolutionAnalyzer : SymbolicDataAnalysisMultiObjectiveValidationBestSolutionAnalyzer<ISymbolicClassificationSolution, ISymbolicClassificationMultiObjectiveEvaluator, IClassificationProblemData>, 35 35 ISymbolicDataAnalysisBoundedOperator, ISymbolicClassificationModelCreatorOperator { … … 50 50 51 51 [StorableConstructor] 52 private SymbolicClassificationMultiObjectiveValidationBestSolutionAnalyzer( bool deserializing) : base(deserializing) { }52 private SymbolicClassificationMultiObjectiveValidationBestSolutionAnalyzer(StorableConstructorFlag _) : base(_) { } 53 53 private SymbolicClassificationMultiObjectiveValidationBestSolutionAnalyzer(SymbolicClassificationMultiObjectiveValidationBestSolutionAnalyzer original, Cloner cloner) : base(original, cloner) { } 54 54 public SymbolicClassificationMultiObjectiveValidationBestSolutionAnalyzer() … … 71 71 72 72 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); 74 74 if (ApplyLinearScalingParameter.ActualValue.Value) model.Scale(ProblemDataParameter.ActualValue); 75 75 -
branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/Plugin.cs.frame
r10037 r17687 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-2013Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. … … 26 26 27 27 namespace 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$")] 29 29 [PluginFile("HeuristicLab.Problems.DataAnalysis.Symbolic.Classification-3.4.dll", PluginFileType.Assembly)] 30 30 [PluginDependency("HeuristicLab.ALGLIB", "3.7.0")] … … 39 39 [PluginDependency("HeuristicLab.Optimization", "3.3")] 40 40 [PluginDependency("HeuristicLab.Parameters", "3.3")] 41 [PluginDependency("HeuristicLab. Persistence", "3.3")]41 [PluginDependency("HeuristicLab.Attic", "1.0")] 42 42 [PluginDependency("HeuristicLab.Problems.DataAnalysis", "3.4")] 43 43 [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 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-2013Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. … … 31 31 [assembly: AssemblyCompany("")] 32 32 [assembly: AssemblyProduct("HeuristicLab")] 33 [assembly: AssemblyCopyright("(c) 2002-2013HEAL")]33 [assembly: AssemblyCopyright("(c) HEAL")] 34 34 [assembly: AssemblyTrademark("")] 35 35 [assembly: AssemblyCulture("")] … … 53 53 // by using the '*' as shown below: 54 54 [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 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-2013Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. … … 27 27 using HeuristicLab.Data; 28 28 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding; 29 using H euristicLab.Persistence.Default.CompositeSerializers.Storable;29 using HEAL.Attic; 30 30 31 31 namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Classification.SingleObjective { 32 32 [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 [Storable Class]33 [StorableType("3C4C86ED-3F6A-464F-B7B6-326A220085EC")] 34 34 public class SymbolicClassificationSingleObjectiveBoundedMeanSquaredErrorEvaluator : SymbolicClassificationSingleObjectiveEvaluator { 35 35 [StorableConstructor] 36 protected SymbolicClassificationSingleObjectiveBoundedMeanSquaredErrorEvaluator( bool deserializing) : base(deserializing) { }36 protected SymbolicClassificationSingleObjectiveBoundedMeanSquaredErrorEvaluator(StorableConstructorFlag _) : base(_) { } 37 37 protected SymbolicClassificationSingleObjectiveBoundedMeanSquaredErrorEvaluator(SymbolicClassificationSingleObjectiveBoundedMeanSquaredErrorEvaluator original, Cloner cloner) : base(original, cloner) { } 38 38 public override IDeepCloneable Clone(Cloner cloner) { -
branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/SingleObjective/SymbolicClassificationSingleObjectiveEvaluator.cs
r9456 r17687 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-2013Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. … … 21 21 22 22 using HeuristicLab.Common; 23 using H euristicLab.Persistence.Default.CompositeSerializers.Storable;23 using HEAL.Attic; 24 24 25 25 namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Classification { 26 [Storable Class]26 [StorableType("48C7BDD3-9EED-4D61-AF72-A895556052A7")] 27 27 public abstract class SymbolicClassificationSingleObjectiveEvaluator : SymbolicDataAnalysisSingleObjectiveEvaluator<IClassificationProblemData>, ISymbolicClassificationSingleObjectiveEvaluator { 28 28 [StorableConstructor] 29 protected SymbolicClassificationSingleObjectiveEvaluator( bool deserializing) : base(deserializing) { }29 protected SymbolicClassificationSingleObjectiveEvaluator(StorableConstructorFlag _) : base(_) { } 30 30 protected SymbolicClassificationSingleObjectiveEvaluator(SymbolicClassificationSingleObjectiveEvaluator original, Cloner cloner) 31 31 : base(original, cloner) { -
branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/SingleObjective/SymbolicClassificationSingleObjectiveMeanSquaredErrorEvaluator.cs
r10291 r17687 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-2013Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. … … 26 26 using HeuristicLab.Data; 27 27 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding; 28 using H euristicLab.Persistence.Default.CompositeSerializers.Storable;28 using HEAL.Attic; 29 29 30 30 namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Classification { 31 31 [Item("Mean squared error Evaluator", "Calculates the mean squared error of a symbolic classification solution.")] 32 [Storable Class]32 [StorableType("E738C902-4293-4B2C-BBAC-1EE79381657D")] 33 33 public class SymbolicClassificationSingleObjectiveMeanSquaredErrorEvaluator : SymbolicClassificationSingleObjectiveEvaluator { 34 34 [StorableConstructor] 35 protected SymbolicClassificationSingleObjectiveMeanSquaredErrorEvaluator( bool deserializing) : base(deserializing) { }35 protected SymbolicClassificationSingleObjectiveMeanSquaredErrorEvaluator(StorableConstructorFlag _) : base(_) { } 36 36 protected SymbolicClassificationSingleObjectiveMeanSquaredErrorEvaluator(SymbolicClassificationSingleObjectiveMeanSquaredErrorEvaluator original, Cloner cloner) 37 37 : base(original, cloner) { -
branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/SingleObjective/SymbolicClassificationSingleObjectiveOverfittingAnalyzer.cs
r10576 r17687 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-2013Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. … … 28 28 using HeuristicLab.Optimization; 29 29 using HeuristicLab.Parameters; 30 using H euristicLab.Persistence.Default.CompositeSerializers.Storable;30 using HEAL.Attic; 31 31 32 32 namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Classification { 33 33 [Item("SymbolicClassificationSingleObjectiveOverfittingAnalyzer", "Calculates and tracks correlation of training and validation fitness of symbolic classification models.")] 34 [Storable Class]34 [StorableType("551DB3E3-56F8-4E92-B538-D453DBA23D77")] 35 35 public sealed class SymbolicClassificationSingleObjectiveOverfittingAnalyzer : SymbolicDataAnalysisSingleObjectiveValidationAnalyzer<ISymbolicClassificationSingleObjectiveEvaluator, IClassificationProblemData> { 36 36 private const string TrainingValidationCorrelationParameterName = "Training and validation fitness correlation"; … … 59 59 60 60 [StorableConstructor] 61 private SymbolicClassificationSingleObjectiveOverfittingAnalyzer( bool deserializing) : base(deserializing) { }61 private SymbolicClassificationSingleObjectiveOverfittingAnalyzer(StorableConstructorFlag _) : base(_) { } 62 62 private SymbolicClassificationSingleObjectiveOverfittingAnalyzer(SymbolicClassificationSingleObjectiveOverfittingAnalyzer original, Cloner cloner) : base(original, cloner) { } 63 63 public SymbolicClassificationSingleObjectiveOverfittingAnalyzer() -
branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/SingleObjective/SymbolicClassificationSingleObjectivePearsonRSquaredEvaluator.cs
r10291 r17687 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-2013Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. … … 25 25 using HeuristicLab.Data; 26 26 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding; 27 using H euristicLab.Persistence.Default.CompositeSerializers.Storable;27 using HEAL.Attic; 28 28 29 29 namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Classification { 30 30 [Item("Pearson R² evaluator", "Calculates the square of the pearson correlation coefficient (also known as coefficient of determination) of a symbolic classification solution.")] 31 [Storable Class]31 [StorableType("F6F480F9-21DC-4D22-9D5C-5951906BEB79")] 32 32 public class SymbolicClassificationSingleObjectivePearsonRSquaredEvaluator : SymbolicClassificationSingleObjectiveEvaluator { 33 33 [StorableConstructor] 34 protected SymbolicClassificationSingleObjectivePearsonRSquaredEvaluator( bool deserializing) : base(deserializing) { }34 protected SymbolicClassificationSingleObjectivePearsonRSquaredEvaluator(StorableConstructorFlag _) : base(_) { } 35 35 protected SymbolicClassificationSingleObjectivePearsonRSquaredEvaluator(SymbolicClassificationSingleObjectivePearsonRSquaredEvaluator original, Cloner cloner) 36 36 : base(original, cloner) { … … 57 57 OnlineCalculatorError errorState; 58 58 59 double r 2;59 double r; 60 60 if (applyLinearScaling) { 61 var r 2Calculator = new OnlinePearsonsRSquaredCalculator();62 CalculateWithScaling(targetValues, estimatedValues, lowerEstimationLimit, upperEstimationLimit, r 2Calculator, problemData.Dataset.Rows);63 errorState = r 2Calculator.ErrorState;64 r 2 = 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; 65 65 } else { 66 66 IEnumerable<double> boundedEstimatedValues = estimatedValues.LimitToRange(lowerEstimationLimit, upperEstimationLimit); 67 r 2 = OnlinePearsonsRSquaredCalculator.Calculate(targetValues, boundedEstimatedValues, out errorState);67 r = OnlinePearsonsRCalculator.Calculate(targetValues, boundedEstimatedValues, out errorState); 68 68 } 69 69 if (errorState != OnlineCalculatorError.None) return double.NaN; 70 return r 2;70 return r*r; 71 71 } 72 72 -
branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/SingleObjective/SymbolicClassificationSingleObjectivePenaltyScoreEvaluator.cs
r10291 r17687 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-2013Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. … … 26 26 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding; 27 27 using HeuristicLab.Parameters; 28 using H euristicLab.Persistence.Default.CompositeSerializers.Storable;28 using HEAL.Attic; 29 29 30 30 namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Classification { 31 31 [Item("Penalty Score Evaluator", "Calculates the penalty score of a symbolic classification solution.")] 32 [Storable Class]32 [StorableType("59D79396-2CBD-4033-9752-52A44243D554")] 33 33 public class SymbolicClassificationSingleObjectivePenaltyScoreEvaluator : SymbolicClassificationSingleObjectiveEvaluator, ISymbolicClassificationModelCreatorOperator { 34 34 private const string ModelCreatorParameterName = "ModelCreator"; … … 43 43 44 44 [StorableConstructor] 45 protected SymbolicClassificationSingleObjectivePenaltyScoreEvaluator( bool deserializing) : base(deserializing) { }45 protected SymbolicClassificationSingleObjectivePenaltyScoreEvaluator(StorableConstructorFlag _) : base(_) { } 46 46 protected SymbolicClassificationSingleObjectivePenaltyScoreEvaluator(SymbolicClassificationSingleObjectivePenaltyScoreEvaluator original, Cloner cloner) : base(original, cloner) { } 47 47 public SymbolicClassificationSingleObjectivePenaltyScoreEvaluator() … … 91 91 ApplyLinearScalingParameter.ExecutionContext = context; 92 92 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); 94 94 if (ApplyLinearScalingParameter.ActualValue.Value) model.Scale(problemData); 95 95 model.RecalculateModelParameters(problemData, rows); -
branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/SingleObjective/SymbolicClassificationSingleObjectiveProblem.cs
r9456 r17687 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-2013Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. … … 22 22 using HeuristicLab.Common; 23 23 using HeuristicLab.Core; 24 using HeuristicLab.Optimization; 24 25 using HeuristicLab.Parameters; 25 using H euristicLab.Persistence.Default.CompositeSerializers.Storable;26 using HEAL.Attic; 26 27 27 28 namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Classification { 28 [Item("Symbolic Classification Problem (single 29 [Storable Class]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)] 31 32 public class SymbolicClassificationSingleObjectiveProblem : SymbolicDataAnalysisSingleObjectiveProblem<IClassificationProblemData, ISymbolicClassificationSingleObjectiveEvaluator, ISymbolicDataAnalysisSolutionCreator>, IClassificationProblem { 32 33 private const double PunishmentFactor = 10; … … 54 55 #endregion 55 56 [StorableConstructor] 56 protected SymbolicClassificationSingleObjectiveProblem( bool deserializing) : base(deserializing) { }57 protected SymbolicClassificationSingleObjectiveProblem(StorableConstructorFlag _) : base(_) { } 57 58 protected SymbolicClassificationSingleObjectiveProblem(SymbolicClassificationSingleObjectiveProblem original, Cloner cloner) 58 59 : base(original, cloner) { … … 115 116 Operators.Add(new SymbolicClassificationSingleObjectiveTrainingParetoBestSolutionAnalyzer()); 116 117 Operators.Add(new SymbolicClassificationSingleObjectiveValidationParetoBestSolutionAnalyzer()); 118 Operators.Add(new SymbolicExpressionTreePhenotypicSimilarityCalculator()); 119 Operators.Add(new SymbolicClassificationPhenotypicDiversityAnalyzer(Operators.OfType<SymbolicExpressionTreePhenotypicSimilarityCalculator>())); 117 120 ParameterizeOperators(); 118 121 } … … 145 148 op.ModelCreatorParameter.ActualName = ModelCreatorParameter.Name; 146 149 } 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 } 147 161 } 148 162 } -
branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/SingleObjective/SymbolicClassificationSingleObjectiveTrainingBestSolutionAnalyzer.cs
r9456 r17687 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-2013Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. … … 24 24 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding; 25 25 using HeuristicLab.Parameters; 26 using H euristicLab.Persistence.Default.CompositeSerializers.Storable;26 using HEAL.Attic; 27 27 28 28 namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Classification { … … 31 31 /// </summary> 32 32 [Item("SymbolicClassificationSingleObjectiveTrainingBestSolutionAnalyzer", "An operator that analyzes the training best symbolic classification solution for single objective symbolic classification problems.")] 33 [Storable Class]33 [StorableType("1E179E22-DD6C-4914-8FAA-AB8F7F9B7F7F")] 34 34 public sealed class SymbolicClassificationSingleObjectiveTrainingBestSolutionAnalyzer : SymbolicDataAnalysisSingleObjectiveTrainingBestSolutionAnalyzer<ISymbolicClassificationSolution>, 35 35 ISymbolicDataAnalysisInterpreterOperator, ISymbolicDataAnalysisBoundedOperator, ISymbolicClassificationModelCreatorOperator { … … 58 58 59 59 [StorableConstructor] 60 private SymbolicClassificationSingleObjectiveTrainingBestSolutionAnalyzer( bool deserializing) : base(deserializing) { }60 private SymbolicClassificationSingleObjectiveTrainingBestSolutionAnalyzer(StorableConstructorFlag _) : base(_) { } 61 61 private SymbolicClassificationSingleObjectiveTrainingBestSolutionAnalyzer(SymbolicClassificationSingleObjectiveTrainingBestSolutionAnalyzer original, Cloner cloner) : base(original, cloner) { } 62 62 public SymbolicClassificationSingleObjectiveTrainingBestSolutionAnalyzer() … … 81 81 82 82 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); 84 84 if (ApplyLinearScalingParameter.ActualValue.Value) model.Scale(ProblemDataParameter.ActualValue); 85 85 -
branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/SingleObjective/SymbolicClassificationSingleObjectiveTrainingParetoBestSolutionAnalyzer.cs
r9456 r17687 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-2013Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. … … 24 24 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding; 25 25 using HeuristicLab.Parameters; 26 using H euristicLab.Persistence.Default.CompositeSerializers.Storable;26 using HEAL.Attic; 27 27 28 28 namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Classification { … … 31 31 /// </summary> 32 32 [Item("SymbolicClassificationSingleObjectiveTrainingParetoBestSolutionAnalyzer", "An operator that collects the training Pareto-best symbolic classification solutions for single objective symbolic classification problems.")] 33 [Storable Class]33 [StorableType("881573CA-7246-4203-B5C9-10793325A008")] 34 34 public sealed class SymbolicClassificationSingleObjectiveTrainingParetoBestSolutionAnalyzer : SymbolicDataAnalysisSingleObjectiveTrainingParetoBestSolutionAnalyzer<IClassificationProblemData, ISymbolicClassificationSolution>, ISymbolicClassificationModelCreatorOperator { 35 35 private const string ModelCreatorParameterName = "ModelCreator"; … … 44 44 45 45 [StorableConstructor] 46 private SymbolicClassificationSingleObjectiveTrainingParetoBestSolutionAnalyzer( bool deserializing) : base(deserializing) { }46 private SymbolicClassificationSingleObjectiveTrainingParetoBestSolutionAnalyzer(StorableConstructorFlag _) : base(_) { } 47 47 private SymbolicClassificationSingleObjectiveTrainingParetoBestSolutionAnalyzer(SymbolicClassificationSingleObjectiveTrainingParetoBestSolutionAnalyzer original, Cloner cloner) : base(original, cloner) { } 48 48 public SymbolicClassificationSingleObjectiveTrainingParetoBestSolutionAnalyzer() … … 64 64 65 65 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); 67 67 if (ApplyLinearScalingParameter.ActualValue.Value) model.Scale(ProblemDataParameter.ActualValue); 68 68 -
branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/SingleObjective/SymbolicClassificationSingleObjectiveValidationBestSolutionAnalyzer.cs
r9456 r17687 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-2013Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. … … 24 24 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding; 25 25 using HeuristicLab.Parameters; 26 using H euristicLab.Persistence.Default.CompositeSerializers.Storable;26 using HEAL.Attic; 27 27 28 28 namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Classification { … … 31 31 /// </summary> 32 32 [Item("SymbolicClassificationSingleObjectiveValidationBestSolutionAnalyzer", "An operator that analyzes the validation best symbolic classification solution for single objective symbolic classification problems.")] 33 [Storable Class]33 [StorableType("4BEB7C5A-0B3A-4276-95C6-689F8BA8E0E6")] 34 34 public sealed class SymbolicClassificationSingleObjectiveValidationBestSolutionAnalyzer : SymbolicDataAnalysisSingleObjectiveValidationBestSolutionAnalyzer<ISymbolicClassificationSolution, ISymbolicClassificationSingleObjectiveEvaluator, IClassificationProblemData>, 35 35 ISymbolicDataAnalysisBoundedOperator, ISymbolicClassificationModelCreatorOperator { … … 50 50 51 51 [StorableConstructor] 52 private SymbolicClassificationSingleObjectiveValidationBestSolutionAnalyzer( bool deserializing) : base(deserializing) { }52 private SymbolicClassificationSingleObjectiveValidationBestSolutionAnalyzer(StorableConstructorFlag _) : base(_) { } 53 53 private SymbolicClassificationSingleObjectiveValidationBestSolutionAnalyzer(SymbolicClassificationSingleObjectiveValidationBestSolutionAnalyzer original, Cloner cloner) : base(original, cloner) { } 54 54 public SymbolicClassificationSingleObjectiveValidationBestSolutionAnalyzer() … … 71 71 72 72 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); 74 74 if (ApplyLinearScalingParameter.ActualValue.Value) model.Scale(ProblemDataParameter.ActualValue); 75 75 -
branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/SingleObjective/SymbolicClassificationSingleObjectiveValidationParetoBestSolutionAnalyzer.cs
r9456 r17687 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-2013Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. … … 24 24 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding; 25 25 using HeuristicLab.Parameters; 26 using H euristicLab.Persistence.Default.CompositeSerializers.Storable;26 using HEAL.Attic; 27 27 28 28 namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Classification { … … 31 31 /// </summary> 32 32 [Item("SymbolicClassificationSingleObjectiveValidationParetoBestSolutionAnalyzer", "An operator that collects the validation Pareto-best symbolic classification solutions for single objective symbolic classification problems.")] 33 [Storable Class]33 [StorableType("DCD4AFE1-B6E5-4A97-BEB3-1BF3E336DD78")] 34 34 public sealed class SymbolicClassificationSingleObjectiveValidationParetoBestSolutionAnalyzer : SymbolicDataAnalysisSingleObjectiveValidationParetoBestSolutionAnalyzer<ISymbolicClassificationSolution, ISymbolicClassificationSingleObjectiveEvaluator, IClassificationProblemData>, ISymbolicClassificationModelCreatorOperator { 35 35 private const string ModelCreatorParameterName = "ModelCreator"; … … 44 44 45 45 [StorableConstructor] 46 private SymbolicClassificationSingleObjectiveValidationParetoBestSolutionAnalyzer( bool deserializing) : base(deserializing) { }46 private SymbolicClassificationSingleObjectiveValidationParetoBestSolutionAnalyzer(StorableConstructorFlag _) : base(_) { } 47 47 private SymbolicClassificationSingleObjectiveValidationParetoBestSolutionAnalyzer(SymbolicClassificationSingleObjectiveValidationParetoBestSolutionAnalyzer original, Cloner cloner) : base(original, cloner) { } 48 48 public SymbolicClassificationSingleObjectiveValidationParetoBestSolutionAnalyzer() … … 64 64 65 65 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); 67 67 if (ApplyLinearScalingParameter.ActualValue.Value) model.Scale(ProblemDataParameter.ActualValue); 68 68 -
branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/Sliding Window/GenerationalClassificationSlidingWindowAnalyzer.cs
r10681 r17687 24 24 using HeuristicLab.Optimization; 25 25 using HeuristicLab.Parameters; 26 using H euristicLab.Persistence.Default.CompositeSerializers.Storable;26 using HEAL.Attic; 27 27 28 28 namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Classification { 29 [StorableClass]30 29 [Item("Generational Classification Sliding Window Analyzer", "")] 30 [StorableType("62291FAE-D74F-41FC-98D0-A5B23450B39F")] 31 31 public class GenerationalClassificationSlidingWindowAnalyzer : GenerationalSlidingWindowAnalyzer { 32 32 private const string ModelCreatorParameterName = "ModelCreator"; … … 43 43 #endregion 44 44 [StorableConstructor] 45 protected GenerationalClassificationSlidingWindowAnalyzer( bool deserializing) : base(deserializing) { }45 protected GenerationalClassificationSlidingWindowAnalyzer(StorableConstructorFlag _) : base(_) { } 46 46 [StorableHook(HookType.AfterDeserialization)] 47 47 private void AfterDeserialization() { } -
branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/Sliding Window/OffspringSelectionClassificationSlidingWindowAnalyzer.cs
r10681 r17687 25 25 using HeuristicLab.Parameters; 26 26 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 27 using HEAL.Attic; 27 28 28 29 namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Classification { 29 [StorableClass]30 30 [Item("Offspring Selection Classification Sliding Window Analyzer", "")] 31 [StorableType("D9D8C0D5-47D2-4FDF-B480-1A17D5D21EB1")] 31 32 public class OffspringSelectionClassificationSlidingWindowAnalyzer : OffspringSelectionSlidingWindowAnalyzer { 32 33 private const string ModelCreatorParameterName = "ModelCreator"; … … 43 44 #endregion 44 45 [StorableConstructor] 45 protected OffspringSelectionClassificationSlidingWindowAnalyzer( bool deserializing) : base(deserializing) { }46 protected OffspringSelectionClassificationSlidingWindowAnalyzer(StorableConstructorFlag _) : base(_) { } 46 47 [StorableHook(HookType.AfterDeserialization)] 47 48 private void AfterDeserialization() { } -
branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/Sliding Window/SlidingWindowBestClassificationSolutionsCollection.cs
r10681 r17687 23 23 using HeuristicLab.Core; 24 24 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding; 25 using H euristicLab.Persistence.Default.CompositeSerializers.Storable;25 using HEAL.Attic; 26 26 27 27 namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Classification { 28 [StorableClass]29 28 [Item("Sliding Window Best Classification Solutions Collection", "A collection of best sliding window solutions for symbolic classification.")] 29 [StorableType("65F9CF37-643A-4236-AA36-8721BA03B006")] 30 30 public class SlidingWindowBestClassificationSolutionsCollection : SlidingWindowBestSolutionsCollection { 31 31 public new IClassificationProblemData ProblemData { … … 35 35 public ISymbolicClassificationModelCreator ModelCreator { get; set; } 36 36 [StorableConstructor] 37 protected SlidingWindowBestClassificationSolutionsCollection( bool deserializing) : base(deserializing) { }37 protected SlidingWindowBestClassificationSolutionsCollection(StorableConstructorFlag _) : base(_) { } 38 38 [StorableHook(HookType.AfterDeserialization)] 39 39 private void AfterDeserialization() { } … … 47 47 public override ISymbolicDataAnalysisModel CreateModel(ISymbolicExpressionTree tree, ISymbolicDataAnalysisExpressionTreeInterpreter interpreter, 48 48 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); 50 50 model.RecalculateModelParameters(ProblemData, ProblemData.TrainingIndices); 51 51 return model; -
branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/SymbolicClassificationModel.cs
r9587 r17687 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-2013Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. … … 20 20 #endregion 21 21 22 using System; 22 23 using System.Collections.Generic; 23 24 using HeuristicLab.Common; 24 25 using HeuristicLab.Core; 25 26 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding; 26 using H euristicLab.Persistence.Default.CompositeSerializers.Storable;27 using HEAL.Attic; 27 28 28 29 namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Classification { … … 30 31 /// Represents a symbolic classification model 31 32 /// </summary> 32 [Storable Class]33 [StorableType("8AEAF4A5-839D-4070-A348-440E79110C74")] 33 34 [Item(Name = "SymbolicClassificationModel", Description = "Represents a symbolic classification model.")] 34 35 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 } 35 46 36 47 [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 } 42 51 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); 44 63 public abstract void RecalculateModelParameters(IClassificationProblemData problemData, IEnumerable<int> rows); 45 64 … … 53 72 Scale(problemData, problemData.TargetVariable); 54 73 } 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 55 95 } 56 96 } -
branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/SymbolicClassificationPhenotypicDiversityAnalyzer.cs
r15681 r17687 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-2018Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. … … 29 29 using HeuristicLab.Optimization; 30 30 using HeuristicLab.Parameters; 31 using H euristicLab.Persistence.Default.CompositeSerializers.Storable;31 using HEAL.Attic; 32 32 33 33 namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Classification { 34 34 [Item("SymbolicClassificationPhenotypicDiversityAnalyzer", "An analyzer which calculates diversity based on the phenotypic distance between trees")] 35 [Storable Class]35 [StorableType("D09C1CC5-2BFB-4B5C-A496-F8EA98741C37")] 36 36 public class SymbolicClassificationPhenotypicDiversityAnalyzer : PopulationSimilarityAnalyzer, 37 37 ISymbolicDataAnalysisBoundedOperator, ISymbolicDataAnalysisInterpreterOperator, ISymbolicExpressionTreeAnalyzer { … … 94 94 95 95 [StorableConstructor] 96 protected SymbolicClassificationPhenotypicDiversityAnalyzer(bool deserializing) 97 : base(deserializing) { 96 protected SymbolicClassificationPhenotypicDiversityAnalyzer(StorableConstructorFlag _) : base(_) { 98 97 } 99 98 -
branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/SymbolicClassificationPruningAnalyzer.cs
r10469 r17687 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-2014Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. … … 22 22 using HeuristicLab.Common; 23 23 using HeuristicLab.Core; 24 using HeuristicLab.Data; 24 25 using HeuristicLab.Parameters; 25 using H euristicLab.Persistence.Default.CompositeSerializers.Storable;26 using HEAL.Attic; 26 27 27 28 namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Classification { 28 29 [Item("SymbolicClassificationPruningAnalyzer", "An analyzer that prunes introns from the population.")] 29 [Storable Class]30 [StorableType("26701D59-DEB6-4CBF-89DC-C5C3F310B634")] 30 31 public sealed class SymbolicClassificationPruningAnalyzer : SymbolicDataAnalysisSingleObjectivePruningAnalyzer { 31 private const string ImpactValuesCalculatorParameterName = "ImpactValuesCalculator";32 32 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]; } 38 35 } 39 36 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 40 44 [StorableConstructor] 41 private SymbolicClassificationPruningAnalyzer( bool deserializing) : base(deserializing) { }45 private SymbolicClassificationPruningAnalyzer(StorableConstructorFlag _) : base(_) { } 42 46 43 47 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 46 80 } 47 81 } -
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 24 using System.Collections.Generic; 25 using System.Linq; 2 26 using HeuristicLab.Common; 3 27 using HeuristicLab.Core; 4 using HeuristicLab. Data;28 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding; 5 29 using HeuristicLab.Parameters; 6 using H euristicLab.Persistence.Default.CompositeSerializers.Storable;30 using HEAL.Attic; 7 31 8 32 namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Classification { 9 [Storable Class]33 [StorableType("F213025F-ACE7-4E43-A149-70C3AD824D19")] 10 34 [Item("SymbolicClassificationPruningOperator", "An operator which prunes symbolic classificaton trees.")] 11 35 public class SymbolicClassificationPruningOperator : SymbolicDataAnalysisExpressionPruningOperator { 12 private const string ImpactValuesCalculatorParameterName = "ImpactValuesCalculator";13 36 private const string ModelCreatorParameterName = "ModelCreator"; 14 private const string ApplyLinearScalingParmameterName = "ApplyLinearScaling";37 private const string EvaluatorParameterName = "Evaluator"; 15 38 16 39 #region parameter properties … … 19 42 } 20 43 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 } 23 48 } 24 49 #endregion 25 #region properties26 private ISymbolicClassificationModelCreator ModelCreator { get { return ModelCreatorParameter.ActualValue; } }27 private BoolValue ApplyLinearScaling { get { return ApplyLinearScalingParameter.ActualValue; } }28 #endregion29 50 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)); 36 61 } 37 62 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 44 72 } 45 73 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); 51 80 return model; 52 81 } 53 82 54 83 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; 64 120 } 65 121 } -
branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/SymbolicClassificationSolution.cs
r9456 r17687 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-2013Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. … … 20 20 #endregion 21 21 22 using System.Linq; 22 23 using HeuristicLab.Common; 23 24 using HeuristicLab.Core; 24 25 using HeuristicLab.Data; 26 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding; 25 27 using HeuristicLab.Optimization; 26 using H euristicLab.Persistence.Default.CompositeSerializers.Storable;28 using HEAL.Attic; 27 29 28 30 namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Classification { … … 30 32 /// Represents a symbolic classification solution (model + data) and attributes of the solution like accuracy and complexity 31 33 /// </summary> 32 [Storable Class]34 [StorableType("C2829CEB-8D34-4FAB-B9AE-23937071B53F")] 33 35 [Item(Name = "SymbolicClassificationSolution", Description = "Represents a symbolic classification solution (model + data) and attributes of the solution like accuracy and complexity.")] 34 36 public sealed class SymbolicClassificationSolution : ClassificationSolution, ISymbolicClassificationSolution { … … 55 57 56 58 [StorableConstructor] 57 private SymbolicClassificationSolution( bool deserializing) : base(deserializing) { }59 private SymbolicClassificationSolution(StorableConstructorFlag _) : base(_) { } 58 60 private SymbolicClassificationSolution(SymbolicClassificationSolution original, Cloner cloner) 59 61 : base(original, cloner) { … … 61 63 public SymbolicClassificationSolution(ISymbolicClassificationModel model, IClassificationProblemData problemData) 62 64 : base(model, problemData) { 65 foreach (var node in model.SymbolicExpressionTree.Root.IterateNodesPrefix().OfType<SymbolicExpressionTreeTopLevelNode>()) 66 node.SetGrammar(null); 67 63 68 Add(new Result(ModelLengthResultName, "Length of the symbolic classification model.", new IntValue())); 64 69 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 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-2013Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. … … 20 20 #endregion 21 21 22 using System;23 22 using System.Collections.Generic; 24 23 using HeuristicLab.Common; 25 24 using HeuristicLab.Core; 26 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding; 27 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 25 using HEAL.Attic; 28 26 29 27 namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Classification { 30 [Storable Class]28 [StorableType("54D82779-7A37-43E4-AFD6-0C3E8D24F6EE")] 31 29 [Item("SymbolicClassificationSolutionImpactValuesCalculator", "Calculate symbolic expression tree node impact values for classification problems.")] 32 30 public class SymbolicClassificationSolutionImpactValuesCalculator : SymbolicDataAnalysisSolutionImpactValuesCalculator { … … 38 36 } 39 37 [StorableConstructor] 40 protected SymbolicClassificationSolutionImpactValuesCalculator( bool deserializing) : base(deserializing) { }38 protected SymbolicClassificationSolutionImpactValuesCalculator(StorableConstructorFlag _) : base(_) { } 41 39 42 p ublic override double CalculateReplacementValue(ISymbolicDataAnalysisModel model, ISymbolicExpressionTreeNode node, IDataAnalysisProblemData problemData, IEnumerable<int> rows) {40 protected override double CalculateQualityForImpacts(ISymbolicDataAnalysisModel model, IDataAnalysisProblemData problemData, IEnumerable<int> rows) { 43 41 var classificationModel = (ISymbolicClassificationModel)model; 44 42 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); 62 46 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; 88 51 } 89 52 } -
branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/SymbolicDiscriminantFunctionClassificationModel.cs
r9456 r17687 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-2013Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. … … 26 26 using HeuristicLab.Core; 27 27 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding; 28 using H euristicLab.Persistence.Default.CompositeSerializers.Storable;28 using HEAL.Attic; 29 29 30 30 namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Classification { … … 32 32 /// Represents a symbolic classification model 33 33 /// </summary> 34 [Storable Class]34 [StorableType("99332204-4097-496A-AB05-4DB9478DB159")] 35 35 [Item(Name = "SymbolicDiscriminantFunctionClassificationModel", Description = "Represents a symbolic classification model unsing a discriminant function.")] 36 36 public class SymbolicDiscriminantFunctionClassificationModel : SymbolicClassificationModel, ISymbolicDiscriminantFunctionClassificationModel { … … 58 58 59 59 [StorableConstructor] 60 protected SymbolicDiscriminantFunctionClassificationModel( bool deserializing) : base(deserializing) { }60 protected SymbolicDiscriminantFunctionClassificationModel(StorableConstructorFlag _) : base(_) { } 61 61 protected SymbolicDiscriminantFunctionClassificationModel(SymbolicDiscriminantFunctionClassificationModel original, Cloner cloner) 62 62 : base(original, cloner) { … … 65 65 thresholdCalculator = cloner.Clone(original.thresholdCalculator); 66 66 } 67 public SymbolicDiscriminantFunctionClassificationModel( ISymbolicExpressionTree tree, ISymbolicDataAnalysisExpressionTreeInterpreter interpreter, IDiscriminantFunctionThresholdCalculator thresholdCalculator,67 public SymbolicDiscriminantFunctionClassificationModel(string targetVariable, ISymbolicExpressionTree tree, ISymbolicDataAnalysisExpressionTreeInterpreter interpreter, IDiscriminantFunctionThresholdCalculator thresholdCalculator, 68 68 double lowerEstimationLimit = double.MinValue, double upperEstimationLimit = double.MaxValue) 69 : base(t ree, interpreter, lowerEstimationLimit, upperEstimationLimit) {69 : base(targetVariable, tree, interpreter, lowerEstimationLimit, upperEstimationLimit) { 70 70 this.thresholds = new double[0]; 71 71 this.classValues = new double[0]; … … 88 88 var classValuesArr = classValues.ToArray(); 89 89 var thresholdsArr = thresholds.ToArray(); 90 if (thresholdsArr.Length != classValuesArr.Length || thresholdsArr.Length < 1) 90 if (thresholdsArr.Length != classValuesArr.Length || thresholdsArr.Length < 1) 91 91 throw new ArgumentException(); 92 if (!double.IsNegativeInfinity(thresholds.First())) 92 if (!double.IsNegativeInfinity(thresholds.First())) 93 93 throw new ArgumentException(); 94 94 … … 107 107 } 108 108 109 public IEnumerable<double> GetEstimatedValues( Dataset dataset, IEnumerable<int> rows) {109 public IEnumerable<double> GetEstimatedValues(IDataset dataset, IEnumerable<int> rows) { 110 110 return Interpreter.GetSymbolicExpressionTreeValues(SymbolicExpressionTree, dataset, rows).LimitToRange(LowerEstimationLimit, UpperEstimationLimit); 111 111 } 112 112 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) { 114 118 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) { 116 120 int classIndex = 0; 117 121 // find first threshold value which is larger than x => class index = threshold index + 1 … … 123 127 } 124 128 } 125 126 129 127 130 public override ISymbolicClassificationSolution CreateClassificationSolution(IClassificationProblemData problemData) { -
branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/SymbolicDiscriminantFunctionClassificationSolution.cs
r9456 r17687 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-2013Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. … … 24 24 using HeuristicLab.Core; 25 25 using HeuristicLab.Data; 26 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding; 26 27 using HeuristicLab.Optimization; 27 using H euristicLab.Persistence.Default.CompositeSerializers.Storable;28 using HEAL.Attic; 28 29 29 30 namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Classification { … … 31 32 /// Represents a symbolic classification solution (model + data) and attributes of the solution like accuracy and complexity 32 33 /// </summary> 33 [Storable Class]34 [StorableType("83BEB8F0-DEF7-4E51-876D-9819BA10F2E8")] 34 35 [Item(Name = "SymbolicDiscriminantFunctionClassificationSolution", Description = "Represents a symbolic classification solution (model + data) and attributes of the solution like accuracy and complexity.")] 35 36 public sealed class SymbolicDiscriminantFunctionClassificationSolution : DiscriminantFunctionClassificationSolution, ISymbolicClassificationSolution { … … 101 102 102 103 [StorableConstructor] 103 private SymbolicDiscriminantFunctionClassificationSolution( bool deserializing) : base(deserializing) { }104 private SymbolicDiscriminantFunctionClassificationSolution(StorableConstructorFlag _) : base(_) { } 104 105 private SymbolicDiscriminantFunctionClassificationSolution(SymbolicDiscriminantFunctionClassificationSolution original, Cloner cloner) 105 106 : base(original, cloner) { … … 107 108 public SymbolicDiscriminantFunctionClassificationSolution(ISymbolicDiscriminantFunctionClassificationModel model, IClassificationProblemData problemData) 108 109 : base(model, problemData) { 110 foreach (var node in model.SymbolicExpressionTree.Root.IterateNodesPrefix().OfType<SymbolicExpressionTreeTopLevelNode>()) 111 node.SetGrammar(null); 112 109 113 Add(new Result(ModelLengthResultName, "Length of the symbolic classification model.", new IntValue())); 110 114 Add(new Result(ModelDepthResultName, "Depth of the symbolic classification model.", new IntValue())); 111 112 115 113 116 ResultCollection estimationLimitResults = new ResultCollection(); -
branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Classification/3.4/SymbolicNearestNeighbourClassificationModel.cs
r9456 r17687 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-2013Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. … … 26 26 using HeuristicLab.Core; 27 27 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding; 28 using H euristicLab.Persistence.Default.CompositeSerializers.Storable;28 using HEAL.Attic; 29 29 30 30 namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Classification { … … 32 32 /// Represents a nearest neighbour model for regression and classification 33 33 /// </summary> 34 [Storable Class]34 [StorableType("B9F8A753-B102-4356-8821-76E31634A0C6")] 35 35 [Item("SymbolicNearestNeighbourClassificationModel", "Represents a nearest neighbour model for symbolic classification.")] 36 36 public sealed class SymbolicNearestNeighbourClassificationModel : SymbolicClassificationModel { … … 47 47 48 48 [StorableConstructor] 49 private SymbolicNearestNeighbourClassificationModel( bool deserializing) : base(deserializing) { }49 private SymbolicNearestNeighbourClassificationModel(StorableConstructorFlag _) : base(_) { } 50 50 private SymbolicNearestNeighbourClassificationModel(SymbolicNearestNeighbourClassificationModel original, Cloner cloner) 51 51 : base(original, cloner) { … … 55 55 trainedClasses = new List<double>(original.trainedClasses); 56 56 } 57 public SymbolicNearestNeighbourClassificationModel( int k, ISymbolicExpressionTree tree, ISymbolicDataAnalysisExpressionTreeInterpreter interpreter, double lowerEstimationLimit = double.MinValue, double upperEstimationLimit = double.MaxValue)58 : base(t ree, 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) { 59 59 this.k = k; 60 60 frequencyComparer = new ClassFrequencyComparer(); … … 66 66 } 67 67 68 public override IEnumerable<double> GetEstimatedClassValues( Dataset dataset, IEnumerable<int> rows) {68 public override IEnumerable<double> GetEstimatedClassValues(IDataset dataset, IEnumerable<int> rows) { 69 69 var estimatedValues = Interpreter.GetSymbolicExpressionTreeValues(SymbolicExpressionTree, dataset, rows) 70 70 .LimitToRange(LowerEstimationLimit, UpperEstimationLimit); … … 143 143 } 144 144 145 [Storable Class]145 [StorableType("523AFB5D-3758-4547-BD6E-1181A01A02B4")] 146 146 internal sealed class ClassFrequencyComparer : IComparer<double> { 147 147 [Storable] … … 149 149 150 150 [StorableConstructor] 151 private ClassFrequencyComparer( bool deserializing) { }151 private ClassFrequencyComparer(StorableConstructorFlag _) { } 152 152 public ClassFrequencyComparer() { 153 153 classFrequencies = new Dictionary<double, int>();
Note: See TracChangeset
for help on using the changeset viewer.