Free cookie consent management tool by TermsFeed Policy Generator

Changeset 1869 for trunk


Ignore:
Timestamp:
05/20/09 12:52:52 (15 years ago)
Author:
gkronber
Message:

Moved simple evaluators from plugin SVM to plugin Modeling. #635

Location:
trunk/sources
Files:
4 edited
2 moved

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.CEDMA.Server/3.3/DispatcherBase.cs

    r1857 r1869  
    4040  public abstract class DispatcherBase : IDispatcher {
    4141    private IStore store;
    42 
    43     private static int MaxGenerations {
    44       get { return 3; }
    45     }
    46 
    47     private static int MaxEvaluatedSolutions {
    48       get { return 3000; }
    49     }
    50 
    5142    public DispatcherBase(IStore store) {
    5243      this.store = store;
     
    8879
    8980    private Execution CreateExecution(Problem problem, int targetVariable, IAlgorithm algorithm) {
    90       //switch (algorithm) {
    91       //  case Algorithm.StandardGpRegression: {
    92       //      var algo = new HeuristicLab.GP.StructureIdentification.StandardGP();
    93       //      SetComplexityParameters(algo, complexity);
    94       //      SetProblemParameters(algo, problem, targetVariable);
    95       //      algo.PopulationSize = 10000;
    96       //      algo.MaxGenerations = MaxGenerations;
    97       //      Execution exec = new Execution(algo.Engine);
    98       //      exec.Description = "StandardGP - Complexity: " + complexity;
    99       //      return exec;
    100       //    }
    10181      SetProblemParameters(algorithm, problem, targetVariable);
    10282      Execution exec = new Execution(algorithm.Engine);
  • trunk/sources/HeuristicLab.Modeling/3.2/HeuristicLab.Modeling-3.2.csproj

    r1857 r1869  
    9696    </Compile>
    9797    <Compile Include="Properties\AssemblyInfo.cs" />
     98    <Compile Include="SimpleMSEEvaluator.cs" />
     99    <Compile Include="SimpleR2Evaluator.cs" />
    98100    <Compile Include="TimeSeriesProblemInjector.cs" />
    99101  </ItemGroup>
  • trunk/sources/HeuristicLab.Modeling/3.2/SimpleMSEEvaluator.cs

    r1854 r1869  
    77using HeuristicLab.DataAnalysis;
    88
    9 namespace HeuristicLab.SupportVectorMachines {
    10   public class SimpleMSEEvaluator : OperatorBase{
     9namespace HeuristicLab.Modeling {
     10  public class SimpleMSEEvaluator : OperatorBase {
    1111
    1212    public SimpleMSEEvaluator()
    1313      : base() {
    14       AddVariableInfo(new VariableInfo("Values", "Target vs predicted values", typeof(ItemList), VariableKind.In));
     14      AddVariableInfo(new VariableInfo("Values", "Target vs predicted values", typeof(DoubleMatrixData), VariableKind.In));
    1515      AddVariableInfo(new VariableInfo("MSE", "Mean squarred error", typeof(DoubleData), VariableKind.New | VariableKind.Out));
    1616    }
    1717
    1818    public override IOperation Apply(IScope scope) {
    19       ItemList values = GetVariableValue<ItemList>("Values", scope, true);
     19      DoubleMatrixData values = GetVariableValue<DoubleMatrixData>("Values", scope, true);
    2020      double sse = 0;
    21       double cnt = 0;     
    22       foreach (ItemList row in values) {
    23         double estimated = ((DoubleData)row[0]).Data;
    24         double target = ((DoubleData)row[1]).Data;
     21      double cnt = 0;
     22      for (int i = 0; i < values.Data.GetLength(0); i++) {
     23        double estimated = values.Data[i, 0];
     24        double target = values.Data[i, 1];
    2525        if (!double.IsNaN(estimated) && !double.IsInfinity(estimated) &&
    2626            !double.IsNaN(target) && !double.IsInfinity(target)) {
     
    3232
    3333      double mse = sse / cnt;
    34       scope.AddVariable(new Variable(scope.TranslateName("MSE"),new DoubleData(mse)));
     34      scope.AddVariable(new Variable(scope.TranslateName("MSE"), new DoubleData(mse)));
    3535      return null;
    3636    }
  • trunk/sources/HeuristicLab.Modeling/3.2/SimpleR2Evaluator.cs

    r1854 r1869  
    77using HeuristicLab.DataAnalysis;
    88
    9 namespace HeuristicLab.SupportVectorMachines {
    10   public class SimpleR2Evaluator : OperatorBase{
     9namespace HeuristicLab.Modeling {
     10  public class SimpleR2Evaluator : OperatorBase {
    1111
    1212    public SimpleR2Evaluator()
    1313      : base() {
    14       AddVariableInfo(new VariableInfo("Values", "Target vs predicted values", typeof(ItemList), VariableKind.In));
     14      AddVariableInfo(new VariableInfo("Values", "Target vs predicted values", typeof(DoubleMatrixData), VariableKind.In));
    1515      AddVariableInfo(new VariableInfo("R2", "Coefficient of determination", typeof(DoubleData), VariableKind.New | VariableKind.Out));
    1616    }
    1717
    1818    public override IOperation Apply(IScope scope) {
    19       ItemList values = GetVariableValue<ItemList>("Values", scope, true);
     19      DoubleMatrixData values = GetVariableValue<DoubleMatrixData>("Values", scope, true);
    2020
    2121      double targetMean = 0;
    2222      double sse = 0;
    2323      double cnt = 0;
    24       foreach (ItemList row in values) {                               
    25         double estimated = ((DoubleData)row[0]).Data;
    26         double target = ((DoubleData)row[1]).Data;
     24      for (int i = 0; i < values.Data.GetLength(0); i++) {
     25        double estimated = values.Data[i, 0];
     26        double target = values.Data[i, 1];
    2727        if (!double.IsNaN(estimated) && !double.IsInfinity(estimated) &&
    2828            !double.IsNaN(target) && !double.IsInfinity(target)) {
     
    3636
    3737      double targetDeviationTotalSumOfSquares = 0;
    38       foreach (ItemList row in values) {
    39         double target = ((DoubleData)row[1]).Data;
     38      for (int i = 0; i < values.Data.GetLength(0); i++) {
     39        double target = values.Data[i, 1];
    4040        if (!double.IsNaN(target) && !double.IsInfinity(target)) {
    4141          target = target - targetMean;
  • trunk/sources/HeuristicLab.SupportVectorMachines/3.2/HeuristicLab.SupportVectorMachines-3.2.csproj

    r1857 r1869  
    8686    <Compile Include="HeuristicLabSupportVectorMachinesPlugin.cs" />
    8787    <Compile Include="Properties\AssemblyInfo.cs" />
    88     <Compile Include="SimpleMSEEvaluator.cs" />
    89     <Compile Include="SimpleR2Evaluator.cs" />
    9088    <Compile Include="SupportVectorCreator.cs" />
    9189    <Compile Include="SupportVectorEvaluator.cs" />
  • trunk/sources/HeuristicLab.SupportVectorMachines/3.2/SupportVectorRegression.cs

    r1858 r1869  
    146146      solStorer.GetVariableInfo("Quality").ActualName = "ValidationMSE";
    147147      solStorer.GetVariableInfo("Maximization").Local = true;
     148      solStorer.GetVariableInfo("BestSolution").ActualName = "BestValidationSolution";
    148149      solStorer.AddVariable(new HeuristicLab.Core.Variable("Maximization", new BoolData(false)));
    149150
Note: See TracChangeset for help on using the changeset viewer.