Changeset 6238 for trunk/sources
- Timestamp:
- 05/20/11 15:07:45 (14 years ago)
- Location:
- trunk/sources
- Files:
-
- 1 added
- 6 deleted
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Problems.DataAnalysis.Views/3.4/HeuristicLab.Problems.DataAnalysis.Views-3.4.csproj
r6184 r6238 158 158 <DependentUpon>ClusteringSolutionView.cs</DependentUpon> 159 159 </Compile> 160 <Compile Include="Interfaces\IRegressionEnsembleSolutionEvaluationView.cs" />161 <Compile Include="RegressionEnsembleSolutionView.cs">162 <SubType>UserControl</SubType>163 </Compile>164 <Compile Include="RegressionEnsembleSolutionView.Designer.cs">165 <DependentUpon>RegressionEnsembleSolutionView.cs</DependentUpon>166 </Compile>167 160 <Compile Include="DiscriminantFunctionClassificationSolutionView.cs"> 168 161 <SubType>UserControl</SubType> … … 193 186 <Compile Include="RegressionSolutionView.Designer.cs"> 194 187 <DependentUpon>RegressionSolutionView.cs</DependentUpon> 195 </Compile>196 <Compile Include="Regression\RegressionEnsembleSolutionLineChartView.cs">197 <SubType>UserControl</SubType>198 </Compile>199 <Compile Include="Regression\RegressionEnsembleSolutionLineChartView.Designer.cs">200 <DependentUpon>RegressionEnsembleSolutionLineChartView.cs</DependentUpon>201 </Compile>202 <Compile Include="Regression\RegressionEnsembleSolutionScatterPlotView.cs">203 <SubType>UserControl</SubType>204 </Compile>205 <Compile Include="Regression\RegressionEnsembleSolutionScatterPlotView.Designer.cs">206 <DependentUpon>RegressionEnsembleSolutionScatterPlotView.cs</DependentUpon>207 188 </Compile> 208 189 <Compile Include="Regression\RegressionSolutionEstimatedValuesView.cs"> -
trunk/sources/HeuristicLab.Problems.DataAnalysis.Views/3.4/Regression/RegressionSolutionEstimatedValuesView.cs
r6058 r6238 32 32 [Content(typeof(IRegressionSolution))] 33 33 public partial class RegressionSolutionEstimatedValuesView : ItemView, IRegressionSolutionEvaluationView { 34 private const string TARGETVARIABLE_SERIES_NAME = "TargetVariable"; 35 private const string ESTIMATEDVALUES_SERIES_NAME = "EstimatedValues"; 34 private const string TARGETVARIABLE_SERIES_NAME = "Target Variable"; 35 private const string ESTIMATEDVALUES_TRAINING_SERIES_NAME = "Estimated Values (training)"; 36 private const string ESTIMATEDVALUES_TEST_SERIES_NAME = "Estimated Values (test)"; 36 37 37 38 public new IRegressionSolution Content { … … 85 86 DoubleMatrix matrix = null; 86 87 if (Content != null) { 87 double[,] values = new double[Content.ProblemData.Dataset.Rows, 4]; 88 double[,] values = new double[Content.ProblemData.Dataset.Rows, 5]; 89 // initialize to double.NaN 90 for (int row = 0; row < Content.ProblemData.Dataset.Rows; row++) 91 for (int column = 0; column < 5; column++) 92 values[row, column] = double.NaN; 88 93 89 94 double[] target = Content.ProblemData.Dataset.GetVariableValues(Content.ProblemData.TargetVariable); 90 double[] estimated = Content.EstimatedValues.ToArray(); 95 var estimated_training = Content.EstimatedTrainingValues.GetEnumerator(); 96 var estimated_test = Content.EstimatedTestValues.GetEnumerator(); 97 98 foreach (var row in Content.ProblemData.TrainingIndizes) { 99 estimated_training.MoveNext(); 100 values[row, 1] = estimated_training.Current; 101 } 102 103 foreach (var row in Content.ProblemData.TestIndizes) { 104 estimated_test.MoveNext(); 105 values[row, 2] = estimated_test.Current; 106 } 107 91 108 for (int row = 0; row < target.Length; row++) { 92 109 values[row, 0] = target[row]; 93 values[row, 1] = estimated[row]; 94 values[row, 2] = Math.Abs(estimated[row] - target[row]); 95 values[row, 3] = Math.Abs(values[row, 2] / target[row]); 110 double est = values[row, 1]; 111 if (!double.IsNaN(est)) { 112 values[row, 3] = Math.Abs(est - target[row]); 113 values[row, 4] = Math.Abs(values[row, 3] / target[row]); 114 } 96 115 } 97 116 98 117 matrix = new DoubleMatrix(values); 99 matrix.ColumnNames = new string[] { TARGETVARIABLE_SERIES_NAME, ESTIMATEDVALUES_ SERIES_NAME, "Absolute Error", "Relative Error" };118 matrix.ColumnNames = new string[] { TARGETVARIABLE_SERIES_NAME, ESTIMATEDVALUES_TRAINING_SERIES_NAME, ESTIMATEDVALUES_TEST_SERIES_NAME, "Absolute Error (training)", "Relative Error (training)" }; 100 119 } 101 120 matrixView.Content = matrix; -
trunk/sources/HeuristicLab.Problems.DataAnalysis.Views/3.4/Regression/RegressionSolutionLineChartView.cs
r5975 r6238 32 32 [Content(typeof(IRegressionSolution))] 33 33 public partial class RegressionSolutionLineChartView : ItemView, IRegressionSolutionEvaluationView { 34 private const string TARGETVARIABLE_SERIES_NAME = "TargetVariable"; 35 private const string ESTIMATEDVALUES_SERIES_NAME = "EstimatedValues"; 34 private const string TARGETVARIABLE_SERIES_NAME = "Target Variable"; 35 private const string ESTIMATEDVALUES_TRAINING_SERIES_NAME = "Estimated Values (training)"; 36 private const string ESTIMATEDVALUES_TEST_SERIES_NAME = "Estimated Values (test)"; 36 37 37 38 public new IRegressionSolution Content { … … 47 48 this.chart.ChartAreas[0].CursorX.IsUserSelectionEnabled = true; 48 49 this.chart.ChartAreas[0].AxisX.ScaleView.Zoomable = true; 50 this.chart.ChartAreas[0].AxisX.IsStartedFromZero = true; 49 51 this.chart.ChartAreas[0].CursorX.Interval = 1; 50 52 … … 57 59 this.chart.Series.Clear(); 58 60 if (Content != null) { 61 this.chart.ChartAreas[0].AxisX.Minimum = 0; 62 this.chart.ChartAreas[0].AxisX.Maximum = Content.ProblemData.Dataset.Rows - 1; 63 59 64 this.chart.Series.Add(TARGETVARIABLE_SERIES_NAME); 60 65 this.chart.Series[TARGETVARIABLE_SERIES_NAME].LegendText = Content.ProblemData.TargetVariable; 61 66 this.chart.Series[TARGETVARIABLE_SERIES_NAME].ChartType = SeriesChartType.FastLine; 62 this.chart.Series[TARGETVARIABLE_SERIES_NAME].Points.DataBindY(Content.ProblemData.Dataset.GetVariableValues(Content.ProblemData.TargetVariable)); 67 this.chart.Series[TARGETVARIABLE_SERIES_NAME].Points.DataBindXY(Enumerable.Range(0, Content.ProblemData.Dataset.Rows).ToArray(), 68 Content.ProblemData.Dataset.GetVariableValues(Content.ProblemData.TargetVariable)); 69 70 this.chart.Series.Add(ESTIMATEDVALUES_TRAINING_SERIES_NAME); 71 this.chart.Series[ESTIMATEDVALUES_TRAINING_SERIES_NAME].LegendText = ESTIMATEDVALUES_TRAINING_SERIES_NAME; 72 this.chart.Series[ESTIMATEDVALUES_TRAINING_SERIES_NAME].ChartType = SeriesChartType.FastLine; 73 this.chart.Series[ESTIMATEDVALUES_TRAINING_SERIES_NAME].Points.DataBindXY(Content.ProblemData.TrainingIndizes.ToArray(), 74 Content.EstimatedTrainingValues.ToArray()); 75 this.chart.Series[ESTIMATEDVALUES_TRAINING_SERIES_NAME].Tag = Content; 76 77 this.chart.Series.Add(ESTIMATEDVALUES_TEST_SERIES_NAME); 78 this.chart.Series[ESTIMATEDVALUES_TEST_SERIES_NAME].LegendText = ESTIMATEDVALUES_TEST_SERIES_NAME; 79 this.chart.Series[ESTIMATEDVALUES_TEST_SERIES_NAME].ChartType = SeriesChartType.FastLine; 80 this.chart.Series[ESTIMATEDVALUES_TEST_SERIES_NAME].Points.DataBindXY(Content.ProblemData.TestIndizes.ToArray(), 81 Content.EstimatedTestValues.ToArray()); 82 this.chart.Series[ESTIMATEDVALUES_TEST_SERIES_NAME].Tag = Content; 83 UpdateCursorInterval(); 63 84 this.UpdateStripLines(); 64 65 this.chart.Series.Add(ESTIMATEDVALUES_SERIES_NAME);66 this.chart.Series[ESTIMATEDVALUES_SERIES_NAME].LegendText = Content.ItemName;67 this.chart.Series[ESTIMATEDVALUES_SERIES_NAME].ChartType = SeriesChartType.FastLine;68 this.chart.Series[ESTIMATEDVALUES_SERIES_NAME].Points.DataBindY(Content.EstimatedValues.ToArray());69 this.chart.Series[ESTIMATEDVALUES_SERIES_NAME].Tag = Content;70 UpdateCursorInterval();71 85 } 72 86 } 73 87 74 88 private void UpdateCursorInterval() { 75 var estimatedValues = this.chart.Series[ESTIMATEDVALUES_ SERIES_NAME].Points.Select(x => x.YValues[0]).DefaultIfEmpty(1.0);89 var estimatedValues = this.chart.Series[ESTIMATEDVALUES_TRAINING_SERIES_NAME].Points.Select(x => x.YValues[0]).DefaultIfEmpty(1.0); 76 90 var targetValues = this.chart.Series[TARGETVARIABLE_SERIES_NAME].Points.Select(x => x.YValues[0]).DefaultIfEmpty(1.0); 77 91 double estimatedValuesRange = estimatedValues.Max() - estimatedValues.Min(); … … 112 126 else { 113 127 if (this.chart.Series.Count > 0) { 114 Series s = this.chart.Series .SingleOrDefault(x => x.Tag == Content);128 Series s = this.chart.Series[ESTIMATEDVALUES_TRAINING_SERIES_NAME]; 115 129 if (s != null) { 116 s.Points.DataBindY(Content.EstimatedValues.ToArray()); 117 s.LegendText = Content.ItemName; 118 this.UpdateStripLines(); 119 UpdateCursorInterval(); 130 s.Points.DataBindXY(Content.ProblemData.TrainingIndizes.ToArray(), Content.EstimatedTrainingValues.ToArray()); 131 s.LegendText = ESTIMATEDVALUES_TRAINING_SERIES_NAME; 120 132 } 133 s = this.chart.Series[ESTIMATEDVALUES_TEST_SERIES_NAME]; 134 if (s != null) { 135 s.Points.DataBindXY(Content.ProblemData.TestIndizes.ToArray(), Content.EstimatedTestValues.ToArray()); 136 s.LegendText = ESTIMATEDVALUES_TEST_SERIES_NAME; 137 } 138 this.UpdateStripLines(); 139 UpdateCursorInterval(); 121 140 } 122 141 } … … 136 155 private void UpdateStripLines() { 137 156 this.chart.ChartAreas[0].AxisX.StripLines.Clear(); 138 this.CreateAndAddStripLine("Training", Color.FromArgb(20, Color.Green), 139 Content.ProblemData.TrainingPartition.Start, 140 Content.ProblemData.TrainingPartition.End); 141 this.CreateAndAddStripLine("Test", Color.FromArgb(20, Color.Red), 142 Content.ProblemData.TestPartition.Start, 143 Content.ProblemData.TestPartition.End); 144 } 145 146 private void CreateAndAddStripLine(string title, Color c, int start, int end) { 157 158 int[] attr = new int[Content.ProblemData.Dataset.Rows + 1]; // add a virtual last row that is again empty to simplify loop further down 159 foreach (var row in Content.ProblemData.TrainingIndizes) { 160 attr[row] += 1; 161 } 162 foreach (var row in Content.ProblemData.TestIndizes) { 163 attr[row] += 2; 164 } 165 int start = 0; 166 int curAttr = attr[start]; 167 for (int row = 0; row < attr.Length; row++) { 168 if (attr[row] != curAttr) { 169 switch (curAttr) { 170 case 0: break; 171 case 1: 172 this.CreateAndAddStripLine("Training", start, row, Color.FromArgb(40, Color.Green), Color.Transparent); 173 break; 174 case 2: 175 this.CreateAndAddStripLine("Test", start, row, Color.FromArgb(40, Color.Red), Color.Transparent); 176 break; 177 case 3: 178 this.CreateAndAddStripLine("Training and Test", start, row, Color.FromArgb(40, Color.Green), Color.FromArgb(40, Color.Red), ChartHatchStyle.WideUpwardDiagonal); 179 break; 180 default: 181 // should not happen 182 break; 183 } 184 curAttr = attr[row]; 185 start = row; 186 } 187 } 188 } 189 190 private void CreateAndAddStripLine(string title, int start, int end, Color color, Color secondColor, ChartHatchStyle hatchStyle = ChartHatchStyle.None) { 147 191 StripLine stripLine = new StripLine(); 148 stripLine.BackColor = c; 192 stripLine.BackColor = color; 193 stripLine.BackSecondaryColor = secondColor; 194 stripLine.BackHatchStyle = hatchStyle; 149 195 stripLine.Text = title; 150 196 stripLine.Font = new Font("Times New Roman", 12, FontStyle.Bold); 151 stripLine.StripWidth = end - start ;197 stripLine.StripWidth = end - start - 1; // strip range is [start .. end] inclusive, but we evaluate [start..end[ (end is exclusive) 152 198 stripLine.IntervalOffset = start; 153 199 this.chart.ChartAreas[0].AxisX.StripLines.Add(stripLine); -
trunk/sources/HeuristicLab.Problems.DataAnalysis.Views/3.4/Regression/RegressionSolutionScatterPlotView.cs
r5975 r6238 139 139 dataset.GetEnumeratedVariableValues(targetVariableName, Content.ProblemData.TestIndizes).ToArray(), ""); 140 140 141 double max = Math.Max(Content.EstimatedValues.Max(), dataset.GetVariableValues(targetVariableName).Max());142 double min = Math.Min(Content.EstimatedValues.Min(), dataset.GetVariableValues(targetVariableName).Min());141 double max = Content.EstimatedTrainingValues.Concat(Content.EstimatedTestValues.Concat(Content.EstimatedValues.Concat(dataset.GetVariableValues(targetVariableName)))).Max(); 142 double min = Content.EstimatedTrainingValues.Concat(Content.EstimatedTestValues.Concat(Content.EstimatedValues.Concat(dataset.GetVariableValues(targetVariableName)))).Min(); 143 143 144 144 max = max + 0.2 * Math.Abs(max); -
trunk/sources/HeuristicLab.Problems.DataAnalysis/3.4/HeuristicLab.Problems.DataAnalysis-3.4.csproj
r6184 r6238 109 109 <ItemGroup> 110 110 <Compile Include="DoubleLimit.cs" /> 111 <Compile Include="Implementation\Classification\ClassificationEnsembleModel.cs">112 <SubType>Code</SubType>113 </Compile>114 111 <Compile Include="Implementation\Classification\ClassificationProblemData.cs" /> 115 112 <Compile Include="Implementation\Classification\ClassificationProblem.cs" /> … … 118 115 <Compile Include="Implementation\Clustering\ClusteringProblemData.cs" /> 119 116 <Compile Include="Implementation\Clustering\ClusteringSolution.cs" /> 117 <Compile Include="Implementation\Regression\RegressionEnsembleProblemData.cs" /> 120 118 <Compile Include="Implementation\Regression\RegressionEnsembleModel.cs"> 121 119 <SubType>Code</SubType> 122 120 </Compile> 123 121 <Compile Include="Implementation\Regression\RegressionEnsembleSolution.cs" /> 124 <Compile Include="Interfaces\Classification\IClassificationEnsembleModel.cs">125 <SubType>Code</SubType>126 </Compile>127 <Compile Include="Interfaces\Classification\IClassificationEnsembleSolution.cs" />128 122 <Compile Include="Interfaces\Classification\IDiscriminantFunctionThresholdCalculator.cs" /> 129 123 <Compile Include="Interfaces\Regression\IRegressionEnsembleModel.cs"> -
trunk/sources/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/DataAnalysisProblemData.cs
r6236 r6238 71 71 } 72 72 73 public IEnumerable<int> TrainingIndizes {73 public virtual IEnumerable<int> TrainingIndizes { 74 74 get { 75 75 return Enumerable.Range(TrainingPartition.Start, TrainingPartition.End - TrainingPartition.Start) … … 77 77 } 78 78 } 79 public IEnumerable<int> TestIndizes {79 public virtual IEnumerable<int> TestIndizes { 80 80 get { 81 81 return Enumerable.Range(TestPartition.Start, TestPartition.End - TestPartition.Start) -
trunk/sources/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/Regression/RegressionEnsembleSolution.cs
r6184 r6238 51 51 } 52 52 public RegressionEnsembleSolution(IEnumerable<IRegressionModel> models, IRegressionProblemData problemData) 53 : base(new RegressionEnsembleModel(models), problemData) {53 : base(new RegressionEnsembleModel(models), new RegressionEnsembleProblemData(problemData)) { 54 54 trainingPartitions = new Dictionary<IRegressionModel, IntRange>(); 55 55 testPartitions = new Dictionary<IRegressionModel, IntRange>(); … … 62 62 63 63 public RegressionEnsembleSolution(IEnumerable<IRegressionModel> models, IRegressionProblemData problemData, IEnumerable<IntRange> trainingPartitions, IEnumerable<IntRange> testPartitions) 64 : base(new RegressionEnsembleModel(models), problemData) {64 : base(new RegressionEnsembleModel(models), new RegressionEnsembleProblemData(problemData)) { 65 65 this.trainingPartitions = new Dictionary<IRegressionModel, IntRange>(); 66 66 this.testPartitions = new Dictionary<IRegressionModel, IntRange>(); … … 75 75 throw new ArgumentException(); 76 76 } 77 78 77 RecalculateResults(); 79 }80 81 private void RecalculateResults() {82 double[] estimatedTrainingValues = EstimatedTrainingValues.ToArray(); // cache values83 var trainingIndizes = Enumerable.Range(ProblemData.TrainingPartition.Start,84 ProblemData.TrainingPartition.End - ProblemData.TrainingPartition.Start);85 IEnumerable<double> originalTrainingValues = ProblemData.Dataset.GetEnumeratedVariableValues(ProblemData.TargetVariable, trainingIndizes);86 double[] estimatedTestValues = EstimatedTestValues.ToArray(); // cache values87 IEnumerable<double> originalTestValues = ProblemData.Dataset.GetEnumeratedVariableValues(ProblemData.TargetVariable, ProblemData.TestIndizes);88 89 OnlineCalculatorError errorState;90 double trainingMSE = OnlineMeanSquaredErrorCalculator.Calculate(estimatedTrainingValues, originalTrainingValues, out errorState);91 TrainingMeanSquaredError = errorState == OnlineCalculatorError.None ? trainingMSE : double.NaN;92 double testMSE = OnlineMeanSquaredErrorCalculator.Calculate(estimatedTestValues, originalTestValues, out errorState);93 TestMeanSquaredError = errorState == OnlineCalculatorError.None ? testMSE : double.NaN;94 95 double trainingR2 = OnlinePearsonsRSquaredCalculator.Calculate(estimatedTrainingValues, originalTrainingValues, out errorState);96 TrainingRSquared = errorState == OnlineCalculatorError.None ? trainingR2 : double.NaN;97 double testR2 = OnlinePearsonsRSquaredCalculator.Calculate(estimatedTestValues, originalTestValues, out errorState);98 TestRSquared = errorState == OnlineCalculatorError.None ? testR2 : double.NaN;99 100 double trainingRelError = OnlineMeanAbsolutePercentageErrorCalculator.Calculate(estimatedTrainingValues, originalTrainingValues, out errorState);101 TrainingRelativeError = errorState == OnlineCalculatorError.None ? trainingRelError : double.NaN;102 double testRelError = OnlineMeanAbsolutePercentageErrorCalculator.Calculate(estimatedTestValues, originalTestValues, out errorState);103 TestRelativeError = errorState == OnlineCalculatorError.None ? testRelError : double.NaN;104 105 double trainingNMSE = OnlineNormalizedMeanSquaredErrorCalculator.Calculate(estimatedTrainingValues, originalTrainingValues, out errorState);106 TrainingNormalizedMeanSquaredError = errorState == OnlineCalculatorError.None ? trainingNMSE : double.NaN;107 double testNMSE = OnlineNormalizedMeanSquaredErrorCalculator.Calculate(estimatedTestValues, originalTestValues, out errorState);108 TestNormalizedMeanSquaredError = errorState == OnlineCalculatorError.None ? testNMSE : double.NaN;109 78 } 110 79 … … 115 84 public override IEnumerable<double> EstimatedTrainingValues { 116 85 get { 117 var rows = Enumerable.Range(ProblemData.TrainingPartition.Start, ProblemData.TrainingPartition.End - ProblemData.TrainingPartition.Start);86 var rows = ProblemData.TrainingIndizes; 118 87 var estimatedValuesEnumerators = (from model in Model.Models 119 88 select new { Model = model, EstimatedValuesEnumerator = model.GetEstimatedValues(ProblemData.Dataset, rows).GetEnumerator() }) 120 89 .ToList(); 121 90 var rowsEnumerator = rows.GetEnumerator(); 91 // aggregate to make sure that MoveNext is called for all enumerators 122 92 while (rowsEnumerator.MoveNext() & estimatedValuesEnumerators.Select(en => en.EstimatedValuesEnumerator.MoveNext()).Aggregate(true, (acc, b) => acc & b)) { 123 93 int currentRow = rowsEnumerator.Current; … … 134 104 public override IEnumerable<double> EstimatedTestValues { 135 105 get { 106 var rows = ProblemData.TestIndizes; 136 107 var estimatedValuesEnumerators = (from model in Model.Models 137 select new { Model = model, EstimatedValuesEnumerator = model.GetEstimatedValues(ProblemData.Dataset, ProblemData.TestIndizes).GetEnumerator() })108 select new { Model = model, EstimatedValuesEnumerator = model.GetEstimatedValues(ProblemData.Dataset, rows).GetEnumerator() }) 138 109 .ToList(); 139 110 var rowsEnumerator = ProblemData.TestIndizes.GetEnumerator(); 111 // aggregate to make sure that MoveNext is called for all enumerators 140 112 while (rowsEnumerator.MoveNext() & estimatedValuesEnumerators.Select(en => en.EstimatedValuesEnumerator.MoveNext()).Aggregate(true, (acc, b) => acc & b)) { 141 113 int currentRow = rowsEnumerator.Current; … … 168 140 169 141 private double AggregateEstimatedValues(IEnumerable<double> estimatedValues) { 170 return estimatedValues. Average();142 return estimatedValues.DefaultIfEmpty(double.NaN).Average(); 171 143 } 172 144 -
trunk/sources/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/Regression/RegressionProblemData.cs
r5809 r6238 33 33 [StorableClass] 34 34 [Item("RegressionProblemData", "Represents an item containing all data defining a regression problem.")] 35 public sealedclass RegressionProblemData : DataAnalysisProblemData, IRegressionProblemData {35 public class RegressionProblemData : DataAnalysisProblemData, IRegressionProblemData { 36 36 private const string TargetVariableParameterName = "TargetVariable"; 37 37 … … 85 85 86 86 [StorableConstructor] 87 pr ivateRegressionProblemData(bool deserializing) : base(deserializing) { }87 protected RegressionProblemData(bool deserializing) : base(deserializing) { } 88 88 [StorableHook(HookType.AfterDeserialization)] 89 89 private void AfterDeserialization() { … … 92 92 93 93 94 pr ivateRegressionProblemData(RegressionProblemData original, Cloner cloner)94 protected RegressionProblemData(RegressionProblemData original, Cloner cloner) 95 95 : base(original, cloner) { 96 96 RegisterParameterEvents(); -
trunk/sources/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/Regression/RegressionSolution.cs
r6184 r6238 55 55 public double TrainingMeanSquaredError { 56 56 get { return ((DoubleValue)this[TrainingMeanSquaredErrorResultName].Value).Value; } 57 pr otectedset { ((DoubleValue)this[TrainingMeanSquaredErrorResultName].Value).Value = value; }57 private set { ((DoubleValue)this[TrainingMeanSquaredErrorResultName].Value).Value = value; } 58 58 } 59 59 60 60 public double TestMeanSquaredError { 61 61 get { return ((DoubleValue)this[TestMeanSquaredErrorResultName].Value).Value; } 62 pr otectedset { ((DoubleValue)this[TestMeanSquaredErrorResultName].Value).Value = value; }62 private set { ((DoubleValue)this[TestMeanSquaredErrorResultName].Value).Value = value; } 63 63 } 64 64 65 65 public double TrainingRSquared { 66 66 get { return ((DoubleValue)this[TrainingSquaredCorrelationResultName].Value).Value; } 67 pr otectedset { ((DoubleValue)this[TrainingSquaredCorrelationResultName].Value).Value = value; }67 private set { ((DoubleValue)this[TrainingSquaredCorrelationResultName].Value).Value = value; } 68 68 } 69 69 70 70 public double TestRSquared { 71 71 get { return ((DoubleValue)this[TestSquaredCorrelationResultName].Value).Value; } 72 pr otectedset { ((DoubleValue)this[TestSquaredCorrelationResultName].Value).Value = value; }72 private set { ((DoubleValue)this[TestSquaredCorrelationResultName].Value).Value = value; } 73 73 } 74 74 75 75 public double TrainingRelativeError { 76 76 get { return ((DoubleValue)this[TrainingRelativeErrorResultName].Value).Value; } 77 pr otectedset { ((DoubleValue)this[TrainingRelativeErrorResultName].Value).Value = value; }77 private set { ((DoubleValue)this[TrainingRelativeErrorResultName].Value).Value = value; } 78 78 } 79 79 80 80 public double TestRelativeError { 81 81 get { return ((DoubleValue)this[TestRelativeErrorResultName].Value).Value; } 82 pr otectedset { ((DoubleValue)this[TestRelativeErrorResultName].Value).Value = value; }82 private set { ((DoubleValue)this[TestRelativeErrorResultName].Value).Value = value; } 83 83 } 84 84 85 85 public double TrainingNormalizedMeanSquaredError { 86 86 get { return ((DoubleValue)this[TrainingNormalizedMeanSquaredErrorResultName].Value).Value; } 87 pr otectedset { ((DoubleValue)this[TrainingNormalizedMeanSquaredErrorResultName].Value).Value = value; }87 private set { ((DoubleValue)this[TrainingNormalizedMeanSquaredErrorResultName].Value).Value = value; } 88 88 } 89 89 90 90 public double TestNormalizedMeanSquaredError { 91 91 get { return ((DoubleValue)this[TestNormalizedMeanSquaredErrorResultName].Value).Value; } 92 pr otectedset { ((DoubleValue)this[TestNormalizedMeanSquaredErrorResultName].Value).Value = value; }92 private set { ((DoubleValue)this[TestNormalizedMeanSquaredErrorResultName].Value).Value = value; } 93 93 } 94 94 … … 126 126 } 127 127 128 pr ivatevoid RecalculateResults() {128 protected void RecalculateResults() { 129 129 double[] estimatedTrainingValues = EstimatedTrainingValues.ToArray(); // cache values 130 130 IEnumerable<double> originalTrainingValues = ProblemData.Dataset.GetEnumeratedVariableValues(ProblemData.TargetVariable, ProblemData.TrainingIndizes);
Note: See TracChangeset
for help on using the changeset viewer.