Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
12/16/21 14:23:48 (3 years ago)
Author:
mkommend
Message:

#3136: Merged trunk changes into branch.

Location:
branches/3136_Structural_GP
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • branches/3136_Structural_GP

  • branches/3136_Structural_GP/HeuristicLab.Problems.DataAnalysis

  • branches/3136_Structural_GP/HeuristicLab.Problems.DataAnalysis/3.4

  • branches/3136_Structural_GP/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/DataAnalysisProblem.cs

    r17180 r18146  
    9292
    9393    #region Import & Export
    94     public void Load(T data) {
     94    public virtual void Load(T data) {
    9595      Name = data.Name;
    9696      Description = data.Description;
     
    9898    }
    9999
    100     public T Export() {
     100    public virtual T Export() {
    101101      return ProblemData;
    102102    }
  • branches/3136_Structural_GP/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/DataAnalysisProblemData.cs

    r18034 r18146  
    187187      Parameters.Add(new FixedValueParameter<ReadOnlyItemList<ITransformation>>(TransformationsParameterName, "", transformationsList.AsReadOnly()));
    188188
     189      IntervalCollection varRanges = null;
    189190      if (variableRanges == null) {
    190         variableRanges = Dataset.GetVariableRanges();
    191       }
    192       Parameters.Add(new FixedValueParameter<IntervalCollection>(VariableRangesParameterName, variableRanges));
     191        varRanges = Dataset.GetVariableRanges();
     192      }else {
     193        varRanges = (IntervalCollection) variableRanges.Clone();
     194      }
     195
     196      Parameters.Add(new FixedValueParameter<IntervalCollection>(VariableRangesParameterName, varRanges));
    193197
    194198      TransformationsParameter.Hidden = true;
  • branches/3136_Structural_GP/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/Regression/RegressionProblemData.cs

    r18034 r18146  
    158158
    159159    public RegressionProblemData(IDataset dataset, IEnumerable<string> allowedInputVariables, string targetVariable,
    160       IEnumerable<ITransformation> transformations = null/*,
    161       IntervalCollection variableRanges = null*/)
    162       : base(dataset, allowedInputVariables, transformations ?? Enumerable.Empty<ITransformation>()) {
     160      IEnumerable<ITransformation> transformations = null,  IntervalCollection variableRanges = null)
     161      : base(dataset, allowedInputVariables, transformations, variableRanges) {
    163162      var variables = InputVariables.Select(x => x.AsReadOnly()).ToList();
    164163      Parameters.Add(new ConstrainedValueParameter<StringValue>(TargetVariableParameterName, new ItemSet<StringValue>(variables), variables.Where(x => x.Value == targetVariable).First()));
    165       /*if (variableRanges == null) {
    166         variableRanges = Dataset.GetVariableRanges();
    167       }
    168       Parameters.Add(new FixedValueParameter<IntervalCollection>(VariableRangesParameterName, variableRanges));*/
     164     
    169165    }
    170166    private void RegisterParameterEvents() {
  • branches/3136_Structural_GP/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/Regression/ShapeConstrainedRegressionProblem.cs

    r17960 r18146  
    2424using HeuristicLab.Core;
    2525
    26 namespace HeuristicLab.Problems.DataAnalysis{
     26namespace HeuristicLab.Problems.DataAnalysis {
    2727  [StorableType("B53C4C71-3715-4BB1-9A95-4E969D8135C6")]
    2828  [Item("Shape-constrained Regression Problem", "A regression problem with shape constraints.")]
    29   public class ShapeConstrainedRegressionProblem : DataAnalysisProblem<IShapeConstrainedRegressionProblemData>, IShapeConstrainedRegressionProblem {
     29  public class ShapeConstrainedRegressionProblem : DataAnalysisProblem<IRegressionProblemData>, IShapeConstrainedRegressionProblem {
    3030    [StorableConstructor]
    3131    protected ShapeConstrainedRegressionProblem(StorableConstructorFlag _) : base(_) { }
     
    3333    public override IDeepCloneable Clone(Cloner cloner) { return new ShapeConstrainedRegressionProblem(this, cloner); }
    3434
     35    public ShapeConstrainedRegressionProblemData ShapeConstrainedRegressionProblemData {
     36      get => (ShapeConstrainedRegressionProblemData)ProblemData;
     37      set => ProblemData = value;
     38    }
    3539    public ShapeConstrainedRegressionProblem() : base(new ShapeConstrainedRegressionProblemData()) { }
     40
     41
     42    public override void Load(IRegressionProblemData data) {
     43      if (data is ShapeConstrainedRegressionProblemData scProblemData) {
     44        // use directly
     45      } else {
     46        scProblemData = new ShapeConstrainedRegressionProblemData(data.Dataset, data.AllowedInputVariables, data.TargetVariable,
     47                                                                      data.TrainingPartition, data.TestPartition) {
     48          Name = data.Name,
     49          Description = data.Description
     50        };
     51      }
     52      base.Load(scProblemData);
     53    }
    3654  }
    3755}
  • branches/3136_Structural_GP/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/Regression/ShapeConstrainedRegressionProblemData.cs

    r18034 r18146  
    144144    public ShapeConstrainedRegressionProblemData(IRegressionProblemData regressionProblemData)
    145145      : this(regressionProblemData.Dataset, regressionProblemData.AllowedInputVariables, regressionProblemData.TargetVariable,
    146           regressionProblemData.TrainingPartition, regressionProblemData.TestPartition, regressionProblemData.Transformations,
    147           (regressionProblemData is ShapeConstrainedRegressionProblemData) ? ((ShapeConstrainedRegressionProblemData)regressionProblemData).ShapeConstraints : null,
    148           regressionProblemData.VariableRanges) {
     146          regressionProblemData.TrainingPartition, regressionProblemData.TestPartition, (regressionProblemData is ShapeConstrainedRegressionProblemData) ? ((ShapeConstrainedRegressionProblemData)regressionProblemData).ShapeConstraints : null,
     147          regressionProblemData.Transformations, regressionProblemData.VariableRanges) {
    149148    }
    150149
    151150    public ShapeConstrainedRegressionProblemData(IDataset dataset, IEnumerable<string> allowedInputVariables, string targetVariable,
    152                                                  IntRange trainingPartition, IntRange testPartition,
    153                                                  IEnumerable<ITransformation> transformations = null, ShapeConstraints sc = null, IntervalCollection variableRanges = null)
    154     : base(dataset, allowedInputVariables, targetVariable, transformations ?? Enumerable.Empty<ITransformation>()) {
     151                                                 IntRange trainingPartition, IntRange testPartition, ShapeConstraints sc = null,
     152                                                 IEnumerable<ITransformation> transformations = null, IntervalCollection variableRanges = null)
     153    : base(dataset, allowedInputVariables, targetVariable, transformations, variableRanges) {
    155154      TrainingPartition.Start = trainingPartition.Start;
    156155      TrainingPartition.End = trainingPartition.End;
     
    159158      if (sc == null) sc = new ShapeConstraints();
    160159      Parameters.Add(new FixedValueParameter<ShapeConstraints>(ShapeConstraintsParameterName, "Specifies the shape constraints for the regression problem.", (ShapeConstraints)sc.Clone()));
    161 
    162160      RegisterEventHandlers();
    163161    }
  • branches/3136_Structural_GP/HeuristicLab.Problems.DataAnalysis/3.4/Interfaces/Regression/IShapeConstrainedRegressionProblem.cs

    r17960 r18146  
    2424namespace HeuristicLab.Problems.DataAnalysis {
    2525  [StorableType("C6E9D32A-7727-487E-859C-DF24EDCC5922")]
    26   public interface  IShapeConstrainedRegressionProblem : IDataAnalysisProblem<IShapeConstrainedRegressionProblemData> {
     26  public interface IShapeConstrainedRegressionProblem : IRegressionProblem {
     27    ShapeConstrainedRegressionProblemData ShapeConstrainedRegressionProblemData { get; set; }
    2728  }
    2829}
  • branches/3136_Structural_GP/HeuristicLab.Problems.DataAnalysis/3.4/OnlineCalculators/OnlineLinearScalingParameterCalculator.cs

    r17180 r18146  
    2828
    2929    /// <summary>
    30     /// Additive constant
     30    /// Additive offset
    3131    /// </summary>
    3232    public double Alpha {
     
    103103    /// <param name="original">Values that should be scaled</param>
    104104    /// <param name="target">Target values to which the original values should be scaled</param>
    105     /// <param name="alpha">Additive constant for the linear scaling</param>
     105    /// <param name="alpha">Additive offset for the linear scaling</param>
    106106    /// <param name="beta">Multiplicative factor for the linear scaling</param>
    107107    /// <param name="errorState">Flag that indicates if errors occurred in the calculation of the linea scaling parameters.</param>
Note: See TracChangeset for help on using the changeset viewer.