Free cookie consent management tool by TermsFeed Policy Generator

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

#2597: Merged trunk changes.

Location:
branches/HeuristicLab.RegressionSolutionGradientView/HeuristicLab.Problems.DataAnalysis
Files:
8 edited

Legend:

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

  • 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.