Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
09/07/10 10:03:21 (14 years ago)
Author:
mkommend
Message:

added draft version of classification (ticket #939)

Location:
branches/HeuristicLab.Classification/HeuristicLab.Problems.DataAnalysis.Classification/3.3
Files:
6 added
8 edited

Legend:

Unmodified
Added
Removed
  • branches/HeuristicLab.Classification/HeuristicLab.Problems.DataAnalysis.Classification/3.3

    • Property svn:ignore
      •  

        old new  
        33obj
        44HeuristicLabProblemsDataAnalysisClassifcationPlugin.cs
         5HeuristicLabProblemsDataAnalysisClassificationPlugin.cs
  • branches/HeuristicLab.Classification/HeuristicLab.Problems.DataAnalysis.Classification/3.3/HeuristicLab.Problems.DataAnalysis.Classification.csproj

    r4323 r4366  
    3838    <AssemblyOriginatorKeyFile>HeuristicLab.snk</AssemblyOriginatorKeyFile>
    3939  </PropertyGroup>
     40  <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
     41    <DebugSymbols>true</DebugSymbols>
     42    <OutputPath>bin\x64\Debug\</OutputPath>
     43    <DefineConstants>DEBUG;TRACE</DefineConstants>
     44    <DebugType>full</DebugType>
     45    <PlatformTarget>x64</PlatformTarget>
     46    <CodeAnalysisLogFile>bin\Debug\HeuristicLab.Problems.DataAnalysis.Classification-3.3.dll.CodeAnalysisLog.xml</CodeAnalysisLogFile>
     47    <CodeAnalysisUseTypeNameInSuppression>true</CodeAnalysisUseTypeNameInSuppression>
     48    <CodeAnalysisModuleSuppressionsFile>GlobalSuppressions.cs</CodeAnalysisModuleSuppressionsFile>
     49    <ErrorReport>prompt</ErrorReport>
     50    <CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
     51    <CodeAnalysisRuleSetDirectories>;c:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\\Rule Sets</CodeAnalysisRuleSetDirectories>
     52    <CodeAnalysisIgnoreBuiltInRuleSets>true</CodeAnalysisIgnoreBuiltInRuleSets>
     53    <CodeAnalysisRuleDirectories>;c:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\FxCop\\Rules</CodeAnalysisRuleDirectories>
     54    <CodeAnalysisIgnoreBuiltInRules>true</CodeAnalysisIgnoreBuiltInRules>
     55  </PropertyGroup>
     56  <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
     57    <OutputPath>bin\x64\Release\</OutputPath>
     58    <DefineConstants>TRACE</DefineConstants>
     59    <Optimize>true</Optimize>
     60    <DebugType>pdbonly</DebugType>
     61    <PlatformTarget>x64</PlatformTarget>
     62    <CodeAnalysisLogFile>bin\Release\HeuristicLab.Problems.DataAnalysis.Classification-3.3.dll.CodeAnalysisLog.xml</CodeAnalysisLogFile>
     63    <CodeAnalysisUseTypeNameInSuppression>true</CodeAnalysisUseTypeNameInSuppression>
     64    <CodeAnalysisModuleSuppressionsFile>GlobalSuppressions.cs</CodeAnalysisModuleSuppressionsFile>
     65    <ErrorReport>prompt</ErrorReport>
     66    <CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
     67    <CodeAnalysisRuleSetDirectories>;c:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\\Rule Sets</CodeAnalysisRuleSetDirectories>
     68    <CodeAnalysisIgnoreBuiltInRuleSets>true</CodeAnalysisIgnoreBuiltInRuleSets>
     69    <CodeAnalysisRuleDirectories>;c:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\FxCop\\Rules</CodeAnalysisRuleDirectories>
     70    <CodeAnalysisIgnoreBuiltInRules>true</CodeAnalysisIgnoreBuiltInRules>
     71  </PropertyGroup>
     72  <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
     73    <DebugSymbols>true</DebugSymbols>
     74    <OutputPath>bin\x86\Debug\</OutputPath>
     75    <DefineConstants>DEBUG;TRACE</DefineConstants>
     76    <DebugType>full</DebugType>
     77    <PlatformTarget>x86</PlatformTarget>
     78    <CodeAnalysisLogFile>bin\Debug\HeuristicLab.Problems.DataAnalysis.Classification-3.3.dll.CodeAnalysisLog.xml</CodeAnalysisLogFile>
     79    <CodeAnalysisUseTypeNameInSuppression>true</CodeAnalysisUseTypeNameInSuppression>
     80    <CodeAnalysisModuleSuppressionsFile>GlobalSuppressions.cs</CodeAnalysisModuleSuppressionsFile>
     81    <ErrorReport>prompt</ErrorReport>
     82    <CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
     83    <CodeAnalysisRuleSetDirectories>;c:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\\Rule Sets</CodeAnalysisRuleSetDirectories>
     84    <CodeAnalysisIgnoreBuiltInRuleSets>true</CodeAnalysisIgnoreBuiltInRuleSets>
     85    <CodeAnalysisRuleDirectories>;c:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\FxCop\\Rules</CodeAnalysisRuleDirectories>
     86    <CodeAnalysisIgnoreBuiltInRules>true</CodeAnalysisIgnoreBuiltInRules>
     87  </PropertyGroup>
     88  <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
     89    <OutputPath>bin\x86\Release\</OutputPath>
     90    <DefineConstants>TRACE</DefineConstants>
     91    <Optimize>true</Optimize>
     92    <DebugType>pdbonly</DebugType>
     93    <PlatformTarget>x86</PlatformTarget>
     94    <CodeAnalysisLogFile>bin\Release\HeuristicLab.Problems.DataAnalysis.Classification-3.3.dll.CodeAnalysisLog.xml</CodeAnalysisLogFile>
     95    <CodeAnalysisUseTypeNameInSuppression>true</CodeAnalysisUseTypeNameInSuppression>
     96    <CodeAnalysisModuleSuppressionsFile>GlobalSuppressions.cs</CodeAnalysisModuleSuppressionsFile>
     97    <ErrorReport>prompt</ErrorReport>
     98    <CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
     99    <CodeAnalysisRuleSetDirectories>;c:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\\Rule Sets</CodeAnalysisRuleSetDirectories>
     100    <CodeAnalysisIgnoreBuiltInRuleSets>true</CodeAnalysisIgnoreBuiltInRuleSets>
     101    <CodeAnalysisRuleDirectories>;c:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\FxCop\\Rules</CodeAnalysisRuleDirectories>
     102    <CodeAnalysisIgnoreBuiltInRules>false</CodeAnalysisIgnoreBuiltInRules>
     103  </PropertyGroup>
    40104  <ItemGroup>
     105    <Reference Include="HeuristicLab.Analysis-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=x86" />
    41106    <Reference Include="HeuristicLab.Collections-3.3">
    42       <HintPath>..\..\..\..\..\..\Program Files\HeuristicLab 3.3\HeuristicLab.Collections-3.3.dll</HintPath>
     107      <HintPath>c:\Program Files\HeuristicLab 3.3\HeuristicLab.Collections-3.3.dll</HintPath>
    43108    </Reference>
    44109    <Reference Include="HeuristicLab.Common-3.3">
    45       <HintPath>..\..\..\..\..\..\Program Files\HeuristicLab 3.3\HeuristicLab.Common-3.3.dll</HintPath>
     110      <HintPath>c:\Program Files\HeuristicLab 3.3\HeuristicLab.Common-3.3.dll</HintPath>
    46111    </Reference>
    47     <Reference Include="HeuristicLab.Common.Resources-3.3, Version=3.2.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=AMD64" />
     112    <Reference Include="HeuristicLab.Common.Resources-3.3, Version=3.2.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=x86" />
    48113    <Reference Include="HeuristicLab.Core-3.3">
    49       <HintPath>..\..\..\..\..\..\Program Files\HeuristicLab 3.3\HeuristicLab.Core-3.3.dll</HintPath>
     114      <HintPath>c:\Program Files\HeuristicLab 3.3\HeuristicLab.Core-3.3.dll</HintPath>
    50115    </Reference>
    51116    <Reference Include="HeuristicLab.Data-3.3">
    52       <HintPath>..\..\..\..\..\..\Program Files\HeuristicLab 3.3\HeuristicLab.Data-3.3.dll</HintPath>
     117      <HintPath>c:\Program Files\HeuristicLab 3.3\HeuristicLab.Data-3.3.dll</HintPath>
    53118    </Reference>
    54     <Reference Include="HeuristicLab.Encodings.SymbolicExpressionTreeEncoding-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=AMD64" />
    55     <Reference Include="HeuristicLab.Operators-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=AMD64" />
     119    <Reference Include="HeuristicLab.Encodings.SymbolicExpressionTreeEncoding-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=x86" />
     120    <Reference Include="HeuristicLab.Operators-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=x86" />
    56121    <Reference Include="HeuristicLab.Optimization-3.3">
    57       <HintPath>..\..\..\..\..\..\Program Files\HeuristicLab 3.3\HeuristicLab.Optimization-3.3.dll</HintPath>
     122      <HintPath>c:\Program Files\HeuristicLab 3.3\HeuristicLab.Optimization-3.3.dll</HintPath>
    58123    </Reference>
    59124    <Reference Include="HeuristicLab.Parameters-3.3">
    60       <HintPath>..\..\..\..\..\..\Program Files\HeuristicLab 3.3\HeuristicLab.Parameters-3.3.dll</HintPath>
     125      <HintPath>c:\Program Files\HeuristicLab 3.3\HeuristicLab.Parameters-3.3.dll</HintPath>
    61126    </Reference>
    62127    <Reference Include="HeuristicLab.Persistence-3.3">
    63       <HintPath>..\..\..\..\..\..\Program Files\HeuristicLab 3.3\HeuristicLab.Persistence-3.3.dll</HintPath>
     128      <HintPath>c:\Program Files\HeuristicLab 3.3\HeuristicLab.Persistence-3.3.dll</HintPath>
    64129    </Reference>
    65130    <Reference Include="HeuristicLab.PluginInfrastructure-3.3">
    66       <HintPath>..\..\..\..\..\..\Program Files\HeuristicLab 3.3\HeuristicLab.PluginInfrastructure-3.3.dll</HintPath>
     131      <HintPath>c:\Program Files\HeuristicLab 3.3\HeuristicLab.PluginInfrastructure-3.3.dll</HintPath>
    67132    </Reference>
    68133    <Reference Include="HeuristicLab.Problems.DataAnalysis-3.3">
    69       <HintPath>..\..\..\..\..\..\Program Files\HeuristicLab 3.3\HeuristicLab.Problems.DataAnalysis-3.3.dll</HintPath>
     134      <HintPath>c:\Program Files\HeuristicLab 3.3\HeuristicLab.Problems.DataAnalysis-3.3.dll</HintPath>
     135    </Reference>
     136    <Reference Include="HeuristicLab.Problems.DataAnalysis.Regression-3.3">
     137      <HintPath>..\..\..\..\..\..\Program Files\HeuristicLab 3.3\HeuristicLab.Problems.DataAnalysis.Regression-3.3.dll</HintPath>
    70138    </Reference>
    71139    <Reference Include="System" />
     
    78146  </ItemGroup>
    79147  <ItemGroup>
     148    <Compile Include="ClassificationProblemData.cs" />
     149    <Compile Include="HeuristicLabProblemsDataAnalysisClassificationPlugin.cs" />
     150    <Compile Include="Interfaces\IClassificationSolution.cs" />
    80151    <Compile Include="SingleObjectiveClassificationProblem.cs" />
    81152    <Compile Include="ProblemBase\Problem.cs" />
    82153    <Compile Include="Interfaces\ISymbolicClassificationEvaluator.cs" />
    83     <Compile Include="HeuristicLabProblemsDataAnalysisClassifcationPlugin.cs" />
    84154    <Compile Include="Properties\AssemblyInfo.cs" />
    85155    <Compile Include="ProblemBase\SingleObjectiveProblem.cs" />
     156    <Compile Include="Interfaces\ISymbolicClassificationAnalyzer.cs" />
     157    <Compile Include="Symbolic\Analyzer\ValidationBestSymbolicClassificationSolutionAnalyzer.cs" />
     158    <Compile Include="Symbolic\SymbolicClassificationSolution.cs" />
    86159    <Compile Include="Symbolic\SingleObjectiveSymbolicClassificationEvaluator.cs" />
    87160    <Compile Include="Symbolic\SymbolicClassificationMeanSquaredErrorEvaluator.cs" />
     
    93166    <None Include="Properties\AssemblyInfo.frame" />
    94167  </ItemGroup>
     168  <ItemGroup />
    95169  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
    96170  <PropertyGroup>
     
    101175
    102176call PreBuildEvent.cmd
    103 SubWCRev "%25ProjectDir%25\" "%25ProjectDir%25HeuristicLabProblemsDataAnalysisClassificationPlugin.cs.frame" "%25ProjectDir%25\HeuristicLabProblemsDataAnalysisClassifcationPlugin.cs"</PreBuildEvent>
     177SubWCRev "%25ProjectDir%25\" "%25ProjectDir%25HeuristicLabProblemsDataAnalysisClassificationPlugin.cs.frame" "%25ProjectDir%25\HeuristicLabProblemsDataAnalysisClassificationPlugin.cs"</PreBuildEvent>
    104178  </PropertyGroup>
    105179  <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
  • branches/HeuristicLab.Classification/HeuristicLab.Problems.DataAnalysis.Classification/3.3/HeuristicLabProblemsDataAnalysisClassificationPlugin.cs.frame

    r4304 r4366  
    2323
    2424namespace HeuristicLab.Problems.DataAnalysis.Classification {
    25   /// <summary>
    26   /// Plugin class for HeuristicLab.Algorithms.LocalSearch plugin.
    27   /// </summary>
    2825  [Plugin("HeuristicLab.Problems.DataAnalysis.Classification", "3.3.0.$WCREV$")]
    2926  [PluginFile("HeuristicLab.Problems.DataAnalysis.Classification-3.3.dll", PluginFileType.Assembly)]
  • branches/HeuristicLab.Classification/HeuristicLab.Problems.DataAnalysis.Classification/3.3/Interfaces/ISymbolicClassificationEvaluator.cs

    r4323 r4366  
    3030    ILookupParameter<ISymbolicExpressionTreeInterpreter> SymbolicExpressionTreeInterpreterParameter { get; }
    3131    ILookupParameter<SymbolicExpressionTree> SymbolicExpressionTreeParameter { get; }
    32     ILookupParameter<DataAnalysisProblemData> RegressionProblemDataParameter { get; }
     32    ILookupParameter<ClassificationProblemData> RegressionProblemDataParameter { get; }
    3333    IValueLookupParameter<IntValue> SamplesStartParameter { get; }
    3434    IValueLookupParameter<IntValue> SamplesEndParameter { get; }
     
    3939    double Evaluate(ISymbolicExpressionTreeInterpreter interpreter, SymbolicExpressionTree tree,
    4040          double lowerEstimationLimit, double upperEstimationLimit,
    41           Dataset dataset, string targetVariable, IEnumerable<int> rows);
     41          Dataset dataset, string targetVariable, IEnumerable<double> sortedClassValues, IEnumerable<int> rows);
    4242  }
    4343}
  • branches/HeuristicLab.Classification/HeuristicLab.Problems.DataAnalysis.Classification/3.3/SingleObjectiveClassificationProblem.cs

    r4323 r4366  
    3535    private const string ClassificationProblemDataParameterName = "ClassificationProblemData";
    3636
    37     public ValueParameter<DataAnalysisProblemData> ClassificationProblemDataParameter {
    38       get { return (ValueParameter<DataAnalysisProblemData>)Parameters[ClassificationProblemDataParameterName]; }
     37    public IValueParameter<ClassificationProblemData> ClassificationProblemDataParameter {
     38      get { return (IValueParameter<ClassificationProblemData>)Parameters[ClassificationProblemDataParameterName]; }
    3939    }
    40     public DataAnalysisProblemData ClassificationProblemData {
     40    public ClassificationProblemData ClassificationProblemData {
    4141      get { return ClassificationProblemDataParameter.Value; }
    4242      set { ClassificationProblemDataParameter.Value = value; }
     
    4747    public SingleObjectiveClassificationProblem()
    4848      : base() {
    49       Parameters.Add(new ValueParameter<DataAnalysisProblemData>(ClassificationProblemDataParameterName, "The data set, target variable and input variables of the data analysis problem."));
    50       ClassificationProblemData = new DataAnalysisProblemData();
     49      Parameters.Add(new ValueParameter<ClassificationProblemData>(ClassificationProblemDataParameterName, "The data set, target variable and input variables of the data analysis problem."));
     50      ClassificationProblemData = new ClassificationProblemData();
    5151      RegisterParameterEvents();
    5252      RegisterParameterValueEvents();
  • branches/HeuristicLab.Classification/HeuristicLab.Problems.DataAnalysis.Classification/3.3/Symbolic/SingleObjectiveSymbolicClassificationEvaluator.cs

    r4323 r4366  
    6161    }
    6262
    63     public ILookupParameter<DataAnalysisProblemData> RegressionProblemDataParameter {
    64       get { return (ILookupParameter<DataAnalysisProblemData>)Parameters[RegressionProblemDataParameterName]; }
     63    public ILookupParameter<ClassificationProblemData> RegressionProblemDataParameter {
     64      get { return (ILookupParameter<ClassificationProblemData>)Parameters[RegressionProblemDataParameterName]; }
    6565    }
    6666
     
    9292      get { return SymbolicExpressionTreeParameter.ActualValue; }
    9393    }
    94     public DataAnalysisProblemData RegressionProblemData {
     94    public ClassificationProblemData RegressionProblemData {
    9595      get { return RegressionProblemDataParameter.ActualValue; }
    9696    }
     
    118118      Parameters.Add(new LookupParameter<ISymbolicExpressionTreeInterpreter>(SymbolicExpressionTreeInterpreterParameterName, "The interpreter that should be used to calculate the output values of the symbolic expression tree."));
    119119      Parameters.Add(new LookupParameter<SymbolicExpressionTree>(FunctionTreeParameterName, "The symbolic regression solution encoded as a symbolic expression tree."));
    120       Parameters.Add(new LookupParameter<DataAnalysisProblemData>(RegressionProblemDataParameterName, "The problem data on which the symbolic regression solution should be evaluated."));
     120      Parameters.Add(new LookupParameter<ClassificationProblemData>(RegressionProblemDataParameterName, "The problem data on which the symbolic regression solution should be evaluated."));
    121121      Parameters.Add(new ValueLookupParameter<IntValue>(SamplesStartParameterName, "The start index of the dataset partition on which the symbolic regression solution should be evaluated."));
    122122      Parameters.Add(new ValueLookupParameter<IntValue>(SamplesEndParameterName, "The end index of the dataset partition on which the symbolic regression solution should be evaluated."));
     
    139139      int seed = Random.Next();
    140140      IEnumerable<int> rows = GenerateRowsToEvaluate(seed, RelativeNumberOfEvaluatedSamples.Value, SamplesStart.Value, SamplesEnd.Value);
     141
    141142      double quality = Evaluate(SymbolicExpressionTreeInterpreter, SymbolicExpressionTree, LowerEstimationLimit.Value, UpperEstimationLimit.Value,
    142         RegressionProblemData.Dataset,
    143         RegressionProblemData.TargetVariable.Value, rows);
     143        RegressionProblemData.Dataset, RegressionProblemData.TargetVariable.Value, RegressionProblemData.SortedClassValues, rows);
    144144      QualityParameter.ActualValue = new DoubleValue(quality);
    145145      return base.Apply();
     
    157157      Dataset dataset,
    158158      string targetVariable,
     159      IEnumerable<double> sortedClassValues,
    159160      IEnumerable<int> rows);
    160161  }
  • branches/HeuristicLab.Classification/HeuristicLab.Problems.DataAnalysis.Classification/3.3/Symbolic/SymbolicClassificationMeanSquaredErrorEvaluator.cs

    r4323 r4366  
    2222using System;
    2323using System.Collections.Generic;
     24using System.Linq;
     25using HeuristicLab.Common;
    2426using HeuristicLab.Core;
    2527using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
     
    3739    }
    3840
    39     public override double Evaluate(ISymbolicExpressionTreeInterpreter interpreter, SymbolicExpressionTree solution, double lowerEstimationLimit, double upperEstimationLimit, Dataset dataset, string targetVariable, IEnumerable<int> rows) {
    40       double mse = Calculate(interpreter, solution, lowerEstimationLimit, upperEstimationLimit, dataset, targetVariable, rows);
     41    public override double Evaluate(ISymbolicExpressionTreeInterpreter interpreter, SymbolicExpressionTree solution, double lowerEstimationLimit, double upperEstimationLimit, Dataset dataset, string targetVariable, IEnumerable<double> sortedClassValues, IEnumerable<int> rows) {
     42      double mse = Calculate(interpreter, solution, lowerEstimationLimit, upperEstimationLimit, dataset, targetVariable, sortedClassValues, rows);
    4143      return mse;
    4244    }
    4345
    44     public static double Calculate(ISymbolicExpressionTreeInterpreter interpreter, SymbolicExpressionTree solution, double lowerEstimationLimit, double upperEstimationLimit, Dataset dataset, string targetVariable, IEnumerable<int> rows) {
     46    public static double Calculate(ISymbolicExpressionTreeInterpreter interpreter, SymbolicExpressionTree solution, double lowerEstimationLimit, double upperEstimationLimit, Dataset dataset, string targetVariable, IEnumerable<double> sortedClassValues, IEnumerable<int> rows) {
    4547      IEnumerable<double> estimatedValues = interpreter.GetSymbolicExpressionTreeValues(solution, dataset, rows);
    4648      IEnumerable<double> originalValues = dataset.GetEnumeratedVariableValues(targetVariable, rows);
     
    4951      OnlineMeanSquaredErrorEvaluator mseEvaluator = new OnlineMeanSquaredErrorEvaluator();
    5052
     53
     54      double firstClassValue = sortedClassValues.First();
     55      double lastClassValue = sortedClassValues.Last();
    5156      while (originalEnumerator.MoveNext() && estimatedEnumerator.MoveNext()) {
    5257        double estimated = estimatedEnumerator.Current;
     
    5459        if (double.IsNaN(estimated))
    5560          estimated = upperEstimationLimit;
     61        else if (estimated < original && original.IsAlmost(firstClassValue))
     62          estimated = original;
     63        else if (estimated > original && original.IsAlmost(lastClassValue))
     64          estimated = original;
    5665        else
    5766          estimated = Math.Min(upperEstimationLimit, Math.Max(lowerEstimationLimit, estimated));
  • branches/HeuristicLab.Classification/HeuristicLab.Problems.DataAnalysis.Classification/3.3/Symbolic/SymbolicClassificationProblem.cs

    r4323 r4366  
    2121
    2222using System;
     23using System.Collections.Generic;
    2324using System.Linq;
    2425using HeuristicLab.Core;
     
    2829using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Creators;
    2930using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Interfaces;
     31using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Symbols;
    3032using HeuristicLab.Parameters;
    3133using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    3234using HeuristicLab.PluginInfrastructure;
    3335using HeuristicLab.Problems.DataAnalysis.Symbolic;
     36using HeuristicLab.Problems.DataAnalysis.Symbolic.Symbols;
    3437
    3538namespace HeuristicLab.Problems.DataAnalysis.Classification {
     
    5255      protected set { SymbolicExpressionTreeInterpreterParameter.Value = value; }
    5356    }
    54     public ValueParameter<ISymbolicExpressionTreeInterpreter> SymbolicExpressionTreeInterpreterParameter {
    55       get { return (ValueParameter<ISymbolicExpressionTreeInterpreter>)Parameters[SymbolicExpressionTreeInterpreterParameterName]; }
     57    public IValueParameter<ISymbolicExpressionTreeInterpreter> SymbolicExpressionTreeInterpreterParameter {
     58      get { return (IValueParameter<ISymbolicExpressionTreeInterpreter>)Parameters[SymbolicExpressionTreeInterpreterParameterName]; }
    5659    }
    5760
     
    6063      protected set { FunctionTreeGrammarParameter.Value = value; }
    6164    }
    62     public ValueParameter<ISymbolicExpressionGrammar> FunctionTreeGrammarParameter {
    63       get { return (ValueParameter<ISymbolicExpressionGrammar>)Parameters[FunctionTreeGrammarParameterName]; }
     65    public IValueParameter<ISymbolicExpressionGrammar> FunctionTreeGrammarParameter {
     66      get { return (IValueParameter<ISymbolicExpressionGrammar>)Parameters[FunctionTreeGrammarParameterName]; }
    6467    }
    6568
     
    6871      protected set { MaxExpressionLengthParameter.Value = value; }
    6972    }
    70     public ValueParameter<IntValue> MaxExpressionLengthParameter {
    71       get { return (ValueParameter<IntValue>)Parameters[MaxExpressionLengthParameterName]; }
     73    public IValueParameter<IntValue> MaxExpressionLengthParameter {
     74      get { return (IValueParameter<IntValue>)Parameters[MaxExpressionLengthParameterName]; }
    7275    }
    7376
     
    8487      protected set { UpperEstimationLimitParameter.Value = value; }
    8588    }
    86     public ValueParameter<DoubleValue> UpperEstimationLimitParameter {
    87       get { return (ValueParameter<DoubleValue>)Parameters[UpperEstimationLimitParameterName]; }
     89    public IValueParameter<DoubleValue> UpperEstimationLimitParameter {
     90      get { return (IValueParameter<DoubleValue>)Parameters[UpperEstimationLimitParameterName]; }
    8891    }
    8992
     
    9295      protected set { LowerEstimationLimitParameter.Value = value; }
    9396    }
    94     public ValueParameter<DoubleValue> LowerEstimationLimitParameter {
    95       get { return (ValueParameter<DoubleValue>)Parameters[LowerEstimationLimitParameterName]; }
     97    public IValueParameter<DoubleValue> LowerEstimationLimitParameter {
     98      get { return (IValueParameter<DoubleValue>)Parameters[LowerEstimationLimitParameterName]; }
    9699    }
    97100
     
    100103      protected set { MaxFunctionDefiningBranchesParameter.Value = value; }
    101104    }
    102     public ValueParameter<IntValue> MaxFunctionDefiningBranchesParameter {
    103       get { return (ValueParameter<IntValue>)Parameters[MaxFunctionDefiningBranchensParameterName]; }
     105    public IValueParameter<IntValue> MaxFunctionDefiningBranchesParameter {
     106      get { return (IValueParameter<IntValue>)Parameters[MaxFunctionDefiningBranchensParameterName]; }
    104107    }
    105108
     
    108111      protected set { MaxFunctionArgumentsParameter.Value = value; }
    109112    }
    110     public ValueParameter<IntValue> MaxFunctionArgumentsParameter {
    111       get { return (ValueParameter<IntValue>)Parameters[MaxFunctionArgumentsParameterName]; }
     113    public IValueParameter<IntValue> MaxFunctionArgumentsParameter {
     114      get { return (IValueParameter<IntValue>)Parameters[MaxFunctionArgumentsParameterName]; }
    112115    }
    113116
     
    225228      Operators.AddRange(ApplicationManager.Manager.GetInstances<ISymbolicExpressionTreeOperator>().OfType<IOperator>());
    226229      Operators.Add(new MinAverageMaxSymbolicExpressionTreeSizeAnalyzer());
     230      Operators.Add(new ValidationBestSymbolicClassificationSolutionAnalyzer());
    227231    }
    228232
     
    249253
    250254    private void ParameterizeGrammar() {
     255      List<LaggedVariable> laggedSymbols = FunctionTreeGrammar.Symbols.OfType<LaggedVariable>().ToList();
     256      foreach (Symbol symbol in laggedSymbols)
     257        FunctionTreeGrammar.RemoveSymbol(symbol);
    251258      foreach (var varSymbol in FunctionTreeGrammar.Symbols.OfType<HeuristicLab.Problems.DataAnalysis.Symbolic.Symbols.Variable>()) {
    252259        varSymbol.VariableNames = ClassificationProblemData.InputVariables.CheckedItems.Select(x => x.Value.Value);
     
    287294
    288295    private void ParameterizeAnalyzers() {
    289 
     296      foreach (ISymbolicExpressionTreeAnalyzer analyzer in Operators.OfType<ISymbolicExpressionTreeAnalyzer>()) {
     297        analyzer.SymbolicExpressionTreeParameter.ActualName = SolutionCreator.SymbolicExpressionTreeParameter.ActualName;
     298        var bestValidationSolutionAnalyzer = analyzer as ValidationBestSymbolicClassificationSolutionAnalyzer;
     299        if (bestValidationSolutionAnalyzer != null) {
     300          bestValidationSolutionAnalyzer.ClassificationProblemDataParameter.ActualName = ClassificationProblemDataParameter.Name;
     301          bestValidationSolutionAnalyzer.UpperEstimationLimitParameter.ActualName = UpperEstimationLimitParameter.Name;
     302          bestValidationSolutionAnalyzer.LowerEstimationLimitParameter.ActualName = LowerEstimationLimitParameter.Name;
     303          bestValidationSolutionAnalyzer.SymbolicExpressionTreeInterpreterParameter.ActualName = SymbolicExpressionTreeInterpreterParameter.Name;
     304          bestValidationSolutionAnalyzer.SymbolicExpressionTreeParameter.ActualName = SolutionCreator.SymbolicExpressionTreeParameter.ActualName;
     305          bestValidationSolutionAnalyzer.ValidationSamplesStartParameter.Value = ValidationSamplesStart;
     306          bestValidationSolutionAnalyzer.ValidationSamplesEndParameter.Value = ValidationSamplesEnd;
     307        }
     308      }
    290309    }
    291310    #endregion
Note: See TracChangeset for help on using the changeset viewer.