Changeset 13788 for branches/HeuristicLab.VariableInteractionNetworks
- Timestamp:
- 04/24/16 20:30:20 (9 years ago)
- Location:
- branches/HeuristicLab.VariableInteractionNetworks/HeuristicLab.VariableInteractionNetworks/3.3
- Files:
-
- 1 added
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.VariableInteractionNetworks/HeuristicLab.VariableInteractionNetworks/3.3/CreateTargetVariationExperimentDialog.Designer.cs
r12320 r13788 29 29 private void InitializeComponent() 30 30 { 31 this.repetitionsNumericUpDown = new System.Windows.Forms.NumericUpDown(); 32 this.repetitionsLabel = new System.Windows.Forms.Label(); 33 this.cancelButton = new System.Windows.Forms.Button(); 34 this.okButton = new System.Windows.Forms.Button(); 35 ((System.ComponentModel.ISupportInitialize)(this.repetitionsNumericUpDown)).BeginInit(); 36 this.SuspendLayout(); 37 // 38 // repetitionsNumericUpDown 39 // 40 this.repetitionsNumericUpDown.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 31 this.repetitionsNumericUpDown = new System.Windows.Forms.NumericUpDown(); 32 this.repetitionsLabel = new System.Windows.Forms.Label(); 33 this.cancelButton = new System.Windows.Forms.Button(); 34 this.okButton = new System.Windows.Forms.Button(); 35 this.binomialCoeffNumericUpDown = new System.Windows.Forms.NumericUpDown(); 36 this.label1 = new System.Windows.Forms.Label(); 37 this.label2 = new System.Windows.Forms.Label(); 38 ((System.ComponentModel.ISupportInitialize)(this.repetitionsNumericUpDown)).BeginInit(); 39 ((System.ComponentModel.ISupportInitialize)(this.binomialCoeffNumericUpDown)).BeginInit(); 40 this.SuspendLayout(); 41 // 42 // repetitionsNumericUpDown 43 // 44 this.repetitionsNumericUpDown.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 41 45 | System.Windows.Forms.AnchorStyles.Right))); 42 this.repetitionsNumericUpDown.Location = new System.Drawing.Point(108, 12);43 46 this.repetitionsNumericUpDown.Location = new System.Drawing.Point(128, 12); 47 this.repetitionsNumericUpDown.Maximum = new decimal(new int[] { 44 48 1000000, 45 49 0, 46 50 0, 47 51 0}); 48 52 this.repetitionsNumericUpDown.Minimum = new decimal(new int[] { 49 53 1, 50 54 0, 51 55 0, 52 56 0}); 53 54 55 56 57 57 this.repetitionsNumericUpDown.Name = "repetitionsNumericUpDown"; 58 this.repetitionsNumericUpDown.Size = new System.Drawing.Size(185, 20); 59 this.repetitionsNumericUpDown.TabIndex = 4; 60 this.repetitionsNumericUpDown.ThousandsSeparator = true; 61 this.repetitionsNumericUpDown.Value = new decimal(new int[] { 58 62 10, 59 63 0, 60 64 0, 61 65 0}); 62 this.repetitionsNumericUpDown.Validated += new System.EventHandler(this.repetitionsNumericUpDown_Validated); 63 // 64 // repetitionsLabel 65 // 66 this.repetitionsLabel.AutoSize = true; 67 this.repetitionsLabel.Location = new System.Drawing.Point(26, 14); 68 this.repetitionsLabel.Name = "repetitionsLabel"; 69 this.repetitionsLabel.Size = new System.Drawing.Size(63, 13); 70 this.repetitionsLabel.TabIndex = 5; 71 this.repetitionsLabel.Text = "&Repetitions:"; 72 // 73 // cancelButton 74 // 75 this.cancelButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); 76 this.cancelButton.DialogResult = System.Windows.Forms.DialogResult.Cancel; 77 this.cancelButton.Location = new System.Drawing.Point(177, 48); 78 this.cancelButton.Name = "cancelButton"; 79 this.cancelButton.Size = new System.Drawing.Size(75, 23); 80 this.cancelButton.TabIndex = 9; 81 this.cancelButton.Text = "&Cancel"; 82 this.cancelButton.UseVisualStyleBackColor = true; 83 // 84 // okButton 85 // 86 this.okButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); 87 this.okButton.DialogResult = System.Windows.Forms.DialogResult.Cancel; 88 this.okButton.Location = new System.Drawing.Point(80, 48); 89 this.okButton.Name = "okButton"; 90 this.okButton.Size = new System.Drawing.Size(75, 23); 91 this.okButton.TabIndex = 10; 92 this.okButton.Text = "&Ok"; 93 this.okButton.UseVisualStyleBackColor = true; 94 this.okButton.Click += new System.EventHandler(this.okButton_Click); 95 // 96 // CreateTargetVariationExperimentDialog 97 // 98 this.AcceptButton = this.okButton; 99 this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); 100 this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 101 this.CancelButton = this.cancelButton; 102 this.ClientSize = new System.Drawing.Size(349, 83); 103 this.Controls.Add(this.okButton); 104 this.Controls.Add(this.cancelButton); 105 this.Controls.Add(this.repetitionsLabel); 106 this.Controls.Add(this.repetitionsNumericUpDown); 107 this.Name = "CreateTargetVariationExperimentDialog"; 108 this.Text = "Create Target Variation Experiment"; 109 ((System.ComponentModel.ISupportInitialize)(this.repetitionsNumericUpDown)).EndInit(); 110 this.ResumeLayout(false); 111 this.PerformLayout(); 66 this.repetitionsNumericUpDown.Validated += new System.EventHandler(this.repetitionsNumericUpDown_Validated); 67 // 68 // repetitionsLabel 69 // 70 this.repetitionsLabel.AutoSize = true; 71 this.repetitionsLabel.Location = new System.Drawing.Point(26, 14); 72 this.repetitionsLabel.Name = "repetitionsLabel"; 73 this.repetitionsLabel.Size = new System.Drawing.Size(63, 13); 74 this.repetitionsLabel.TabIndex = 5; 75 this.repetitionsLabel.Text = "&Repetitions:"; 76 // 77 // cancelButton 78 // 79 this.cancelButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); 80 this.cancelButton.DialogResult = System.Windows.Forms.DialogResult.Cancel; 81 this.cancelButton.Location = new System.Drawing.Point(177, 130); 82 this.cancelButton.Name = "cancelButton"; 83 this.cancelButton.Size = new System.Drawing.Size(75, 23); 84 this.cancelButton.TabIndex = 9; 85 this.cancelButton.Text = "&Cancel"; 86 this.cancelButton.UseVisualStyleBackColor = true; 87 // 88 // okButton 89 // 90 this.okButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); 91 this.okButton.DialogResult = System.Windows.Forms.DialogResult.Cancel; 92 this.okButton.Location = new System.Drawing.Point(80, 130); 93 this.okButton.Name = "okButton"; 94 this.okButton.Size = new System.Drawing.Size(75, 23); 95 this.okButton.TabIndex = 10; 96 this.okButton.Text = "&Ok"; 97 this.okButton.UseVisualStyleBackColor = true; 98 this.okButton.Click += new System.EventHandler(this.okButton_Click); 99 // 100 // binomialCoeffNumericUpDown 101 // 102 this.binomialCoeffNumericUpDown.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 103 | System.Windows.Forms.AnchorStyles.Right))); 104 this.binomialCoeffNumericUpDown.Location = new System.Drawing.Point(128, 38); 105 this.binomialCoeffNumericUpDown.Maximum = new decimal(new int[] { 106 1000000, 107 0, 108 0, 109 0}); 110 this.binomialCoeffNumericUpDown.Minimum = new decimal(new int[] { 111 1, 112 0, 113 0, 114 0}); 115 this.binomialCoeffNumericUpDown.Name = "binomialCoeffNumericUpDown"; 116 this.binomialCoeffNumericUpDown.Size = new System.Drawing.Size(185, 20); 117 this.binomialCoeffNumericUpDown.TabIndex = 4; 118 this.binomialCoeffNumericUpDown.ThousandsSeparator = true; 119 this.binomialCoeffNumericUpDown.Value = new decimal(new int[] { 120 10, 121 0, 122 0, 123 0}); 124 this.binomialCoeffNumericUpDown.Validated += new System.EventHandler(this.binomialCoefficientNumericUpDown_Validated); 125 // 126 // label1 127 // 128 this.label1.AutoSize = true; 129 this.label1.Location = new System.Drawing.Point(26, 40); 130 this.label1.Name = "label1"; 131 this.label1.Size = new System.Drawing.Size(79, 13); 132 this.label1.TabIndex = 5; 133 this.label1.Text = "&Binomial coeff.:"; 134 // 135 // label2 136 // 137 this.label2.ForeColor = System.Drawing.Color.Red; 138 this.label2.Location = new System.Drawing.Point(26, 67); 139 this.label2.Name = "label2"; 140 this.label2.Size = new System.Drawing.Size(287, 50); 141 this.label2.TabIndex = 5; 142 this.label2.Text = "Warning: depending on the binomial coefficient and the number of variables, this " + 143 "can create very large experiments. "; 144 // 145 // CreateTargetVariationExperimentDialog 146 // 147 this.AcceptButton = this.okButton; 148 this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); 149 this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 150 this.CancelButton = this.cancelButton; 151 this.ClientSize = new System.Drawing.Size(349, 165); 152 this.Controls.Add(this.okButton); 153 this.Controls.Add(this.cancelButton); 154 this.Controls.Add(this.label2); 155 this.Controls.Add(this.label1); 156 this.Controls.Add(this.repetitionsLabel); 157 this.Controls.Add(this.binomialCoeffNumericUpDown); 158 this.Controls.Add(this.repetitionsNumericUpDown); 159 this.Name = "CreateTargetVariationExperimentDialog"; 160 this.Text = "Create Target Variation Experiment"; 161 ((System.ComponentModel.ISupportInitialize)(this.repetitionsNumericUpDown)).EndInit(); 162 ((System.ComponentModel.ISupportInitialize)(this.binomialCoeffNumericUpDown)).EndInit(); 163 this.ResumeLayout(false); 164 this.PerformLayout(); 112 165 113 166 } … … 119 172 private System.Windows.Forms.Button cancelButton; 120 173 private System.Windows.Forms.Button okButton; 121 } 174 private System.Windows.Forms.NumericUpDown binomialCoeffNumericUpDown; 175 private System.Windows.Forms.Label label1; 176 private System.Windows.Forms.Label label2; 177 } 122 178 } -
branches/HeuristicLab.VariableInteractionNetworks/HeuristicLab.VariableInteractionNetworks/3.3/CreateTargetVariationExperimentDialog.cs
r13664 r13788 21 21 22 22 using System; 23 using System.Collections.Generic; 23 24 using System.Linq; 24 25 using System.Windows.Forms; … … 31 32 public Experiment Experiment { get; private set; } 32 33 private int repetitions; 34 private int binomialCoefficient; 33 35 34 36 public CreateTargetVariationExperimentDialog() : this(null) { } … … 47 49 } 48 50 51 private void binomialCoefficientNumericUpDown_Validated(object sender, EventArgs e) { 52 if (binomialCoeffNumericUpDown.Text == string.Empty) 53 binomialCoeffNumericUpDown.Text = binomialCoeffNumericUpDown.Value.ToString(); 54 binomialCoefficient = (int)binomialCoeffNumericUpDown.Value; 55 } 56 49 57 public Experiment CreateVariableCombinations(IAlgorithm algorithm) { 50 58 var experiment = new Experiment("Target Variation Experiment"); … … 61 69 62 70 for (int i = 0; i < variables.Count; i++) { 63 var alg = (IAlgorithm)algorithm.Clone(); 64 var pd = ((IRegressionProblem)alg.Problem).ProblemData; 71 var target = variables[i]; 72 var inputs = variables.Where(x => x != target).ToList(); 73 var combinations = Util.Combinations(inputs, binomialCoefficient); 65 74 66 for (int j = 0; j < variables.Count; ++j) 67 pd.InputVariables.SetItemCheckedState(pd.InputVariables[j], true); 75 foreach (var combination in combinations) { 76 var h = new HashSet<string>(combination); 77 var alg = (IAlgorithm)algorithm.Clone(); 78 var pd = ((IRegressionProblem)alg.Problem).ProblemData; 79 pd.TargetVariable = target; 80 alg.Name += "{Target = " + target + ", Inputs = (" + combination.Aggregate((a, b) => a + "," + b) + ")}"; 68 81 69 pd.InputVariables.SetItemCheckedState(pd.InputVariables[i], false); 70 pd.TargetVariable = pd.InputVariables[i].Value; 82 foreach (var item in pd.InputVariables) { 83 pd.InputVariables.SetItemCheckedState(item, h.Contains(item.Value)); 84 } 71 85 72 alg.Name += "{Target = " + pd.TargetVariable + "}"; 86 var batchrun = new BatchRun(string.Format("Batchrun {0}", i + 1)) { 87 Repetitions = repetitions, 88 Optimizer = alg 89 }; 73 90 74 var batchrun = new BatchRun(string.Format("Batchrun {0}", i + 1)) { 75 Repetitions = repetitions, 76 Optimizer = alg 77 }; 78 79 experiment.Optimizers.Add(batchrun); 91 experiment.Optimizers.Add(batchrun); 92 } 80 93 } 81 94 return experiment;
Note: See TracChangeset
for help on using the changeset viewer.