Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
04/23/12 16:50:08 (13 years ago)
Author:
sforsten
Message:

#1784:

  • merged Problems.DataAnalysis r7273:7748 from trunk
  • prepared SymbolicClassificationSingleObjectiveProblem and SymbolicRegressionSingleObjectiveProblem to load and export problem instances
Location:
branches/ProblemInstancesRegressionAndClassification/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/ProblemInstancesRegressionAndClassification/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression-3.4.csproj

    r7734 r7750  
    5050    <DebugType>pdbonly</DebugType>
    5151    <Optimize>true</Optimize>
    52     <OutputPath>$(SolutionDir)\bin\</OutputPath>
     52    <OutputPath>..\..\..\..\trunk\sources\bin\</OutputPath>
    5353    <DefineConstants>TRACE</DefineConstants>
    5454    <ErrorReport>prompt</ErrorReport>
     
    9393  </PropertyGroup>
    9494  <ItemGroup>
    95     <Reference Include="ALGLIB-3.5.0, Version=3.5.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
    96       <HintPath>..\..\bin\ALGLIB-3.5.0.dll</HintPath>
    97       <Private>False</Private>
     95    <Reference Include="ALGLIB-3.5.0">
     96      <HintPath>..\..\..\..\trunk\sources\bin\ALGLIB-3.5.0.dll</HintPath>
     97    </Reference>
     98    <Reference Include="HeuristicLab.Analysis-3.3">
     99      <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Analysis-3.3.dll</HintPath>
     100    </Reference>
     101    <Reference Include="HeuristicLab.Collections-3.3">
     102      <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Collections-3.3.dll</HintPath>
     103    </Reference>
     104    <Reference Include="HeuristicLab.Common-3.3">
     105      <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Common-3.3.dll</HintPath>
     106    </Reference>
     107    <Reference Include="HeuristicLab.Core-3.3">
     108      <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Core-3.3.dll</HintPath>
     109    </Reference>
     110    <Reference Include="HeuristicLab.Data-3.3">
     111      <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Data-3.3.dll</HintPath>
     112    </Reference>
     113    <Reference Include="HeuristicLab.Encodings.SymbolicExpressionTreeEncoding-3.4">
     114      <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Encodings.SymbolicExpressionTreeEncoding-3.4.dll</HintPath>
     115    </Reference>
     116    <Reference Include="HeuristicLab.Operators-3.3">
     117      <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Operators-3.3.dll</HintPath>
     118    </Reference>
     119    <Reference Include="HeuristicLab.Optimization-3.3">
     120      <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Optimization-3.3.dll</HintPath>
     121    </Reference>
     122    <Reference Include="HeuristicLab.Parameters-3.3">
     123      <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Parameters-3.3.dll</HintPath>
     124    </Reference>
     125    <Reference Include="HeuristicLab.Persistence-3.3">
     126      <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Persistence-3.3.dll</HintPath>
     127    </Reference>
     128    <Reference Include="HeuristicLab.PluginInfrastructure-3.3">
     129      <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.PluginInfrastructure-3.3.dll</HintPath>
     130    </Reference>
     131    <Reference Include="HeuristicLab.Problems.DataAnalysis.Symbolic-3.4">
     132      <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Problems.DataAnalysis.Symbolic-3.4.dll</HintPath>
    98133    </Reference>
    99134    <Reference Include="System" />
     
    144179  </ItemGroup>
    145180  <ItemGroup>
    146     <ProjectReference Include="..\..\HeuristicLab.Analysis\3.3\HeuristicLab.Analysis-3.3.csproj">
    147       <Project>{887425B4-4348-49ED-A457-B7D2C26DDBF9}</Project>
    148       <Name>HeuristicLab.Analysis-3.3</Name>
    149       <Private>False</Private>
    150     </ProjectReference>
    151     <ProjectReference Include="..\..\HeuristicLab.Collections\3.3\HeuristicLab.Collections-3.3.csproj">
    152       <Project>{958B43BC-CC5C-4FA2-8628-2B3B01D890B6}</Project>
    153       <Name>HeuristicLab.Collections-3.3</Name>
    154       <Private>False</Private>
    155     </ProjectReference>
    156     <ProjectReference Include="..\..\HeuristicLab.Common\3.3\HeuristicLab.Common-3.3.csproj">
    157       <Project>{A9AD58B9-3EF9-4CC1-97E5-8D909039FF5C}</Project>
    158       <Name>HeuristicLab.Common-3.3</Name>
    159       <Private>False</Private>
    160     </ProjectReference>
    161     <ProjectReference Include="..\..\HeuristicLab.Core\3.3\HeuristicLab.Core-3.3.csproj">
    162       <Project>{C36BD924-A541-4A00-AFA8-41701378DDC5}</Project>
    163       <Name>HeuristicLab.Core-3.3</Name>
    164       <Private>False</Private>
    165     </ProjectReference>
    166     <ProjectReference Include="..\..\HeuristicLab.Data\3.3\HeuristicLab.Data-3.3.csproj">
    167       <Project>{BBAB9DF5-5EF3-4BA8-ADE9-B36E82114937}</Project>
    168       <Name>HeuristicLab.Data-3.3</Name>
    169       <Private>False</Private>
    170     </ProjectReference>
    171     <ProjectReference Include="..\..\HeuristicLab.Encodings.SymbolicExpressionTreeEncoding\3.4\HeuristicLab.Encodings.SymbolicExpressionTreeEncoding-3.4.csproj">
    172       <Project>{06D4A186-9319-48A0-BADE-A2058D462EEA}</Project>
    173       <Name>HeuristicLab.Encodings.SymbolicExpressionTreeEncoding-3.4</Name>
    174       <Private>False</Private>
    175     </ProjectReference>
    176     <ProjectReference Include="..\..\HeuristicLab.Operators\3.3\HeuristicLab.Operators-3.3.csproj">
    177       <Project>{23DA7FF4-D5B8-41B6-AA96-F0561D24F3EE}</Project>
    178       <Name>HeuristicLab.Operators-3.3</Name>
    179       <Private>False</Private>
    180     </ProjectReference>
    181     <ProjectReference Include="..\..\HeuristicLab.Optimization\3.3\HeuristicLab.Optimization-3.3.csproj">
    182       <Project>{14AB8D24-25BC-400C-A846-4627AA945192}</Project>
    183       <Name>HeuristicLab.Optimization-3.3</Name>
    184       <Private>False</Private>
    185     </ProjectReference>
    186     <ProjectReference Include="..\..\HeuristicLab.Parameters\3.3\HeuristicLab.Parameters-3.3.csproj">
    187       <Project>{56F9106A-079F-4C61-92F6-86A84C2D84B7}</Project>
    188       <Name>HeuristicLab.Parameters-3.3</Name>
    189       <Private>False</Private>
    190     </ProjectReference>
    191     <ProjectReference Include="..\..\HeuristicLab.Persistence\3.3\HeuristicLab.Persistence-3.3.csproj">
    192       <Project>{102BC7D3-0EF9-439C-8F6D-96FF0FDB8E1B}</Project>
    193       <Name>HeuristicLab.Persistence-3.3</Name>
    194       <Private>False</Private>
    195     </ProjectReference>
    196     <ProjectReference Include="..\..\HeuristicLab.PluginInfrastructure\3.3\HeuristicLab.PluginInfrastructure-3.3.csproj">
    197       <Project>{94186A6A-5176-4402-AE83-886557B53CCA}</Project>
    198       <Name>HeuristicLab.PluginInfrastructure-3.3</Name>
    199       <Private>False</Private>
    200     </ProjectReference>
    201     <ProjectReference Include="..\..\HeuristicLab.Problems.DataAnalysis.Symbolic\3.4\HeuristicLab.Problems.DataAnalysis.Symbolic-3.4.csproj">
    202       <Project>{3D28463F-EC96-4D82-AFEE-38BE91A0CA00}</Project>
    203       <Name>HeuristicLab.Problems.DataAnalysis.Symbolic-3.4</Name>
    204       <Private>False</Private>
    205     </ProjectReference>
    206181    <ProjectReference Include="..\..\HeuristicLab.Problems.DataAnalysis\3.4\HeuristicLab.Problems.DataAnalysis-3.4.csproj">
    207182      <Project>{DF87C13E-A889-46FF-8153-66DCAA8C5674}</Project>
    208183      <Name>HeuristicLab.Problems.DataAnalysis-3.4</Name>
    209184      <Private>False</Private>
     185    </ProjectReference>
     186    <ProjectReference Include="..\..\HeuristicLab.Problems.Instances\3.3\HeuristicLab.Problems.Instances-3.3.csproj">
     187      <Project>{3540E29E-4793-49E7-8EE2-FEA7F61C3994}</Project>
     188      <Name>HeuristicLab.Problems.Instances-3.3</Name>
    210189    </ProjectReference>
    211190  </ItemGroup>
  • branches/ProblemInstancesRegressionAndClassification/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression/3.4/SingleObjective/SymbolicRegressionSingleObjectiveProblem.cs

    r7734 r7750  
    2020#endregion
    2121
     22using System;
     23using System.Collections.Generic;
    2224using System.Linq;
    2325using HeuristicLab.Common;
     
    2527using HeuristicLab.Parameters;
    2628using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
     29using HeuristicLab.Problems.Instances;
    2730
    2831namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Regression {
     
    3033  [StorableClass]
    3134  [Creatable("Problems")]
    32   public class SymbolicRegressionSingleObjectiveProblem : SymbolicDataAnalysisSingleObjectiveProblem<IRegressionProblemData, ISymbolicRegressionSingleObjectiveEvaluator, ISymbolicDataAnalysisSolutionCreator>, IRegressionProblem {
     35  public class SymbolicRegressionSingleObjectiveProblem : SymbolicDataAnalysisSingleObjectiveProblem<IRegressionProblemData, ISymbolicRegressionSingleObjectiveEvaluator, ISymbolicDataAnalysisSolutionCreator>, IRegressionProblem,
     36    IProblemInstanceConsumer<RegressionData>, IProblemInstanceExporter<RegressionData> {
    3337    private const double PunishmentFactor = 10;
    3438    private const int InitialMaximumTreeDepth = 8;
     
    116120      ProblemData = problemData;
    117121    }
     122
     123    public void Load(RegressionData data) {
     124      Name = data.Name;
     125      Description = data.Description;
     126      Dataset dataset = new Dataset(data.InputVariables, data.Values);
     127      ProblemData = new RegressionProblemData(dataset, data.AllowedInputVariables, data.TargetVariable);
     128      ProblemData.TrainingPartition.Start = data.TrainingPartitionStart;
     129      ProblemData.TrainingPartition.End = data.TrainingPartitionEnd;
     130      ProblemData.TestPartition.Start = data.TestPartitionStart;
     131      ProblemData.TestPartition.End = data.TestPartitionEnd;
     132      OnReset();
     133    }
     134
     135    public RegressionData Export() {
     136      if (!ProblemData.InputVariables.Count.Equals(ProblemData.Dataset.DoubleVariables.Count()))
     137        throw new ArgumentException("Not all input variables are double variables! (Export only works with double variables)");
     138
     139      RegressionData regData = new RegressionData();
     140      regData.Name = Name;
     141      regData.Description = Description;
     142      regData.TargetVariable = ProblemData.TargetVariable;
     143      regData.InputVariables = ProblemData.InputVariables.Select(x => x.Value).ToArray();
     144      regData.AllowedInputVariables = ProblemData.AllowedInputVariables.ToArray();
     145      regData.TrainingPartitionStart = ProblemData.TrainingPartition.Start;
     146      regData.TrainingPartitionEnd = ProblemData.TrainingPartition.End;
     147      regData.TestPartitionStart = ProblemData.TestPartition.Start;
     148      regData.TestPartitionEnd = ProblemData.TestPartition.End;
     149
     150      List<List<double>> data = new List<List<double>>();
     151      foreach (var variable in ProblemData.Dataset.DoubleVariables) {
     152        data.Add(ProblemData.Dataset.GetDoubleValues(variable).ToList());
     153      }
     154      regData.Values = Transformer.Transformation(data);
     155
     156      return regData;
     157    }
    118158  }
    119159}
Note: See TracChangeset for help on using the changeset viewer.