Changeset 17803 for stable/HeuristicLab.Problems.DataAnalysis
- Timestamp:
- 12/23/20 17:02:12 (4 years ago)
- Location:
- stable
- Files:
-
- 1 deleted
- 12 edited
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
stable
- Property svn:mergeinfo changed
/trunk merged: 17579-17580,17583-17584,17754
- Property svn:mergeinfo changed
-
stable/HeuristicLab.Problems.DataAnalysis
- Property svn:mergeinfo changed
-
stable/HeuristicLab.Problems.DataAnalysis/3.4
- Property svn:mergeinfo changed
-
stable/HeuristicLab.Problems.DataAnalysis/3.4/HeuristicLab.Problems.DataAnalysis-3.4.csproj
r17177 r17803 140 140 <Compile Include="Implementation\ConstantModel.cs" /> 141 141 <Compile Include="Implementation\DataAnalysisModel.cs" /> 142 <Compile Include="Implementation\Interval.cs" /> 142 <Compile Include="Implementation\Interval\Interval.cs" /> 143 <Compile Include="Implementation\Interval\IntervalCollection.cs" /> 143 144 <Compile Include="Implementation\Regression\ConfidenceBoundRegressionSolution.cs" /> 144 145 <Compile Include="Implementation\Regression\ConstantRegressionModel.cs" /> -
stable/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/Interval/Interval.cs
- Property svn:mergeinfo changed
r17579 r17803 237 237 238 238 /// <summary> 239 /// Calculates the principal square root of a given interval. Discards the second possible result of root, because240 /// all interpreters just calculate the positive principal root.239 /// The interval contains both possible results of the calculated square root +-sqrt(x). That results in a wider 240 /// interval, but it contains all possible solutions. 241 241 /// </summary> 242 242 /// <param name="a">Interval to build square root from.</param> … … 244 244 public static Interval SquareRoot(Interval a) { 245 245 if (a.LowerBound < 0) return new Interval(double.NaN, double.NaN); 246 return new Interval( Math.Sqrt(a.LowerBound), Math.Sqrt(a.UpperBound));246 return new Interval(-Math.Sqrt(a.UpperBound), Math.Sqrt(a.UpperBound)); 247 247 } 248 248 -
stable/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/Regression/RegressionProblemData.cs
r17181 r17803 1 #region License Information1 #region License Information 2 2 /* HeuristicLab 3 3 * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL) … … 23 23 using System.Collections.Generic; 24 24 using System.Linq; 25 using HEAL.Attic; 25 26 using HeuristicLab.Common; 26 27 using HeuristicLab.Core; 27 28 using HeuristicLab.Data; 28 29 using HeuristicLab.Parameters; 29 using HEAL.Attic;30 30 31 31 namespace HeuristicLab.Problems.DataAnalysis { … … 34 34 public class RegressionProblemData : DataAnalysisProblemData, IRegressionProblemData, IStorableContent { 35 35 protected const string TargetVariableParameterName = "TargetVariable"; 36 protected const string VariableRangesParameterName = "VariableRanges"; 37 protected const string IntervalConstraintsParameterName = "IntervalConstraints"; 36 38 public string Filename { get; set; } 37 39 … … 91 93 problemData.Parameters.Add(new FixedValueParameter<IntRange>(TestPartitionParameterName, "", (IntRange)new IntRange(0, 0).AsReadOnly())); 92 94 problemData.Parameters.Add(new ConstrainedValueParameter<StringValue>(TargetVariableParameterName, new ItemSet<StringValue>())); 95 problemData.Parameters.Add(new FixedValueParameter<IntervalCollection>(VariableRangesParameterName, "", new IntervalCollection())); 93 96 emptyProblemData = problemData; 94 97 } … … 98 101 get { return (IConstrainedValueParameter<StringValue>)Parameters[TargetVariableParameterName]; } 99 102 } 103 104 public IFixedValueParameter<IntervalCollection> VariableRangesParameter => (IFixedValueParameter<IntervalCollection>)Parameters[VariableRangesParameterName]; 105 106 public IntervalCollection VariableRanges { 107 get => VariableRangesParameter.Value; 108 } 109 110 100 111 public string TargetVariable { 101 112 get { return TargetVariableParameter.Value.Value; } … … 125 136 [StorableHook(HookType.AfterDeserialization)] 126 137 private void AfterDeserialization() { 138 if (!Parameters.ContainsKey(VariableRangesParameterName)) { 139 var intervalCollection = CalculateDatasetIntervals(this.Dataset); 140 Parameters.Add(new FixedValueParameter<IntervalCollection>(VariableRangesParameterName, intervalCollection)); 141 } 127 142 RegisterParameterEvents(); 128 143 } … … 152 167 var variables = InputVariables.Select(x => x.AsReadOnly()).ToList(); 153 168 Parameters.Add(new ConstrainedValueParameter<StringValue>(TargetVariableParameterName, new ItemSet<StringValue>(variables), variables.Where(x => x.Value == targetVariable).First())); 169 var intervalCollection = CalculateDatasetIntervals(this.Dataset); 170 Parameters.Add(new FixedValueParameter<IntervalCollection>(VariableRangesParameterName, intervalCollection)); 154 171 RegisterParameterEvents(); 172 } 173 174 private static IntervalCollection CalculateDatasetIntervals(IDataset dataset) { 175 IntervalCollection intervalCollection = new IntervalCollection(); 176 foreach (var variable in dataset.DoubleVariables) {// intervals are only possible for double variables 177 var variableInterval = Interval.GetInterval(dataset.GetDoubleValues(variable)); 178 intervalCollection.AddInterval(variable, variableInterval); 179 } 180 181 return intervalCollection; 155 182 } 156 183 -
stable/HeuristicLab.Problems.DataAnalysis/3.4/Interfaces/IDataAnalysisModel.cs
r17181 r17803 25 25 26 26 namespace HeuristicLab.Problems.DataAnalysis { 27 [StorableType("f85ccf7a-7df5-431e-bc4d-be6f3c4c2338")]28 27 /// <summary> 29 28 /// Interface for all data-analysis models (regression/classification/clustering). 30 29 /// <remarks>All methods and properties in in this interface must be implemented thread safely</remarks> 31 30 /// </summary> 31 [StorableType("f85ccf7a-7df5-431e-bc4d-be6f3c4c2338")] 32 32 public interface IDataAnalysisModel : INamedItem { 33 33 IEnumerable<string> VariablesUsedForPrediction { get; } -
stable/HeuristicLab.Problems.DataAnalysis/3.4/Interfaces/IDataAnalysisProblem.cs
r17181 r17803 35 35 [StorableType("c2f6fcdd-ab62-4423-be75-01aa694df411")] 36 36 public interface IDataAnalysisProblem<T> : IDataAnalysisProblem 37 where T : class, IDataAnalysisProblemData {37 where T : class, IDataAnalysisProblemData { 38 38 new IValueParameter<T> ProblemDataParameter { get; } 39 39 new T ProblemData { get; set; } -
stable/HeuristicLab.Problems.DataAnalysis/3.4/Interfaces/IDependencyCalculator.cs
r17181 r17803 22 22 using System; 23 23 using System.Collections.Generic; 24 using HEAL.Attic; 24 25 25 26 namespace HeuristicLab.Problems.DataAnalysis { 27 [StorableType("3283B3FB-8467-4B99-9B6E-23BF3D1B8505")] 26 28 public interface IDependencyCalculator { 27 29 double Maximum { get; } -
stable/HeuristicLab.Problems.DataAnalysis/3.4/Interfaces/IOnlineCalculator.cs
r17181 r17803 22 22 23 23 using System; 24 using HEAL.Attic; 25 24 26 namespace HeuristicLab.Problems.DataAnalysis { 25 27 [Flags] 28 [StorableType("8A28DDA1-4814-4B77-9457-0EE930BE9C73")] 26 29 public enum OnlineCalculatorError { 27 30 /// <summary> … … 38 41 InsufficientElementsAdded = 2 39 42 } 43 44 [StorableType("119C8242-3EE7-4C34-A7AC-68ABF76EB11B")] 40 45 public interface IOnlineCalculator { 41 46 OnlineCalculatorError ErrorState { get; } -
stable/HeuristicLab.Problems.DataAnalysis/3.4/Interfaces/Regression/IRegressionProblemData.cs
r17181 r17803 28 28 string TargetVariable { get; set; } 29 29 30 IntervalCollection VariableRanges { get;} 31 30 32 IEnumerable<double> TargetVariableValues { get; } 31 33 IEnumerable<double> TargetVariableTrainingValues { get; } -
stable/HeuristicLab.Problems.DataAnalysis/3.4/Interfaces/TimeSeriesPrognosis/IOnlineTimeSeriesCalculator.cs
r17181 r17803 22 22 23 23 using System.Collections.Generic; 24 using HEAL.Attic; 24 25 25 26 namespace HeuristicLab.Problems.DataAnalysis { 27 [StorableType("7461AC5D-9D9A-4DCD-B32F-602260E58FFC")] 26 28 public interface IOnlineTimeSeriesCalculator { 27 29 OnlineCalculatorError ErrorState { get; }
Note: See TracChangeset
for help on using the changeset viewer.