Changeset 14348
- Timestamp:
- 10/22/16 11:19:45 (8 years ago)
- Location:
- trunk/sources
- Files:
-
- 2 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified trunk/sources/HeuristicLab.Problems.DataAnalysis.Views/3.4/HeuristicLab.Problems.DataAnalysis.Views-3.4.csproj ¶
r14125 r14348 245 245 <Compile Include="Regression\RegressionFeatureCorrelationView.Designer.cs"> 246 246 <DependentUpon>RegressionFeatureCorrelationView.cs</DependentUpon> 247 </Compile> 248 <Compile Include="Regression\RegressionSolutionVariableImpactsView.cs"> 249 <SubType>UserControl</SubType> 250 </Compile> 251 <Compile Include="Regression\RegressionSolutionVariableImpactsView.Designer.cs"> 252 <DependentUpon>RegressionSolutionVariableImpactsView.cs</DependentUpon> 247 253 </Compile> 248 254 <Compile Include="Regression\RegressionSolutionGradientView.cs"> -
TabularUnified trunk/sources/HeuristicLab.Problems.DataAnalysis.Views/3.4/Solution Views/RegressionSolutionView.Designer.cs ¶
r14185 r14348 46 46 /// </summary> 47 47 private void InitializeComponent() { 48 this.btnImpactCalculation = new System.Windows.Forms.Button();49 48 ((System.ComponentModel.ISupportInitialize)(this.splitContainer)).BeginInit(); 50 49 this.splitContainer.Panel1.SuspendLayout(); … … 54 53 this.detailsGroupBox.SuspendLayout(); 55 54 this.SuspendLayout(); 56 //57 // btnImpactCalculation58 //59 this.btnImpactCalculation.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)));60 this.btnImpactCalculation.Image = HeuristicLab.Common.Resources.VSImageLibrary.Zoom;61 this.btnImpactCalculation.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft;62 this.btnImpactCalculation.Name = "btnImpactCalculation";63 this.btnImpactCalculation.TabIndex = 6;64 this.btnImpactCalculation.Size = new System.Drawing.Size(110, 24);65 this.btnImpactCalculation.Text = "Variable Impacts";66 this.btnImpactCalculation.TextAlign = System.Drawing.ContentAlignment.MiddleRight;67 this.btnImpactCalculation.UseVisualStyleBackColor = true;68 this.btnImpactCalculation.Click += new System.EventHandler(this.btnImpactCalculation_Click);69 this.toolTip.SetToolTip(this.btnImpactCalculation, "Calculate impacts");70 //71 // flowLayoutPanel72 //73 this.flowLayoutPanel.Controls.Add(this.btnImpactCalculation);74 //75 // splitContainer76 //77 //78 55 // itemsGroupBox 79 56 // … … 104 81 105 82 #endregion 106 107 protected System.Windows.Forms.Button btnImpactCalculation;108 83 } 109 84 } -
TabularUnified trunk/sources/HeuristicLab.Problems.DataAnalysis.Views/3.4/Solution Views/RegressionSolutionView.cs ¶
r14185 r14348 20 20 #endregion 21 21 22 using System;23 using System.Linq;24 using System.Threading.Tasks;25 22 using System.Windows.Forms; 26 23 using HeuristicLab.Core; 27 using HeuristicLab.Data;28 using HeuristicLab.Data.Views;29 24 using HeuristicLab.MainForm; 30 using HeuristicLab.MainForm.WindowsForms;31 25 32 26 namespace HeuristicLab.Problems.DataAnalysis.Views { … … 41 35 get { return (RegressionSolutionBase)base.Content; } 42 36 set { base.Content = value; } 43 }44 45 protected override void SetEnabledStateOfControls() {46 base.SetEnabledStateOfControls();47 btnImpactCalculation.Enabled = Content != null && !Locked;48 }49 50 protected virtual void btnImpactCalculation_Click(object sender, EventArgs e) {51 var mainForm = (MainForm.WindowsForms.MainForm)MainFormManager.MainForm;52 var view = new StringConvertibleArrayView();53 view.Caption = Content.Name + " Variable Impacts";54 view.Show();55 56 Task.Factory.StartNew(() => {57 try {58 mainForm.AddOperationProgressToView(view, "Calculating variable impacts for " + Content.Name);59 60 var impacts = RegressionSolutionVariableImpactsCalculator.CalculateImpacts(Content);61 var impactArray = new DoubleArray(impacts.Select(i => i.Item2).ToArray());62 impactArray.ElementNames = impacts.Select(i => i.Item1);63 view.Content = (DoubleArray)impactArray.AsReadOnly();64 }65 finally {66 mainForm.RemoveOperationProgressFromView(view);67 }68 });69 37 } 70 38 -
TabularUnified trunk/sources/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/Regression/RegressionSolutionVariableImpactsCalculator.cs ¶
r13986 r14348 156 156 // new var has same empirical distribution but the relation to y is broken 157 157 rand = new FastRandom(31415); 158 replacementValues = rows.Select(r => originalValues[r]).Shuffle(rand).ToList(); 158 // prepare a complete column for the dataset 159 replacementValues = Enumerable.Repeat(double.NaN, dataset.Rows).ToList(); 160 // shuffle only the selected rows 161 var shuffledValues = rows.Select(r => originalValues[r]).Shuffle(rand).ToList(); 162 int i = 0; 163 // update column values 164 foreach (var r in rows) { 165 replacementValues[r] = shuffledValues[i++]; 166 } 159 167 break; 160 168 case ReplacementMethodEnum.Noise: … … 162 170 var stdDev = rows.Select(r => originalValues[r]).StandardDeviation(); 163 171 rand = new FastRandom(31415); 164 replacementValues = rows.Select(_ => NormalDistributedRandom.NextDouble(rand, avg, stdDev)).ToList(); 172 // prepare a complete column for the dataset 173 replacementValues = Enumerable.Repeat(double.NaN, dataset.Rows).ToList(); 174 // update column values 175 foreach (var r in rows) { 176 replacementValues[r] = NormalDistributedRandom.NextDouble(rand, avg, stdDev); 177 } 165 178 break; 166 179
Note: See TracChangeset
for help on using the changeset viewer.