Free cookie consent management tool by TermsFeed Policy Generator

Changeset 13994


Ignore:
Timestamp:
07/04/16 23:40:44 (8 years ago)
Author:
bburlacu
Message:

#2597: Merged trunk changes.

Location:
branches/HeuristicLab.RegressionSolutionGradientView
Files:
1 deleted
18 edited

Legend:

Unmodified
Added
Removed
  • branches/HeuristicLab.RegressionSolutionGradientView/HeuristicLab.Algorithms.DataAnalysis

  • branches/HeuristicLab.RegressionSolutionGradientView/HeuristicLab.Algorithms.DataAnalysis.Views

    • Property svn:mergeinfo changed (with no actual effect on merging)
  • branches/HeuristicLab.RegressionSolutionGradientView/HeuristicLab.Algorithms.DataAnalysis/3.4/BaselineClassifiers/ZeroR.cs

    r13098 r13994  
    6464        .MaxItems(kvp => kvp.Value).Select(x => x.Key).First();
    6565
    66       var model = new ConstantModel(dominantClass);
     66      var model = new ConstantModel(dominantClass, target);
    6767      var solution = model.CreateClassificationSolution(problemData);
    6868      return solution;
  • branches/HeuristicLab.RegressionSolutionGradientView/HeuristicLab.Algorithms.DataAnalysis/3.4/GBM/GradientBoostingRegressionAlgorithm.cs

    r13948 r13994  
    181181    public GradientBoostingRegressionAlgorithm() {
    182182      Problem = new RegressionProblem(); // default problem
    183       var mctsSymbReg = new MctsSymbolicRegressionAlgorithm();
    184       mctsSymbReg.Iterations = 10000;
    185       mctsSymbReg.StoreAlgorithmInEachRun = false;
    186       var sgp = CreateOSGP();
     183      var osgp = CreateOSGP();
    187184      var regressionAlgs = new ItemSet<IAlgorithm>(new IAlgorithm[] {
    188185        new RandomForestRegression(),
    189         sgp,
    190         mctsSymbReg
     186        osgp,
    191187      });
    192188      foreach (var alg in regressionAlgs) alg.Prepare();
     
    208204        new DoubleValue(0.5)));
    209205      Parameters.Add(new ConstrainedValueParameter<IAlgorithm>(RegressionAlgorithmParameterName,
    210         "The regression algorithm to use as a base learner", regressionAlgs, mctsSymbReg));
     206        "The regression algorithm to use as a base learner", regressionAlgs, osgp));
    211207      Parameters.Add(new FixedValueParameter<StringValue>(RegressionAlgorithmSolutionResultParameterName,
    212208        "The name of the solution produced by the regression algorithm", new StringValue("Solution")));
  • branches/HeuristicLab.RegressionSolutionGradientView/HeuristicLab.Algorithms.DataAnalysis/3.4/GradientBoostedTrees/RegressionTreeBuilder.cs

    r13948 r13994  
    2222
    2323using System;
    24 using System.Collections;
    2524using System.Collections.Generic;
    2625using System.Diagnostics;
     
    129128
    130129      // y and curPred are changed in gradient boosting
    131       this.y = y; 
    132       this.curPred = curPred; 
     130      this.y = y;
     131      this.curPred = curPred;
    133132
    134133      // shuffle row idx
     
    137136      int nRows = idx.Count();
    138137
    139       // shuffle variable idx
     138      // shuffle variable names
    140139      HeuristicLab.Random.ListExtensions.ShuffleInPlace(allowedVariables, random);
    141140
     
    176175      CreateRegressionTreeFromQueue(maxSize, lossFunction);
    177176
    178       return new RegressionTreeModel(tree.ToArray());
     177      return new RegressionTreeModel(tree.ToArray(), problemData.TargetVariable);
    179178    }
    180179
  • branches/HeuristicLab.RegressionSolutionGradientView/HeuristicLab.Algorithms.DataAnalysis/3.4/GradientBoostedTrees/RegressionTreeModel.cs

    r13948 r13994  
    149149    #endregion
    150150
    151 
    152 
    153 
    154151    [StorableConstructor]
    155152    private RegressionTreeModel(bool serializing) : base(serializing) { }
  • branches/HeuristicLab.RegressionSolutionGradientView/HeuristicLab.Algorithms.DataAnalysis/3.4/HeuristicLab.Algorithms.DataAnalysis-3.4.csproj

    r13858 r13994  
    240240    </Compile>
    241241    <Compile Include="FixedDataAnalysisAlgorithm.cs" />
    242     <Compile Include="GaussianProcess\StudentTProcessRegressionModelCreator.cs" />
    243     <Compile Include="GaussianProcess\StudentTProcessModel.cs" />
    244242    <Compile Include="GaussianProcess\CovarianceFunctions\CovarianceSpectralMixture.cs" />
    245243    <Compile Include="GaussianProcess\CovarianceFunctions\CovariancePiecewisePolynomial.cs" />
  • branches/HeuristicLab.RegressionSolutionGradientView/HeuristicLab.Problems.DataAnalysis

  • branches/HeuristicLab.RegressionSolutionGradientView/HeuristicLab.Problems.DataAnalysis.Views

  • branches/HeuristicLab.RegressionSolutionGradientView/HeuristicLab.Problems.DataAnalysis.Views/3.4/Regression/RegressionSolutionErrorCharacteristicsCurveView.cs

    r13100 r13994  
    292292    private IRegressionSolution CreateConstantSolution() {
    293293      double averageTrainingTarget = ProblemData.Dataset.GetDoubleValues(ProblemData.TargetVariable, ProblemData.TrainingIndices).Average();
    294       var model = new ConstantModel(averageTrainingTarget);
     294      var model = new ConstantModel(averageTrainingTarget, ProblemData.TargetVariable);
    295295      var solution = model.CreateRegressionSolution(ProblemData);
    296296      solution.Name = "Baseline (constant)";
  • branches/HeuristicLab.RegressionSolutionGradientView/HeuristicLab.Problems.DataAnalysis.Views/3.4/Regression/RegressionSolutionScatterPlotView.cs

    r13764 r13994  
    3636    private const string TEST_SERIES = "Test samples";
    3737
     38    private const int OPACITY_LEVEL = 150;
     39
    3840    public new IRegressionSolution Content {
    3941      get { return (IRegressionSolution)base.Content; }
     
    6062      this.chart.TextAntiAliasingQuality = TextAntiAliasingQuality.High;
    6163      this.chart.AxisViewChanged += new EventHandler<System.Windows.Forms.DataVisualization.Charting.ViewEventArgs>(chart_AxisViewChanged);
     64
     65      //make series colors semi transparent
     66      this.chart.ApplyPaletteColors();
     67      this.chart.Series[ALL_SERIES].Color = Color.FromArgb(OPACITY_LEVEL, this.chart.Series[ALL_SERIES].Color);
     68      this.chart.Series[TRAINING_SERIES].Color = Color.FromArgb(OPACITY_LEVEL, this.chart.Series[TRAINING_SERIES].Color);
     69      this.chart.Series[TEST_SERIES].Color = Color.FromArgb(OPACITY_LEVEL, this.chart.Series[TEST_SERIES].Color);
     70
     71      //change all markers to circles
     72      this.chart.Series[ALL_SERIES].MarkerStyle = MarkerStyle.Circle;
     73      this.chart.Series[TRAINING_SERIES].MarkerStyle = MarkerStyle.Circle;
     74      this.chart.Series[TEST_SERIES].MarkerStyle = MarkerStyle.Circle;
    6275
    6376      //configure axis
  • branches/HeuristicLab.RegressionSolutionGradientView/HeuristicLab.Problems.DataAnalysis/3.4/HeuristicLab.Problems.DataAnalysis-3.4.csproj

    r13948 r13994  
    151151      <SpecificVersion>False</SpecificVersion>
    152152      <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Problems.Instances-3.3.dll</HintPath>
     153      <Private>False</Private>
     154    </Reference>
     155    <Reference Include="HeuristicLab.Random-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
     156      <SpecificVersion>False</SpecificVersion>
     157      <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Random-3.3.dll</HintPath>
    153158      <Private>False</Private>
    154159    </Reference>
     
    317322    </BootstrapperPackage>
    318323  </ItemGroup>
     324  <ItemGroup>
     325    <ProjectReference Include="..\..\HeuristicLab.Collections\3.3\HeuristicLab.Collections-3.3.csproj">
     326      <Project>{958B43BC-CC5C-4FA2-8628-2B3B01D890B6}</Project>
     327      <Name>HeuristicLab.Collections-3.3</Name>
     328      <Private>False</Private>
     329    </ProjectReference>
     330    <ProjectReference Include="..\..\HeuristicLab.Common.Resources\3.3\HeuristicLab.Common.Resources-3.3.csproj">
     331      <Project>{0E27A536-1C4A-4624-A65E-DC4F4F23E3E1}</Project>
     332      <Name>HeuristicLab.Common.Resources-3.3</Name>
     333      <Private>False</Private>
     334    </ProjectReference>
     335    <ProjectReference Include="..\..\HeuristicLab.Common\3.3\HeuristicLab.Common-3.3.csproj">
     336      <Project>{A9AD58B9-3EF9-4CC1-97E5-8D909039FF5C}</Project>
     337      <Name>HeuristicLab.Common-3.3</Name>
     338      <Private>False</Private>
     339    </ProjectReference>
     340    <ProjectReference Include="..\..\HeuristicLab.Core\3.3\HeuristicLab.Core-3.3.csproj">
     341      <Project>{C36BD924-A541-4A00-AFA8-41701378DDC5}</Project>
     342      <Name>HeuristicLab.Core-3.3</Name>
     343      <Private>False</Private>
     344    </ProjectReference>
     345    <ProjectReference Include="..\..\HeuristicLab.Data\3.3\HeuristicLab.Data-3.3.csproj">
     346      <Project>{BBAB9DF5-5EF3-4BA8-ADE9-B36E82114937}</Project>
     347      <Name>HeuristicLab.Data-3.3</Name>
     348      <Private>False</Private>
     349    </ProjectReference>
     350    <ProjectReference Include="..\..\HeuristicLab.Optimization\3.3\HeuristicLab.Optimization-3.3.csproj">
     351      <Project>{14AB8D24-25BC-400C-A846-4627AA945192}</Project>
     352      <Name>HeuristicLab.Optimization-3.3</Name>
     353      <Private>False</Private>
     354    </ProjectReference>
     355    <ProjectReference Include="..\..\HeuristicLab.Parameters\3.3\HeuristicLab.Parameters-3.3.csproj">
     356      <Project>{56F9106A-079F-4C61-92F6-86A84C2D84B7}</Project>
     357      <Name>HeuristicLab.Parameters-3.3</Name>
     358      <Private>False</Private>
     359    </ProjectReference>
     360    <ProjectReference Include="..\..\HeuristicLab.Persistence\3.3\HeuristicLab.Persistence-3.3.csproj">
     361      <Project>{102BC7D3-0EF9-439C-8F6D-96FF0FDB8E1B}</Project>
     362      <Name>HeuristicLab.Persistence-3.3</Name>
     363      <Private>False</Private>
     364    </ProjectReference>
     365    <ProjectReference Include="..\..\HeuristicLab.PluginInfrastructure\3.3\HeuristicLab.PluginInfrastructure-3.3.csproj">
     366      <Project>{94186A6A-5176-4402-AE83-886557B53CCA}</Project>
     367      <Name>HeuristicLab.PluginInfrastructure-3.3</Name>
     368      <Private>False</Private>
     369    </ProjectReference>
     370    <ProjectReference Include="..\..\HeuristicLab.Problems.Instances\3.3\HeuristicLab.Problems.Instances-3.3.csproj">
     371      <Project>{3540E29E-4793-49E7-8EE2-FEA7F61C3994}</Project>
     372      <Name>HeuristicLab.Problems.Instances-3.3</Name>
     373      <Private>False</Private>
     374    </ProjectReference>
     375  </ItemGroup>
    319376  <ItemGroup />
    320377  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
  • branches/HeuristicLab.RegressionSolutionGradientView/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/Classification/ClassificationModel.cs

    r13948 r13994  
    5555    }
    5656
     57    [StorableHook(HookType.AfterDeserialization)]
     58    private void AfterDeserialization() {
     59      // BackwardsCompatibility3.3
     60      #region Backwards compatible code, remove with 3.4
     61      targetVariable = string.Empty;
     62      #endregion
     63    }
     64
    5765    public abstract IEnumerable<double> GetEstimatedClassValues(IDataset dataset, IEnumerable<int> rows);
    5866    public abstract IClassificationSolution CreateClassificationSolution(IClassificationProblemData problemData);
  • branches/HeuristicLab.RegressionSolutionGradientView/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/DataAnalysisSolution.cs

    r13948 r13994  
    8989    protected abstract void RecalculateResults();
    9090
     91    public virtual IEnumerable<string> GetUsedVariablesForPrediction() {
     92      return this.ProblemData.AllowedInputVariables;
     93    }
     94
    9195    private void ProblemData_Changed(object sender, EventArgs e) {
    9296      OnProblemDataChanged();
  • branches/HeuristicLab.RegressionSolutionGradientView/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/Regression/ConstantRegressionModel.cs

    r13948 r13994  
    6464
    6565    public override IRegressionSolution CreateRegressionSolution(IRegressionProblemData problemData) {
    66       return new ConstantRegressionSolution(new ConstantModel(constant), new RegressionProblemData(problemData));
     66      return new ConstantRegressionSolution(new ConstantModel(constant, TargetVariable), new RegressionProblemData(problemData));
    6767    }
    6868
  • branches/HeuristicLab.RegressionSolutionGradientView/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/Regression/RegressionModel.cs

    r13948 r13994  
    5656    }
    5757
     58    [StorableHook(HookType.AfterDeserialization)]
     59    private void AfterDeserialization() {
     60      // BackwardsCompatibility3.3
     61      #region Backwards compatible code, remove with 3.4
     62      targetVariable = string.Empty;
     63      #endregion
     64    }
    5865    public abstract IEnumerable<double> GetEstimatedValues(IDataset dataset, IEnumerable<int> rows);
    5966    public abstract IRegressionSolution CreateRegressionSolution(IRegressionProblemData problemData);
  • branches/HeuristicLab.RegressionSolutionGradientView/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/Regression/RegressionSolutionVariableImpactsCalculator.cs

    r13766 r13994  
    3030using HeuristicLab.Parameters;
    3131using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
     32using HeuristicLab.Random;
    3233
    3334namespace HeuristicLab.Problems.DataAnalysis {
    3435  [StorableClass]
    35   [Item("RegressionSolution Impacts Calculator", "Calculation of the impacts of input variables for a concrete ")]
     36  [Item("RegressionSolution Impacts Calculator", "Calculation of the impacts of input variables for any regression solution")]
    3637  public sealed class RegressionSolutionVariableImpactsCalculator : ParameterizedNamedItem {
    3738    public enum ReplacementMethodEnum {
    3839      Median,
    39       Average
     40      Average,
     41      Shuffle,
     42      Noise
    4043    }
    4144
     
    7780      : base() {
    7881      Parameters.Add(new FixedValueParameter<EnumValue<ReplacementMethodEnum>>(ReplacementParameterName, "The replacement method for variables during impact calculation.", new EnumValue<ReplacementMethodEnum>(ReplacementMethodEnum.Median)));
    79       Parameters.Add(new FixedValueParameter<EnumValue<DataPartitionEnum>>(ReplacementParameterName, "The data partition on which the impacts are calculated.", new EnumValue<DataPartitionEnum>(DataPartitionEnum.Training)));
     82      Parameters.Add(new FixedValueParameter<EnumValue<DataPartitionEnum>>(DataPartitionParameterName, "The data partition on which the impacts are calculated.", new EnumValue<DataPartitionEnum>(DataPartitionEnum.Training)));
    8083    }
    8184
     
    138141      var originalValues = dataset.GetReadOnlyDoubleValues(variable).ToList();
    139142      double replacementValue;
     143      List<double> replacementValues;
     144      IRandom rand;
    140145
    141146      switch (replacement) {
    142147        case ReplacementMethodEnum.Median:
    143148          replacementValue = rows.Select(r => originalValues[r]).Median();
     149          replacementValues = Enumerable.Repeat(replacementValue, dataset.Rows).ToList();
    144150          break;
    145151        case ReplacementMethodEnum.Average:
    146152          replacementValue = rows.Select(r => originalValues[r]).Average();
     153          replacementValues = Enumerable.Repeat(replacementValue, dataset.Rows).ToList();
    147154          break;
     155        case ReplacementMethodEnum.Shuffle:
     156          // new var has same empirical distribution but the relation to y is broken
     157          rand = new FastRandom(31415);
     158          replacementValues = rows.Select(r => originalValues[r]).Shuffle(rand).ToList();
     159          break;
     160        case ReplacementMethodEnum.Noise:
     161          var avg = rows.Select(r => originalValues[r]).Average();
     162          var stdDev = rows.Select(r => originalValues[r]).StandardDeviation();
     163          rand = new FastRandom(31415);
     164          replacementValues = rows.Select(_ => NormalDistributedRandom.NextDouble(rand, avg, stdDev)).ToList();
     165          break;
     166
    148167        default:
    149168          throw new ArgumentException(string.Format("ReplacementMethod {0} cannot be handled.", replacement));
    150169      }
    151170
    152       dataset.ReplaceVariable(variable, Enumerable.Repeat(replacementValue, dataset.Rows).ToList());
     171      dataset.ReplaceVariable(variable, replacementValues);
    153172      //mkommend: ToList is used on purpose to avoid lazy evaluation that could result in wrong estimates due to variable replacements
    154173      var estimates = model.GetEstimatedValues(dataset, rows).ToList();
  • branches/HeuristicLab.RegressionSolutionGradientView/HeuristicLab.Problems.DataAnalysis/3.4/Plugin.cs.frame

    r13321 r13994  
    3838  [PluginDependency("HeuristicLab.Persistence", "3.3")]
    3939  [PluginDependency("HeuristicLab.Problems.Instances", "3.3")] 
     40  [PluginDependency("HeuristicLab.Random", "3.3")]
    4041  public class HeuristicLabProblemsDataAnalysisPlugin : PluginBase {
    4142  }
Note: See TracChangeset for help on using the changeset viewer.