- Timestamp:
- 07/08/15 15:32:12 (9 years ago)
- Location:
- branches/HiveStatistics/sources
- Files:
-
- 15 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HiveStatistics/sources
-
branches/HiveStatistics/sources/HeuristicLab.Problems.DataAnalysis
- Property svn:mergeinfo changed
/trunk/sources/HeuristicLab.Problems.DataAnalysis merged: 12612,12641
- Property svn:mergeinfo changed
-
branches/HiveStatistics/sources/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/Classification/DiscriminantFunctionClassificationSolutionBase.cs
r12012 r12689 105 105 TestMeanSquaredError = errorState == OnlineCalculatorError.None ? testMSE : double.NaN; 106 106 107 double trainingR 2 = OnlinePearsonsRSquaredCalculator.Calculate(originalTrainingValues, estimatedTrainingValues, out errorState);108 TrainingRSquared = errorState == OnlineCalculatorError.None ? trainingR 2: double.NaN;109 double testR 2 = OnlinePearsonsRSquaredCalculator.Calculate(originalTestValues, estimatedTestValues, out errorState);110 TestRSquared = errorState == OnlineCalculatorError.None ? testR 2: double.NaN;107 double trainingR = OnlinePearsonsRCalculator.Calculate(originalTrainingValues, estimatedTrainingValues, out errorState); 108 TrainingRSquared = errorState == OnlineCalculatorError.None ? trainingR*trainingR : double.NaN; 109 double testR = OnlinePearsonsRCalculator.Calculate(originalTestValues, estimatedTestValues, out errorState); 110 TestRSquared = errorState == OnlineCalculatorError.None ? testR*testR : double.NaN; 111 111 112 112 double trainingNormalizedGini = NormalizedGiniCalculator.Calculate(originalTrainingValues, estimatedTrainingValues, out errorState); -
branches/HiveStatistics/sources/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/Regression/RegressionSolutionBase.cs
r12586 r12689 229 229 TestMeanAbsoluteError = errorState == OnlineCalculatorError.None ? testMAE : double.NaN; 230 230 231 double trainingR 2 = OnlinePearsonsRSquaredCalculator.Calculate(originalTrainingValues, estimatedTrainingValues, out errorState);232 TrainingRSquared = errorState == OnlineCalculatorError.None ? trainingR 2: double.NaN;233 double testR 2 = OnlinePearsonsRSquaredCalculator.Calculate(originalTestValues, estimatedTestValues, out errorState);234 TestRSquared = errorState == OnlineCalculatorError.None ? testR 2: double.NaN;231 double trainingR = OnlinePearsonsRCalculator.Calculate(originalTrainingValues, estimatedTrainingValues, out errorState); 232 TrainingRSquared = errorState == OnlineCalculatorError.None ? trainingR*trainingR : double.NaN; 233 double testR = OnlinePearsonsRCalculator.Calculate(originalTestValues, estimatedTestValues, out errorState); 234 TestRSquared = errorState == OnlineCalculatorError.None ? testR*testR : double.NaN; 235 235 236 236 double trainingRelError = OnlineMeanAbsolutePercentageErrorCalculator.Calculate(originalTrainingValues, estimatedTrainingValues, out errorState); -
branches/HiveStatistics/sources/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/TimeSeriesPrognosis/TimeSeriesPrognosisResults.cs
r12012 r12689 394 394 double trainingMAE = OnlineMeanAbsoluteErrorCalculator.Calculate(originalTrainingValues, estimatedTrainingValues, out errorState); 395 395 PrognosisTrainingMeanAbsoluteError = errorState == OnlineCalculatorError.None ? trainingMAE : double.NaN; 396 double trainingR 2 = OnlinePearsonsRSquaredCalculator.Calculate(originalTrainingValues, estimatedTrainingValues, out errorState);397 PrognosisTrainingRSquared = errorState == OnlineCalculatorError.None ? trainingR 2: double.NaN;396 double trainingR = OnlinePearsonsRCalculator.Calculate(originalTrainingValues, estimatedTrainingValues, out errorState); 397 PrognosisTrainingRSquared = errorState == OnlineCalculatorError.None ? trainingR*trainingR : double.NaN; 398 398 double trainingRelError = OnlineMeanAbsolutePercentageErrorCalculator.Calculate(originalTrainingValues, estimatedTrainingValues, out errorState); 399 399 PrognosisTrainingRelativeError = errorState == OnlineCalculatorError.None ? trainingRelError : double.NaN; … … 430 430 double testMAE = OnlineMeanAbsoluteErrorCalculator.Calculate(originalTestValues, estimatedTestValues, out errorState); 431 431 PrognosisTestMeanAbsoluteError = errorState == OnlineCalculatorError.None ? testMAE : double.NaN; 432 double testR 2 = OnlinePearsonsRSquaredCalculator.Calculate(originalTestValues, estimatedTestValues, out errorState);433 PrognosisTestRSquared = errorState == OnlineCalculatorError.None ? testR 2: double.NaN;432 double testR = OnlinePearsonsRCalculator.Calculate(originalTestValues, estimatedTestValues, out errorState); 433 PrognosisTestRSquared = errorState == OnlineCalculatorError.None ? testR*testR : double.NaN; 434 434 double testRelError = OnlineMeanAbsolutePercentageErrorCalculator.Calculate(originalTestValues, estimatedTestValues, out errorState); 435 435 PrognosisTestRelativeError = errorState == OnlineCalculatorError.None ? testRelError : double.NaN; -
branches/HiveStatistics/sources/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/Transformations/CopyColumnTransformation.cs
r12012 r12689 29 29 30 30 namespace HeuristicLab.Problems.DataAnalysis { 31 [StorableClass] 31 32 [Item("CopyColumnTransformation", "Represents a transformation which represents a copied Column.")] 32 33 public class CopyColumnTransformation : Transformation { -
branches/HiveStatistics/sources/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/Transformations/ExponentialTransformation.cs
r11114 r12689 1 1 using System; 2 2 using System.Collections.Generic; 3 using System.Linq; 3 4 using HeuristicLab.Common; 4 5 using HeuristicLab.Core; … … 8 9 9 10 namespace HeuristicLab.Problems.DataAnalysis { 11 [StorableClass] 10 12 [Item("Exponential Transformation", "f(x) = b ^ x | Represents a exponential transformation.")] 11 13 public class ExponentialTransformation : Transformation<double> { … … 44 46 45 47 public override IEnumerable<double> Apply(IEnumerable<double> data) { 46 foreach (double d in data) { 47 yield return Math.Pow(Base, d); 48 } 48 return data.Select(d => Math.Pow(Base, d)); 49 49 } 50 50 -
branches/HiveStatistics/sources/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/Transformations/LinearTransformation.cs
r12012 r12689 31 31 32 32 namespace HeuristicLab.Problems.DataAnalysis { 33 [StorableClass] 33 34 [Item("Linear Transformation", "f(x) = k * x + d | Represents a linear transformation with multiplication and addition.")] 34 35 public class LinearTransformation : Transformation<double> { … … 80 81 81 82 public override IEnumerable<double> Apply(IEnumerable<double> data) { 82 return data.Select(e => e * Multiplier + Addend); 83 var m = Multiplier; 84 var a = Addend; 85 return data.Select(e => e * m + a); 83 86 } 84 87 85 88 public override bool Check(IEnumerable<double> data, out string errorMsg) { 86 89 errorMsg = null; 87 if (Multiplier == 0.0) {90 if (Multiplier.IsAlmost(0.0)) { 88 91 errorMsg = String.Format("Multiplicand is 0, all {0} entries will be set to {1}. Inverse apply will not be possible (division by 0).", data.Count(), Addend); 89 92 return false; -
branches/HiveStatistics/sources/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/Transformations/LogarithmicTransformation.cs
r11114 r12689 9 9 10 10 namespace HeuristicLab.Problems.DataAnalysis { 11 [StorableClass] 11 12 [Item("Logarithmic Transformation", "f(x) = log(x, b) | Represents a logarithmic transformation.")] 12 13 public class LogarithmicTransformation : Transformation<double> { … … 43 44 44 45 public override IEnumerable<double> Apply(IEnumerable<double> data) { 45 foreach (double i in data) { 46 if (i > 0.0) 47 yield return Math.Log(i, Base); 48 else 49 yield return i; 50 } 46 var b = Base; 47 return data.Select(d => d > 0.0 ? Math.Log(d, b) : d); 51 48 } 52 49 -
branches/HiveStatistics/sources/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/Transformations/PowerTransformation.cs
r11114 r12689 1 1 using System; 2 2 using System.Collections.Generic; 3 using System.Linq; 3 4 using HeuristicLab.Common; 4 5 using HeuristicLab.Core; … … 8 9 9 10 namespace HeuristicLab.Problems.DataAnalysis { 11 [StorableClass] 10 12 [Item("Power Transformation", "f(x) = x ^ exp | Represents a power transformation.")] 11 13 public class PowerTransformation : Transformation<double> { … … 42 44 43 45 public override IEnumerable<double> Apply(IEnumerable<double> data) { 44 foreach (double i in data) { 45 yield return Math.Pow(i, Exponent); 46 } 46 return data.Select(i => Math.Pow(i, Exponent)); 47 47 } 48 48 -
branches/HiveStatistics/sources/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/Transformations/ReciprocalTransformation.cs
r11114 r12689 7 7 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 8 8 namespace HeuristicLab.Problems.DataAnalysis { 9 [StorableClass] 9 10 [Item("Reciprocal Transformation", "f(x) = 1 / x | Represents a reciprocal transformation.")] 10 11 public class ReciprocalTransformation : Transformation<double> { … … 16 17 #endregion 17 18 18 //TODO: is a special case of Linear19 19 [StorableConstructor] 20 20 protected ReciprocalTransformation(bool deserializing) : base(deserializing) { } … … 31 31 32 32 public override IEnumerable<double> Apply(IEnumerable<double> data) { 33 foreach (double i in data) { 34 if (i > 0.0) 35 yield return 1.0 / i; 36 else 37 yield return i; 38 } 33 return data.Select(d => d > 0 ? 1.0 / d : d); 39 34 } 40 35 -
branches/HiveStatistics/sources/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/Transformations/ShiftStandardDistributionTransformation.cs
r11114 r12689 8 8 9 9 namespace HeuristicLab.Problems.DataAnalysis { 10 [StorableClass] 10 11 [Item("Shift Standard Distribution Transformation", "f(x) = ((x - m_org) / s_org ) * s_tar + m_tar | Represents Transformation to unit standard deviation and additional linear transformation to a target Mean and Standard deviation")] 11 12 public class ShiftStandardDistributionTransformation : Transformation<double> { … … 69 70 } 70 71 71 // http://en.wikipedia.org/wiki/Standard_deviation72 // http://www.statistics4u.info/fundstat_germ/ee_ztransform.html73 // https://www.uni-due.de/~bm0061/vorl12.pdf p574 72 public override IEnumerable<double> Apply(IEnumerable<double> data) { 75 73 ConfigureParameters(data); 76 if (OriginalStandardDeviation == 0.0) { 77 foreach (var e in data) { 78 yield return e; 79 } 80 yield break; 74 if (OriginalStandardDeviation.IsAlmost(0.0)) { 75 return data; 81 76 } 82 83 foreach (var e in data) { 84 double unitNormalDistributedValue = (e - OriginalMean) / OriginalStandardDeviation; 85 yield return unitNormalDistributedValue * StandardDeviation + Mean; 86 } 77 var old_m = OriginalMean; 78 var old_s = OriginalStandardDeviation; 79 var m = Mean; 80 var s = StandardDeviation; 81 return data 82 .Select(d => (d - old_m) / old_s) // standardized 83 .Select(d => d * s + m); 87 84 } 88 85 … … 90 87 ConfigureParameters(data); 91 88 errorMsg = ""; 92 if (OriginalStandardDeviation == 0.0) {89 if (OriginalStandardDeviation.IsAlmost(0.0)) { 93 90 errorMsg = "Standard deviaton for the original data is 0.0, Transformation cannot be applied onto these values."; 94 91 return false; -
branches/HiveStatistics/sources/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/Transformations/ShiftToRangeTransformation.cs
r11114 r12689 8 8 9 9 namespace HeuristicLab.Problems.DataAnalysis { 10 [StorableClass] 10 11 [Item("Shift to Range Transformation", "f(x) = k * x + d, start <= f(x) <= end | Represents a linear Transformation using Parameters defining a target range")] 11 12 public class ShiftToRangeTransformation : LinearTransformation { -
branches/HiveStatistics/sources/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/Transformations/Transformation.cs
r12012 r12689 31 31 32 32 [Item("Transformation", "Represents the base class for a transformation.")] 33 [StorableClass]34 33 public abstract class Transformation : ParameterizedNamedItem, ITransformation { 35 34 protected const string ColumnParameterName = "Column"; -
branches/HiveStatistics/sources/HeuristicLab.Problems.DataAnalysis/3.4/OnlineCalculators/DependencyCalculator/PearsonsRSquaredDependenceCalculator.cs
r12012 r12689 32 32 33 33 public double Calculate(IEnumerable<double> originalValues, IEnumerable<double> estimatedValues, out OnlineCalculatorError errorState) { 34 return OnlinePearsonsRSquaredCalculator.Calculate(originalValues, estimatedValues, out errorState); 34 var r = OnlinePearsonsRCalculator.Calculate(originalValues, estimatedValues, out errorState); 35 return r * r; 35 36 } 36 37 }
Note: See TracChangeset
for help on using the changeset viewer.