Changeset 4112
- Timestamp:
- 07/27/10 14:36:27 (14 years ago)
- Location:
- trunk/sources
- Files:
-
- 9 edited
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Problems.DataAnalysis.MultiVariate.Regression/3.3/Symbolic/Analyzer/ValidationBestScaledSymbolicVectorRegressionSolutionAnalyzer.cs
r4068 r4112 145 145 if (Alpha.Length == trees.Length) { 146 146 scaledTrees = from i in Enumerable.Range(0, trees.Length) 147 select SymbolicVectorRegressionSolutionLinearScaler.Scale(trees[i], Alpha[i].ToArray(), Beta[i].ToArray());147 select SymbolicVectorRegressionSolutionLinearScaler.Scale(trees[i], Beta[i].ToArray(), Alpha[i].ToArray()); 148 148 } else { 149 149 scaledTrees = trees; -
trunk/sources/HeuristicLab.Problems.DataAnalysis.MultiVariate.Regression/3.3/Symbolic/Evaluators/SymbolicRegressionNormalizedMeanSquaredErrorEvaluator.cs
r4068 r4112 65 65 66 66 public static double Calculate(ISymbolicExpressionTreeInterpreter interpreter, SymbolicExpressionTree solution, double lowerEstimationLimit, double upperEstimationLimit, Dataset dataset, string targetVariable, IEnumerable<int> rows) { 67 int targetVariableIndex = dataset.GetVariableIndex(targetVariable); 68 var estimatedValues = interpreter.GetSymbolicExpressionTreeValues(solution, dataset, rows); 69 var originalValues = dataset.GetEnumeratedVariableValues(targetVariableIndex, rows); 70 IEnumerator<double> originalEnumerator = originalValues.GetEnumerator(); 71 IEnumerator<double> estimatedEnumerator = estimatedValues.GetEnumerator(); 72 OnlineNormalizedMeanSquaredErrorEvaluator mseEvaluator = new OnlineNormalizedMeanSquaredErrorEvaluator(); 73 74 while (originalEnumerator.MoveNext() & estimatedEnumerator.MoveNext()) { 75 double estimated = estimatedEnumerator.Current; 76 double original = originalEnumerator.Current; 77 if (double.IsNaN(estimated)) 78 estimated = upperEstimationLimit; 79 else 80 estimated = Math.Min(upperEstimationLimit, Math.Max(lowerEstimationLimit, estimated)); 81 mseEvaluator.Add(original, estimated); 82 } 83 84 if (estimatedEnumerator.MoveNext() || originalEnumerator.MoveNext()) { 85 throw new ArgumentException("Number of elements in original and estimated enumeration doesn't match."); 86 } else { 87 return mseEvaluator.NormalizedMeanSquaredError; 88 } 67 return SymbolicRegressionScaledNormalizedMeanSquaredErrorEvaluator.CalculateWithScaling(interpreter, solution, lowerEstimationLimit, upperEstimationLimit, dataset, targetVariable, rows, 1.0, 0.0); 89 68 } 90 69 } -
trunk/sources/HeuristicLab.Problems.DataAnalysis.MultiVariate.Regression/3.3/Symbolic/Evaluators/SymbolicVectorRegressionNormalizedMseEvaluator.cs
r4068 r4112 73 73 tree.Root.SubTrees[0].AddSubTree(treeNode); 74 74 } 75 return nmseSum / targetVariablesList.Count;75 return nmseSum; 76 76 } 77 77 } -
trunk/sources/HeuristicLab.Problems.DataAnalysis.MultiVariate.Regression/3.3/Symbolic/Evaluators/SymbolicVectorRegressionScaledMseEvaluator.cs
r4068 r4112 75 75 double mse = SymbolicRegressionScaledMeanSquaredErrorEvaluator.Calculate(interpreter, tree, 76 76 lowerEstimationBound[i], upperEstimationBound[i], 77 problemData.Dataset, targetVariablesList[i], rows, out comp Alpha, out compBeta);77 problemData.Dataset, targetVariablesList[i], rows, out compBeta, out compAlpha); 78 78 79 79 qualities[i] = mse; -
trunk/sources/HeuristicLab.Problems.DataAnalysis.MultiVariate.Regression/3.3/Symbolic/Evaluators/SymbolicVectorRegressionScaledNormalizedMseEvaluator.cs
r4087 r4112 87 87 AlphaParameter.ActualValue = alpha; 88 88 BetaParameter.ActualValue = beta; 89 QualityParameter.ActualValue = new DoubleValue(nmseSum / targetVariables.Count());89 QualityParameter.ActualValue = new DoubleValue(nmseSum); 90 90 } 91 91 } -
trunk/sources/HeuristicLab.Problems.DataAnalysis.MultiVariate.Regression/3.3/Symbolic/SymbolicVectorRegressionSolutionLinearScaler.cs
r4068 r4112 68 68 DoubleArray beta = BetaParameter.ActualValue; 69 69 if (alpha != null && beta != null) { 70 ScaledSymbolicExpressionTreeParameter.ActualValue = Scale(tree, alpha.ToArray(), beta.ToArray());70 ScaledSymbolicExpressionTreeParameter.ActualValue = Scale(tree, beta.ToArray(), alpha.ToArray()); 71 71 } else { 72 72 // alpha or beta parameter not available => do not scale tree … … 77 77 } 78 78 79 public static SymbolicExpressionTree Scale(SymbolicExpressionTree original, double[] alpha, double[] beta) {79 public static SymbolicExpressionTree Scale(SymbolicExpressionTree original, double[] beta, double[] alpha) { 80 80 List<SymbolicExpressionTreeNode> resultProducingBranches = new List<SymbolicExpressionTreeNode>(original.Root.SubTrees[0].SubTrees); 81 81 // remove the main branch before cloning to prevent cloning of sub-trees -
trunk/sources/HeuristicLab.Problems.DataAnalysis.MultiVariate/3.3/MultiVariateDataAnalysisProblem.cs
r4098 r4112 51 51 52 52 [StorableConstructor] 53 pr ivate MultiVariateDataAnalysisProblem(bool deserializing) : base() { }53 protected MultiVariateDataAnalysisProblem(bool deserializing) : base(deserializing) { } 54 54 public MultiVariateDataAnalysisProblem() 55 55 : base() { -
trunk/sources/HeuristicLab.Problems.DataAnalysis.Regression/3.3/HeuristicLab.Problems.DataAnalysis.Regression-3.3.csproj
r4065 r4112 115 115 <Compile Include="LinearRegression\LinearRegressionSolutionCreator.cs" /> 116 116 <Compile Include="LinearRegression\LinearRegressionUtil.cs" /> 117 <Compile Include="RandomEnumerable.cs" />118 117 <Compile Include="Properties\AssemblyInfo.cs" /> 119 118 <Compile Include="SupportVectorRegression\BestSupportVectorRegressionSolutionAnalyzer.cs" /> -
trunk/sources/HeuristicLab.Problems.DataAnalysis/3.3/HeuristicLab.Problems.DataAnalysis-3.3.csproj
r4065 r4112 135 135 <Compile Include="Operators\WeightedParentsQualityVarianceComparator.cs" /> 136 136 <Compile Include="Properties\AssemblyInfo.cs" /> 137 <Compile Include="RandomEnumerable.cs" /> 137 138 <Compile Include="SupportVectorMachine\ParameterAdjustmentProblem\SupportVectorMachineParameterAdjustmentBestSolutionAnalyzer.cs" /> 138 139 <Compile Include="SupportVectorMachine\ParameterAdjustmentProblem\SupportVectorMachineParameterAdjustmentEvaluator.cs" /> -
trunk/sources/HeuristicLab.Problems.DataAnalysis/3.3/RandomEnumerable.cs
r4105 r4112 24 24 using HeuristicLab.Random; 25 25 26 namespace HeuristicLab.Problems.DataAnalysis .Regression{26 namespace HeuristicLab.Problems.DataAnalysis { 27 27 public class RandomEnumerable { 28 28 public static IEnumerable<int> SampleRandomNumbers(int maxElement, int count) {
Note: See TracChangeset
for help on using the changeset viewer.