Changeset 15848


Ignore:
Timestamp:
03/20/18 12:28:16 (3 years ago)
Author:
pfleck
Message:

#2906 Added TransformedModelView, implemented "remove virtual columns"

Location:
branches/2906_Transformations
Files:
2 added
3 edited

Legend:

Unmodified
Added
Removed
  • branches/2906_Transformations/HeuristicLab.Problems.DataAnalysis.Views/3.4/HeuristicLab.Problems.DataAnalysis.Views-3.4.csproj

    r15847 r15848  
    432432      <DependentUpon>RegressionSolutionScatterPlotView.cs</DependentUpon>
    433433    </Compile>
     434    <Compile Include="Regression\TransformedRegressionModelView.cs">
     435      <SubType>UserControl</SubType>
     436    </Compile>
     437    <Compile Include="Regression\TransformedRegressionModelView.Designer.cs">
     438      <DependentUpon>TransformedRegressionModelView.cs</DependentUpon>
     439    </Compile>
    434440    <Compile Include="Solution Views\ClassificationSolutionView.cs">
    435441      <SubType>UserControl</SubType>
  • branches/2906_Transformations/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/DataAnalysisProblemData.cs

    r15847 r15848  
    273273    }
    274274
    275     public static IDataset InverseTransform(IDataset dataset, IEnumerable<IDataAnalysisTransformation> transformations) {
     275    public static IDataset InverseTransform(IDataset dataset, IEnumerable<IDataAnalysisTransformation> transformations, bool removeVirtualVariables = true) {
    276276      var modifiableDataset = ((Dataset)dataset).ToModifiable();
    277277
    278       foreach (var transformation in transformations.Reverse()) {
     278      var transformationsStack = new Stack<IDataAnalysisTransformation>(transformations);
     279      while (transformationsStack.Any()) {
     280        var transformation = transformationsStack.Pop();
    279281        var trans = (ITransformation<double>)transformation.Transformation;
    280282
     
    283285        var originalData = trans.InverseApply(transformedData).ToList();
    284286        modifiableDataset.ReplaceVariable(transformation.OriginalVariable, originalData);
     287
     288        bool transformedVariablePending = transformationsStack.Any(x => x.OriginalVariable == transformation.TransformedVariable);
     289        if (removeVirtualVariables && !transformedVariablePending)
     290          modifiableDataset.RemoveVariable(transformation.TransformedVariable);
    285291      }
    286292
  • branches/2906_Transformations/HeuristicLab.Problems.DataAnalysis/3.4/Interfaces/Regression/ITransformedRegressionModel.cs

    r15846 r15848  
    2020#endregion
    2121
     22using HeuristicLab.Core;
     23
    2224namespace HeuristicLab.Problems.DataAnalysis {
    2325  public interface ITransformedRegressionModel : IRegressionModel {
     26
    2427    IRegressionModel OriginalModel { get; }
     28
     29    ItemList<IDataAnalysisTransformation> Transformations { get; }
    2530  }
    2631}
Note: See TracChangeset for help on using the changeset viewer.