Free cookie consent management tool by TermsFeed Policy Generator

Changeset 2363 for trunk


Ignore:
Timestamp:
09/16/09 13:13:52 (15 years ago)
Author:
gkronber
Message:

Fixed problems with classification algorithms. #746 (CEDMA server is not compatible with new data-modeling algorithms)

Location:
trunk/sources
Files:
10 edited

Legend:

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

    r2290 r2363  
    193193          allowedFeatures.Add(new IntData(targetVariable));
    194194        }
    195       } else if (problem.LearningTask == LearningTask.Classification) {
    196         ItemList<DoubleData> classValues = algo.ProblemInjector.GetVariable("TargetClassValues").GetValue<ItemList<DoubleData>>();
    197         foreach (double classValue in GetDifferentClassValues(problem.Dataset, targetVariable)) classValues.Add(new DoubleData(classValue));
    198       }
    199     }
    200 
    201     private IEnumerable<double> GetDifferentClassValues(HeuristicLab.DataAnalysis.Dataset dataset, int targetVariable) {
    202       return Enumerable.Range(0, dataset.Rows).Select(x => dataset.GetValue(x, targetVariable)).Distinct();
    203     }
     195      }
     196    }
     197
    204198
    205199    private void AddDispatchedRun(string targetVariable, IEnumerable<string> inputVariables, string algorithm) {
  • trunk/sources/HeuristicLab.GP.StructureIdentification.Classification/3.3/OffspringSelectionGPClassification.cs

    r2361 r2363  
    4242    }
    4343
    44     protected virtual IAnalyzerModel CreateGPModel() {
     44    protected override IAnalyzerModel CreateGPModel() {
    4545      IScope bestModelScope = Engine.GlobalScope.SubScopes[0];
    4646      var model = new AnalyzerModel();
  • trunk/sources/HeuristicLab.GP.StructureIdentification/3.3/DefaultStructureIdentificationOperators.cs

    r2362 r2363  
    156156
    157157    public static void PopulateAnalyzerModel(IScope bestModelScope, IAnalyzerModel model) {
    158       model.SetMetaData("EvaluatedSolutions", bestModelScope.GetVariableValue<DoubleData>("EvaluatedSolutions", false).Data);
     158      model.SetMetaData("EvaluatedSolutions", bestModelScope.GetVariableValue<IntData>("EvaluatedSolutions", false).Data);
    159159      IGeneticProgrammingModel gpModel = bestModelScope.GetVariableValue<IGeneticProgrammingModel>("FunctionTree", false);
    160160      model.SetMetaData("TreeSize", gpModel.Size);
  • trunk/sources/HeuristicLab.GP.StructureIdentification/3.3/OffspringSelectionGPRegression.cs

    r2362 r2363  
    3434
    3535namespace HeuristicLab.GP.StructureIdentification {
    36   public class OffspringSelectionGPRegression : HeuristicLab.GP.Algorithms.OffspringSelectionGP, IAlgorithm {
     36  public class OffspringSelectionGPRegression : HeuristicLab.GP.Algorithms.OffspringSelectionGP, IStochasticAlgorithm {
    3737    public override string Name { get { return "OffspringSelectionGP - StructureIdentification"; } }
    3838
  • trunk/sources/HeuristicLab.GP.StructureIdentification/3.3/StandardGPRegression.cs

    r2362 r2363  
    3333
    3434namespace HeuristicLab.GP.StructureIdentification {
    35   public class StandardGPRegression : HeuristicLab.GP.Algorithms.StandardGP, IAlgorithm {
     35  public class StandardGPRegression : HeuristicLab.GP.Algorithms.StandardGP, IStochasticAlgorithm {
    3636
    3737    public override string Name { get { return "StandardGP - StructureIdentification"; } }
     
    9696
    9797    protected override IOperator CreateGenerationStepHook() {
    98       return DefaultStructureIdentificationOperators.CreateGenerationStepHook();
     98      IOperator op = DefaultStructureIdentificationOperators.CreateGenerationStepHook();
     99      op.AddSubOperator(CreateBestSolutionProcessor());
     100      return op;
    99101    }
     102
     103    private IOperator CreateBestSolutionProcessor() {
     104      CombinedOperator op = new CombinedOperator();
     105      op.Name = "BestSolutionProcessor";
     106      SequentialProcessor seq = new SequentialProcessor();
     107
     108      ProgrammableOperator evaluatedSolutionsStorer = new ProgrammableOperator();
     109      evaluatedSolutionsStorer.RemoveVariableInfo("Result");
     110      evaluatedSolutionsStorer.AddVariableInfo(new VariableInfo("Input", "Value to copy", typeof(IntData), VariableKind.In));
     111      evaluatedSolutionsStorer.AddVariableInfo(new VariableInfo("Output", "Value to write", typeof(IntData), VariableKind.New));
     112      evaluatedSolutionsStorer.GetVariableInfo("Input").ActualName = "EvaluatedSolutions";
     113      evaluatedSolutionsStorer.GetVariableInfo("Output").ActualName = "EvaluatedSolutions";
     114      evaluatedSolutionsStorer.Code = "Output.Data = Input.Data;";
     115
     116      seq.AddSubOperator(evaluatedSolutionsStorer);
     117
     118      op.OperatorGraph.AddOperator(seq);
     119      op.OperatorGraph.InitialOperator = seq;
     120      return op;
     121    }
     122
    100123
    101124    protected override VariableInjector CreateGlobalInjector() {
     
    150173    }
    151174
    152     private IOperator CreateBestSolutionProcessor() {
    153       CombinedOperator op = new CombinedOperator();
    154       op.Name = "BestSolutionProcessor";
    155       SequentialProcessor seq = new SequentialProcessor();
    156 
    157       ProgrammableOperator evaluatedSolutionsStorer = new ProgrammableOperator();
    158       evaluatedSolutionsStorer.RemoveVariableInfo("Result");
    159       evaluatedSolutionsStorer.AddVariableInfo(new VariableInfo("Input", "Value to copy", typeof(IntData), VariableKind.In));
    160       evaluatedSolutionsStorer.AddVariableInfo(new VariableInfo("Output", "Value to write", typeof(IntData), VariableKind.New));
    161       evaluatedSolutionsStorer.GetVariableInfo("Input").ActualName = "EvaluatedSolutions";
    162       evaluatedSolutionsStorer.GetVariableInfo("Output").ActualName = "EvaluatedSolutions";
    163       evaluatedSolutionsStorer.Code = "Output.Data = Input.Data;";
    164 
    165       seq.AddSubOperator(evaluatedSolutionsStorer);
    166 
    167       op.OperatorGraph.AddOperator(seq);
    168       op.OperatorGraph.InitialOperator = seq;
    169       return op;
    170     }
    171 
    172 
    173175    protected virtual IOperator CreateModelAnalyzerOperator() {
    174176      return DefaultRegressionOperators.CreatePostProcessingOperator();
  • trunk/sources/HeuristicLab.LinearRegression/3.2/LinearClassification.cs

    r2356 r2363  
    5454    }
    5555
    56     protected internal virtual IAnalyzerModel CreateLRModel(IScope bestModelScope) {
     56    protected override IAnalyzerModel CreateLRModel(IScope bestModelScope) {
    5757      var model = new AnalyzerModel();
    5858      DefaultClassificationOperators.PopulateAnalyzerModel(bestModelScope, model);
  • trunk/sources/HeuristicLab.LinearRegression/3.2/LinearRegression.cs

    r2360 r2363  
    6060      get {
    6161        IOperator main = GetMainOperator();
    62         return main.SubOperators[2];
     62        CombinedOperator probInjector = (CombinedOperator)main.SubOperators[2];
     63        return probInjector.OperatorGraph.InitialOperator.SubOperators[0];
    6364      }
    6465      set {
    6566        IOperator main = GetMainOperator();
    66         main.RemoveSubOperator(2);
    67         main.AddSubOperator(value, 2);
     67        CombinedOperator probInjector = (CombinedOperator)main.SubOperators[2];
     68        probInjector.OperatorGraph.InitialOperator.RemoveSubOperator(0);
     69        probInjector.OperatorGraph.InitialOperator.AddSubOperator(value, 0);
    6870      }
    6971    }
  • trunk/sources/HeuristicLab.LinearRegression/3.2/LinearTimeSeriesPrognosis.cs

    r2360 r2363  
    7373    }
    7474
    75     protected internal virtual IAnalyzerModel CreateLRModel(IScope bestModelScope) {
     75    protected override IAnalyzerModel CreateLRModel(IScope bestModelScope) {
    7676      var model = new AnalyzerModel();
    7777      DefaultTimeSeriesOperators.PopulateAnalyzerModel(bestModelScope, model);
  • trunk/sources/HeuristicLab.SupportVectorMachines/3.2/SupportVectorRegression.cs

    r2356 r2363  
    6060      get {
    6161        IOperator main = GetMainOperator();
    62         return main.SubOperators[0].SubOperators[1];
     62        CombinedOperator probInject = (CombinedOperator)main.SubOperators[0].SubOperators[2];
     63        return probInject.OperatorGraph.InitialOperator.SubOperators[0];
    6364      }
    6465      set {
    6566        IOperator main = GetMainOperator();
    66         main.RemoveSubOperator(1);
    67         main.AddSubOperator(value, 1);
     67        CombinedOperator probInject = (CombinedOperator)main.SubOperators[0].SubOperators[2];
     68        probInject.OperatorGraph.InitialOperator.RemoveSubOperator(0);
     69        probInject.OperatorGraph.InitialOperator.AddSubOperator(value, 0);
    6870      }
    6971    }
  • trunk/sources/HeuristicLab.sln

    r2341 r2363  
    990990    {1F1CF3ED-374C-4288-995B-93F6B872F571}.CEDMA Debug|x64.Build.0 = Debug|x64
    991991    {1F1CF3ED-374C-4288-995B-93F6B872F571}.CEDMA Debug|x86.ActiveCfg = Debug|x86
     992    {1F1CF3ED-374C-4288-995B-93F6B872F571}.CEDMA Debug|x86.Build.0 = Debug|x86
    992993    {1F1CF3ED-374C-4288-995B-93F6B872F571}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
    993994    {1F1CF3ED-374C-4288-995B-93F6B872F571}.Debug|Any CPU.Build.0 = Debug|Any CPU
     
    14221423    {C8FEDAC1-0326-4293-B585-F0FEDDEDFC11}.CEDMA Debug|x64.ActiveCfg = Debug|x64
    14231424    {C8FEDAC1-0326-4293-B585-F0FEDDEDFC11}.CEDMA Debug|x86.ActiveCfg = Debug|x86
    1424     {C8FEDAC1-0326-4293-B585-F0FEDDEDFC11}.CEDMA Debug|x86.Build.0 = Debug|x86
    14251425    {C8FEDAC1-0326-4293-B585-F0FEDDEDFC11}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
    14261426    {C8FEDAC1-0326-4293-B585-F0FEDDEDFC11}.Debug|Any CPU.Build.0 = Debug|Any CPU
     
    37203720    {E84E5717-79F8-498F-A5E0-A055C4EC086B}.CEDMA Debug|Any CPU.Build.0 = Debug|Any CPU
    37213721    {E84E5717-79F8-498F-A5E0-A055C4EC086B}.CEDMA Debug|x64.ActiveCfg = Debug|Any CPU
    3722     {E84E5717-79F8-498F-A5E0-A055C4EC086B}.CEDMA Debug|x86.ActiveCfg = Debug|Any CPU
     3722    {E84E5717-79F8-498F-A5E0-A055C4EC086B}.CEDMA Debug|x86.ActiveCfg = Debug|x86
     3723    {E84E5717-79F8-498F-A5E0-A055C4EC086B}.CEDMA Debug|x86.Build.0 = Debug|x86
    37233724    {E84E5717-79F8-498F-A5E0-A055C4EC086B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
    37243725    {E84E5717-79F8-498F-A5E0-A055C4EC086B}.Debug|Any CPU.Build.0 = Debug|Any CPU
     
    38883889    {3BD61258-31DA-4B09-89C0-4F71FEF5F05A}.CEDMA Debug|Any CPU.Build.0 = Debug|Any CPU
    38893890    {3BD61258-31DA-4B09-89C0-4F71FEF5F05A}.CEDMA Debug|x64.ActiveCfg = Debug|Any CPU
    3890     {3BD61258-31DA-4B09-89C0-4F71FEF5F05A}.CEDMA Debug|x86.ActiveCfg = Debug|Any CPU
     3891    {3BD61258-31DA-4B09-89C0-4F71FEF5F05A}.CEDMA Debug|x86.ActiveCfg = Debug|x86
    38913892    {3BD61258-31DA-4B09-89C0-4F71FEF5F05A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
    38923893    {3BD61258-31DA-4B09-89C0-4F71FEF5F05A}.Debug|Any CPU.Build.0 = Debug|Any CPU
     
    39163917    {569E430B-B4CE-4B94-A44E-6246B6E4E3BC}.CEDMA Debug|Any CPU.Build.0 = Debug|Any CPU
    39173918    {569E430B-B4CE-4B94-A44E-6246B6E4E3BC}.CEDMA Debug|x64.ActiveCfg = Debug|Any CPU
    3918     {569E430B-B4CE-4B94-A44E-6246B6E4E3BC}.CEDMA Debug|x86.ActiveCfg = Debug|Any CPU
     3919    {569E430B-B4CE-4B94-A44E-6246B6E4E3BC}.CEDMA Debug|x86.ActiveCfg = Debug|x86
    39193920    {569E430B-B4CE-4B94-A44E-6246B6E4E3BC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
    39203921    {569E430B-B4CE-4B94-A44E-6246B6E4E3BC}.Debug|Any CPU.Build.0 = Debug|Any CPU
     
    39443945    {0E27A536-1C4A-4624-A65E-DC4F4F23E3E1}.CEDMA Debug|Any CPU.Build.0 = Debug|Any CPU
    39453946    {0E27A536-1C4A-4624-A65E-DC4F4F23E3E1}.CEDMA Debug|x64.ActiveCfg = Debug|Any CPU
    3946     {0E27A536-1C4A-4624-A65E-DC4F4F23E3E1}.CEDMA Debug|x86.ActiveCfg = Debug|Any CPU
     3947    {0E27A536-1C4A-4624-A65E-DC4F4F23E3E1}.CEDMA Debug|x86.ActiveCfg = Debug|x86
    39473948    {0E27A536-1C4A-4624-A65E-DC4F4F23E3E1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
    39483949    {0E27A536-1C4A-4624-A65E-DC4F4F23E3E1}.Debug|Any CPU.Build.0 = Debug|Any CPU
     
    39723973    {1263BB36-1F20-4960-A5CB-530746DBAD77}.CEDMA Debug|Any CPU.Build.0 = Debug|Any CPU
    39733974    {1263BB36-1F20-4960-A5CB-530746DBAD77}.CEDMA Debug|x64.ActiveCfg = Debug|Any CPU
    3974     {1263BB36-1F20-4960-A5CB-530746DBAD77}.CEDMA Debug|x86.ActiveCfg = Debug|Any CPU
     3975    {1263BB36-1F20-4960-A5CB-530746DBAD77}.CEDMA Debug|x86.ActiveCfg = Debug|x86
    39753976    {1263BB36-1F20-4960-A5CB-530746DBAD77}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
    39763977    {1263BB36-1F20-4960-A5CB-530746DBAD77}.Debug|Any CPU.Build.0 = Debug|Any CPU
     
    40304031    {3127719F-110E-4558-8845-98559DBB422D}.CEDMA Debug|Any CPU.Build.0 = Debug|Any CPU
    40314032    {3127719F-110E-4558-8845-98559DBB422D}.CEDMA Debug|x64.ActiveCfg = Debug|Any CPU
    4032     {3127719F-110E-4558-8845-98559DBB422D}.CEDMA Debug|x86.ActiveCfg = Debug|Any CPU
     4033    {3127719F-110E-4558-8845-98559DBB422D}.CEDMA Debug|x86.ActiveCfg = Debug|x86
     4034    {3127719F-110E-4558-8845-98559DBB422D}.CEDMA Debug|x86.Build.0 = Debug|x86
    40334035    {3127719F-110E-4558-8845-98559DBB422D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
    40344036    {3127719F-110E-4558-8845-98559DBB422D}.Debug|Any CPU.Build.0 = Debug|Any CPU
Note: See TracChangeset for help on using the changeset viewer.