Changeset 14538
- Timestamp:
- 01/03/17 23:04:56 (8 years ago)
- Location:
- branches/HeuristicLab.DatastreamAnalysis
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.DatastreamAnalysis/HeuristicLab.DatastreamAnalysis.Views/3.4/DatastreamAnalysisOptimizerView.Designer.cs
r14536 r14538 43 43 // startButton 44 44 // 45 this.startButton.Location = new System.Drawing.Point(6, 636); 45 this.startButton.Location = new System.Drawing.Point(9, 978); 46 this.startButton.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); 47 this.startButton.Size = new System.Drawing.Size(36, 37); 46 48 this.toolTip.SetToolTip(this.startButton, "Start/Resume Optimizer"); 47 49 // 48 50 // executionTimeTextBox 49 51 // 50 this.executionTimeTextBox.Location = new System.Drawing.Point(936, 640); 52 this.executionTimeTextBox.Location = new System.Drawing.Point(1404, 985); 53 this.executionTimeTextBox.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); 54 this.executionTimeTextBox.Size = new System.Drawing.Size(204, 26); 51 55 // 52 56 // executionTimeLabel 53 57 // 54 this.executionTimeLabel.Location = new System.Drawing.Point(847, 643); 58 this.executionTimeLabel.Location = new System.Drawing.Point(1270, 989); 59 this.executionTimeLabel.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); 55 60 // 56 61 // pauseButton 57 62 // 58 this.pauseButton.Location = new System.Drawing.Point(36, 636); 63 this.pauseButton.Location = new System.Drawing.Point(54, 978); 64 this.pauseButton.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); 65 this.pauseButton.Size = new System.Drawing.Size(36, 37); 59 66 this.toolTip.SetToolTip(this.pauseButton, "Pause Optimizer"); 60 67 // 61 68 // stopButton 62 69 // 63 this.stopButton.Location = new System.Drawing.Point(66, 636); 70 this.stopButton.Location = new System.Drawing.Point(99, 978); 71 this.stopButton.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); 72 this.stopButton.Size = new System.Drawing.Size(36, 37); 64 73 this.toolTip.SetToolTip(this.stopButton, "Stop Optimizer"); 65 74 // 66 75 // resetButton 67 76 // 68 this.resetButton.Location = new System.Drawing.Point(96, 636); 77 this.resetButton.Location = new System.Drawing.Point(144, 978); 78 this.resetButton.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); 79 this.resetButton.Size = new System.Drawing.Size(36, 37); 69 80 this.toolTip.SetToolTip(this.resetButton, "Reset Optimizer"); 70 81 // … … 73 84 this.errorProvider.SetIconAlignment(this.nameTextBox, System.Windows.Forms.ErrorIconAlignment.MiddleLeft); 74 85 this.errorProvider.SetIconPadding(this.nameTextBox, 2); 75 this.nameTextBox.Size = new System.Drawing.Size(1008, 20); 86 this.nameTextBox.Location = new System.Drawing.Point(87, 0); 87 this.nameTextBox.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); 88 this.nameTextBox.Size = new System.Drawing.Size(1510, 26); 89 // 90 // nameLabel 91 // 92 this.nameLabel.Location = new System.Drawing.Point(4, 5); 93 this.nameLabel.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); 76 94 // 77 95 // infoLabel 78 96 // 79 this.infoLabel.Location = new System.Drawing.Point(995, 3); 97 this.infoLabel.Location = new System.Drawing.Point(1492, 5); 98 this.infoLabel.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); 99 this.infoLabel.Size = new System.Drawing.Size(24, 25); 80 100 // 81 101 // tabControl 82 102 // 83 103 this.tabControl.AllowDrop = true; 84 this.tabControl.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 85 | System.Windows.Forms.AnchorStyles.Left) 104 this.tabControl.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 105 | System.Windows.Forms.AnchorStyles.Left) 86 106 | System.Windows.Forms.AnchorStyles.Right))); 87 107 this.tabControl.Controls.Add(this.ensemblesTab); … … 89 109 this.tabControl.Controls.Add(this.resultsTab); 90 110 this.tabControl.Controls.Add(this.runsTab); 91 this.tabControl.Location = new System.Drawing.Point(3, 26); 111 this.tabControl.Location = new System.Drawing.Point(4, 40); 112 this.tabControl.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); 92 113 this.tabControl.Name = "tabControl"; 93 114 this.tabControl.SelectedIndex = 0; 94 this.tabControl.Size = new System.Drawing.Size(1 070, 604);115 this.tabControl.Size = new System.Drawing.Size(1605, 929); 95 116 this.tabControl.TabIndex = 0; 96 117 // … … 99 120 this.ensemblesTab.AllowDrop = true; 100 121 this.ensemblesTab.Controls.Add(this.ensemblesViewHost); 101 this.ensemblesTab.Location = new System.Drawing.Point(4, 22); 122 this.ensemblesTab.Location = new System.Drawing.Point(4, 29); 123 this.ensemblesTab.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); 102 124 this.ensemblesTab.Name = "ensemblesTab"; 103 this.ensemblesTab.Padding = new System.Windows.Forms.Padding( 3);104 this.ensemblesTab.Size = new System.Drawing.Size( 527, 259);125 this.ensemblesTab.Padding = new System.Windows.Forms.Padding(4, 5, 4, 5); 126 this.ensemblesTab.Size = new System.Drawing.Size(1597, 896); 105 127 this.ensemblesTab.TabIndex = 0; 106 128 this.ensemblesTab.Text = "Ensembles"; … … 118 140 this.ensemblesViewHost.Dock = System.Windows.Forms.DockStyle.Fill; 119 141 this.ensemblesViewHost.Enabled = false; 120 this.ensemblesViewHost.Location = new System.Drawing.Point(3, 3); 142 this.ensemblesViewHost.Location = new System.Drawing.Point(4, 5); 143 this.ensemblesViewHost.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); 121 144 this.ensemblesViewHost.Name = "ensemblesViewHost"; 122 145 this.ensemblesViewHost.ReadOnly = false; 123 this.ensemblesViewHost.Size = new System.Drawing.Size( 521, 253);146 this.ensemblesViewHost.Size = new System.Drawing.Size(1589, 886); 124 147 this.ensemblesViewHost.TabIndex = 0; 125 148 this.ensemblesViewHost.ViewsLabelVisible = true; … … 130 153 this.datastreamTab.AllowDrop = true; 131 154 this.datastreamTab.Controls.Add(this.datastreamViewHost); 132 this.datastreamTab.Location = new System.Drawing.Point(4, 22); 155 this.datastreamTab.Location = new System.Drawing.Point(4, 29); 156 this.datastreamTab.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); 133 157 this.datastreamTab.Name = "datastreamTab"; 134 this.datastreamTab.Padding = new System.Windows.Forms.Padding( 3);135 this.datastreamTab.Size = new System.Drawing.Size( 950, 554);158 this.datastreamTab.Padding = new System.Windows.Forms.Padding(4, 5, 4, 5); 159 this.datastreamTab.Size = new System.Drawing.Size(1597, 896); 136 160 this.datastreamTab.TabIndex = 1; 137 161 this.datastreamTab.Text = "Datastream"; … … 147 171 this.datastreamViewHost.Dock = System.Windows.Forms.DockStyle.Fill; 148 172 this.datastreamViewHost.Enabled = false; 149 this.datastreamViewHost.Location = new System.Drawing.Point(3, 3); 173 this.datastreamViewHost.Location = new System.Drawing.Point(4, 5); 174 this.datastreamViewHost.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); 150 175 this.datastreamViewHost.Name = "datastreamViewHost"; 151 176 this.datastreamViewHost.ReadOnly = false; 152 this.datastreamViewHost.Size = new System.Drawing.Size( 944, 548);177 this.datastreamViewHost.Size = new System.Drawing.Size(1589, 886); 153 178 this.datastreamViewHost.TabIndex = 0; 154 179 this.datastreamViewHost.ViewsLabelVisible = true; … … 158 183 // 159 184 this.resultsTab.Controls.Add(this.resultsView); 160 this.resultsTab.Location = new System.Drawing.Point(4, 22); 185 this.resultsTab.Location = new System.Drawing.Point(4, 29); 186 this.resultsTab.Padding = new System.Windows.Forms.Padding(4, 5, 4, 5); 187 this.resultsTab.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); 161 188 this.resultsTab.Name = "resultsTab"; 162 this.resultsTab.Size = new System.Drawing.Size( 950, 554);189 this.resultsTab.Size = new System.Drawing.Size(1597, 896); 163 190 this.resultsTab.TabIndex = 3; 164 191 this.resultsTab.Text = "Results"; 165 192 this.resultsTab.UseVisualStyleBackColor = true; 166 193 // 167 // resultsView Host194 // resultsView 168 195 // 169 196 this.resultsView.Caption = "View"; … … 171 198 this.resultsView.Dock = System.Windows.Forms.DockStyle.Fill; 172 199 this.resultsView.Enabled = false; 173 this.resultsView.Location = new System.Drawing.Point(0, 0); 174 this.resultsView.Name = "resultsViewHost"; 175 this.resultsView.ReadOnly = false; 176 this.resultsView.Size = new System.Drawing.Size(950, 554); 200 this.resultsView.Location = new System.Drawing.Point(4, 5); 201 this.resultsView.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); 202 this.resultsView.Name = "resultsView"; 203 this.resultsView.ReadOnly = true; 204 this.resultsView.ShowDetails = true; 205 this.resultsView.Size = new System.Drawing.Size(1597, 896); 177 206 this.resultsView.TabIndex = 0; 178 // 207 // 179 208 // runsTab 180 // 181 //this.runsTabPage.Controls.Add(this.storeAlgorithmInEachRunCheckBox); 209 // 182 210 this.runsTab.Controls.Add(this.runsView); 183 this.runsTab.Location = new System.Drawing.Point(4, 22); 184 this.runsTab.Name = "runsTabPage"; 185 this.runsTab.Padding = new System.Windows.Forms.Padding(3); 186 this.runsTab.Size = new System.Drawing.Size(950, 554); 211 this.runsTab.Location = new System.Drawing.Point(4, 29); 212 this.runsTab.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); 213 this.runsTab.Name = "runsTab"; 214 this.runsTab.Padding = new System.Windows.Forms.Padding(4, 5, 4, 5); 215 this.runsTab.Size = new System.Drawing.Size(1597, 896); 187 216 this.runsTab.TabIndex = 3; 188 217 this.runsTab.Text = "Runs"; 189 218 this.runsTab.UseVisualStyleBackColor = true; 190 // 219 // 191 220 // runsView 192 // 193 this.runsView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 194 | System.Windows.Forms.AnchorStyles.Left) 195 | System.Windows.Forms.AnchorStyles.Right))); 221 // 196 222 this.runsView.Caption = "RunCollection View"; 197 223 this.runsView.Content = null; 198 this.runsView.Location = new System.Drawing.Point(0, 0); 224 this.runsView.Dock = System.Windows.Forms.DockStyle.Fill; 225 this.runsView.Enabled = false; 226 this.runsView.Location = new System.Drawing.Point(4, 5); 227 this.runsView.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); 199 228 this.runsView.Name = "runsView"; 200 229 this.runsView.ReadOnly = false; 201 this.runsView.Size = new System.Drawing.Size( 950, 554);230 this.runsView.Size = new System.Drawing.Size(1589, 886); 202 231 this.runsView.TabIndex = 0; 203 232 // … … 205 234 // 206 235 this.AllowDrop = true; 207 this.AutoScaleDimensions = new System.Drawing.SizeF( 6F, 13F);236 this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 20F); 208 237 this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 209 238 this.Controls.Add(this.tabControl); 239 this.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); 210 240 this.Name = "DatastreamAnalysisOptimizerView"; 211 this.Size = new System.Drawing.Size(1 076, 663);241 this.Size = new System.Drawing.Size(1614, 1020); 212 242 this.Controls.SetChildIndex(this.tabControl, 0); 213 243 this.Controls.SetChildIndex(this.nameLabel, 0); … … 225 255 this.datastreamTab.ResumeLayout(false); 226 256 this.resultsTab.ResumeLayout(false); 257 this.runsTab.ResumeLayout(false); 227 258 this.ResumeLayout(false); 228 259 this.PerformLayout(); -
branches/HeuristicLab.DatastreamAnalysis/HeuristicLab.DatastreamAnalysis.Views/3.4/DatastreamAnalysisOptimizerView.cs
r14536 r14538 75 75 runsView.Content = null; 76 76 } else { 77 ensemblesViewHost.ViewType = null; 77 78 ensemblesViewHost.Content = Content.Ensembles; 79 datastreamViewHost.ViewType = null; 78 80 datastreamViewHost.Content = Content.Datastream; 79 81 resultsView.Content = Content.Results.AsReadOnly(); … … 84 86 protected override void SetEnabledStateOfControls() { 85 87 base.SetEnabledStateOfControls(); 88 86 89 resultsView.Enabled = Content != null; 87 90 runsView.Enabled = Content != null; … … 118 121 } 119 122 120 #region 123 #region content events 121 124 protected override void Content_Prepared(object sender, EventArgs e) { 122 125 if (InvokeRequired) … … 132 135 Invoke(new EventHandler(Content_EnsemblesChanged), sender, e); 133 136 else { 137 ensemblesViewHost.ViewType = null; 134 138 ensemblesViewHost.Content = Content.Ensembles; 135 139 } -
branches/HeuristicLab.DatastreamAnalysis/HeuristicLab.DatastreamAnalysis.Views/3.4/HeuristicLab.DatastreamAnalysis.Views.csproj
r14536 r14538 121 121 </ItemGroup> 122 122 <ItemGroup> 123 <EmbeddedResource Include="DatastreamAnalysisOptimizerView.resx"> 124 <DependentUpon>DatastreamAnalysisOptimizerView.cs</DependentUpon> 125 </EmbeddedResource> 123 126 <EmbeddedResource Include="RegressionEnsembleModelView.resx"> 124 127 <DependentUpon>RegressionEnsembleModelView.cs</DependentUpon> -
branches/HeuristicLab.DatastreamAnalysis/HeuristicLab.DatastreamAnalysis.Views/3.4/Plugin.cs
r14536 r14538 23 23 24 24 namespace HeuristicLab.DatastreamAnalysis.Views { 25 [Plugin("HeuristicLab.DatastreamAnalysis.Views", "3.4.14.14 491")]25 [Plugin("HeuristicLab.DatastreamAnalysis.Views", "3.4.14.14536")] 26 26 [PluginFile("HeuristicLab.DatastreamAnalysis.Views-3.4.dll", PluginFileType.Assembly)] 27 27 [PluginDependency("HeuristicLab.Collections", "3.3")] -
branches/HeuristicLab.DatastreamAnalysis/HeuristicLab.DatastreamAnalysis.Views/3.4/Properties/AssemblyInfo.cs
r14536 r14538 54 54 // [assembly: AssemblyVersion("1.0.*")] 55 55 [assembly: AssemblyVersion("3.4.0.0")] 56 [assembly: AssemblyFileVersion("3.4.14.14 491")]56 [assembly: AssemblyFileVersion("3.4.14.14536")] -
branches/HeuristicLab.DatastreamAnalysis/HeuristicLab.DatastreamAnalysis/3.4/Datastream.cs
r14536 r14538 43 43 protected const string SlidingWindowStepWidthParameterName = "SlidingWindowStepWidth"; 44 44 protected const string SlidingWindowMovementIntervalParameterName = "SlidingWindowMovementInterval"; 45 protected const string FitnessPartitionParameterName = "FitnessPartition"; 45 46 46 47 #region parameter properites … … 50 51 } 51 52 52 public IFixedValueParameter<IntRange> InitialSlidingWindowParameter { 53 get { return (IFixedValueParameter<IntRange>) Parameters[InitialSlidingWindowParameterName]; } 54 } 55 56 public IFixedValueParameter<IntValue> SlidingWindowSizeParameter { 57 get { return (IFixedValueParameter<IntValue>)Parameters[InitialSlidingWindowParameterName]; } 58 } 59 60 public IFixedValueParameter<IntValue> SlidingWindowStepWidthParameter { 61 get { return (IFixedValueParameter<IntValue>)Parameters[SlidingWindowStepWidthParameterName]; } 62 } 63 64 public IFixedValueParameter<IntValue> SlidingWindowMovementIntervalParameter { 65 get { return (IFixedValueParameter<IntValue>)Parameters[SlidingWindowMovementIntervalParameterName]; } 66 } 67 53 public IValueParameter<IntRange> InitialSlidingWindowParameter { 54 get { return (IValueParameter<IntRange>) Parameters[InitialSlidingWindowParameterName]; } 55 } 56 57 public IValueParameter<IntValue> SlidingWindowSizeParameter { 58 get { return (IValueParameter<IntValue>) Parameters[SlidingWindowSizeParameterName]; } 59 } 60 61 public IValueParameter<IntValue> SlidingWindowStepWidthParameter { 62 get { return (IValueParameter<IntValue>) Parameters[SlidingWindowStepWidthParameterName]; } 63 } 64 65 public IValueParameter<IntValue> SlidingWindowMovementIntervalParameter { 66 get { return (IValueParameter<IntValue>) Parameters[SlidingWindowMovementIntervalParameterName]; } 67 } 68 69 //public IValueParameter<IntRange> FitnessPartitionParameter { 70 // get { return (IValueParameter<IntRange>) Parameters[FitnessPartitionParameterName]; } 71 //} 68 72 69 73 #endregion … … 75 79 set { 76 80 if(value == null) throw new ArgumentNullException("problemData", "The provided value for the problemData is null."); 77 if (value == ProblemData) return;78 81 ProblemDataParameter.Value = value; 79 } 80 } 82 //OnProblemDataChanged(); 83 } 84 } 85 81 86 82 87 public IntRange InitialSlidingWindow { 83 88 get { return InitialSlidingWindowParameter.Value; } 89 set { InitialSlidingWindowParameter.Value = value; } 84 90 } 85 91 86 92 public IntValue SlidingWindowSize { 87 93 get { return SlidingWindowSizeParameter.Value; } 94 set { SlidingWindowSizeParameter.Value = value; } 88 95 } 89 96 90 97 public IntValue SlidingWindowStepWidth { 91 98 get { return SlidingWindowStepWidthParameter.Value; } 99 set { SlidingWindowStepWidthParameter.Value = value; } 92 100 } 93 101 94 102 public IntValue SlidingWindowMovementInterval { 95 103 get { return SlidingWindowMovementIntervalParameter.Value; } 104 set { SlidingWindowMovementIntervalParameter.Value = value; } 96 105 } 97 106 … … 101 110 102 111 public IntRange FitnessPartition { get; set; } 112 113 public bool UpdateAvailable { 114 get { return false; } 115 } 103 116 104 117 public bool SlidingWindowMovementPossible { 105 118 get { 106 119 return ProblemData != null && ProblemData.Dataset != null && 107 FitnessPartition.End + SlidingWindowStepWidth.Value <= ProblemData.Dataset.Rows; 108 // TODO: add external datastream, hub, etc to condition 120 ( 121 (FitnessPartition.End + SlidingWindowStepWidth.Value <= ProblemData.Dataset.Rows) // shift end 122 || (FitnessPartition.Size > SlidingWindowSize.Value && (FitnessPartition.Start + SlidingWindowStepWidth.Value) < FitnessPartition.End) // shift start 123 ); 109 124 } 110 125 } … … 112 127 public bool SlidingWindowEvaluationPossible { 113 128 get { 114 return ProblemData != null && ProblemData.Dataset != null &&115 129 //return ProblemData != null && ProblemData.Dataset != null && ProblemData.Dataset.Rows > 0 && FitnessPartition.Size > 0; 130 return FitnessPartition.Size > 0; 116 131 } 117 132 } … … 120 135 if (ProblemData?.Dataset == null || ProblemData.Dataset.Rows == 0) return false; 121 136 if (FitnessPartition.End + SlidingWindowStepWidth.Value > ProblemData.Dataset.Rows) return false; 122 123 if (FitnessPartition.Size > SlidingWindowSize.Value) { 124 FitnessPartition.Start += SlidingWindowStepWidth.Value; 125 } else if (FitnessPartition.Size == SlidingWindowSize.Value) { 137 138 if (FitnessPartition.Size == SlidingWindowSize.Value) { 126 139 FitnessPartition.Start += SlidingWindowStepWidth.Value; 127 140 FitnessPartition.End += SlidingWindowStepWidth.Value; 128 } else { 141 } else { 129 142 FitnessPartition.End += SlidingWindowStepWidth.Value; 130 } 143 FitnessPartition.Start += FitnessPartition.End - SlidingWindowSize.Value; 144 } 145 146 //if (FitnessPartition.Size > SlidingWindowSize.Value) { 147 // FitnessPartition.Start += SlidingWindowStepWidth.Value; 148 //} else if (FitnessPartition.Size == SlidingWindowSize.Value) { 149 // FitnessPartition.Start += SlidingWindowStepWidth.Value; 150 // FitnessPartition.End += SlidingWindowStepWidth.Value; 151 //} else { 152 // FitnessPartition.End += SlidingWindowStepWidth.Value; 153 // if (FitnessPartition.Size > SlidingWindowSize.Value) { 154 // FitnessPartition.Start = FitnessPartition.End - FitnessPartition.Size; 155 // } 156 //} 131 157 return true; 132 158 } … … 141 167 private void AfterDeserialization() { 142 168 RegisterParameterEvents(); 169 RecoverState(); 143 170 } 144 171 145 172 protected Datastream(Datastream original, Cloner cloner) : base(original, cloner) { 146 173 RegisterParameterEvents(); 174 RecoverState(); 147 175 } 148 176 … … 151 179 } 152 180 153 public Datastream() {181 public Datastream() : base() { 154 182 Parameters.Add(new ValueParameter<RegressionProblemData>(ProblemDataParameterName, "ProblemData for analysis with selected ensembles.", null)); 155 Parameters.Add(new FixedValueParameter<IntRange>(InitialSlidingWindowParameterName, "Initial sliding window boundaries", new IntRange(0, 1)));156 Parameters.Add(new FixedValueParameter<IntValue>(SlidingWindowSizeParameterName, "Sliding window size", new IntValue( 1)));183 Parameters.Add(new FixedValueParameter<IntRange>(InitialSlidingWindowParameterName, "Initial sliding window boundaries", new IntRange(0, 5))); 184 Parameters.Add(new FixedValueParameter<IntValue>(SlidingWindowSizeParameterName, "Sliding window size", new IntValue(5))); 157 185 Parameters.Add(new FixedValueParameter<IntValue>(SlidingWindowStepWidthParameterName, "Sliding window step width", new IntValue(1))); 158 Parameters.Add(new FixedValueParameter<IntValue>(SlidingWindowMovementIntervalParameterName, "Sliding window movement interval (milliseconds)", new IntValue(1000))); 186 Parameters.Add(new FixedValueParameter<IntValue>(SlidingWindowMovementIntervalParameterName, "Sliding window movement interval (milliseconds)", new IntValue(2000))); 187 RegisterParameterEvents(); 159 188 InitializeState(); 160 189 } 161 190 #endregion 162 191 163 164 public void InitializeState() { 192 public void InitializeState(){ 165 193 if (ProblemData == null || ProblemData.Dataset == null || ProblemData.Dataset.Rows == 0) { 166 194 FitnessPartition = new IntRange(0, 0); … … 173 201 } 174 202 203 public void RecoverState() { 204 if (ProblemData == null || ProblemData.Dataset == null || ProblemData.Dataset.Rows == 0) { 205 FitnessPartition = new IntRange(0, 0); 206 } else { 207 if(FitnessPartition == null) FitnessPartition = (IntRange)InitialSlidingWindow.Clone(); 208 if (FitnessPartition.End > ProblemData.Dataset.Rows) { 209 FitnessPartition.End = ProblemData.Dataset.Rows; 210 } 211 } 212 } 213 175 214 public event EventHandler ProblemDataChanged; 176 215 public event EventHandler Reset; 216 public event EventHandler SlidingWindowChanged; 217 218 219 //protected virtual void OnProblemDataChanged() { 220 // EventHandler handler = ProblemDataChanged; 221 // if(handler != null) handler(this, EventArgs.Empty); 222 //} 223 224 //protected virtual void OnReset() { 225 // EventHandler handler = Reset; 226 // if (handler != null) handler(this, EventArgs.Empty); 227 //} 177 228 178 229 private void RegisterParameterEvents() { 179 230 ProblemDataParameter.ValueChanged += new EventHandler(ProblemData_ValueChanged); 231 //SlidingWindowSizeParameter.ValueChanged += new EventHandler(SlidingWindow_Changed); 232 InitialSlidingWindowParameter.ValueChanged += new EventHandler(SlidingWindow_Changed); 180 233 } 181 234 … … 183 236 if (e == null) return; 184 237 238 InitializeState(); 185 239 DatastreamAnalysisUtil.RaiseEvent(this, ProblemDataChanged); 186 240 } 187 241 242 private void SlidingWindow_Changed(object sender, EventArgs e) { 243 InitializeState(); 244 } 245 246 247 // TODO 248 public IEnumerable<IParameterizedItem> ExecutionContextItems { get; } 188 249 189 190 250 } 191 251 } -
branches/HeuristicLab.DatastreamAnalysis/HeuristicLab.DatastreamAnalysis/3.4/DatastreamAnalysisOptimizer.cs
r14536 r14538 24 24 using System; 25 25 using System.Collections.Generic; 26 using System.ComponentModel; 26 27 using System.Diagnostics; 27 28 using System.Drawing; … … 76 77 private bool stopPending; 77 78 private DateTime lastUpdateTime; 79 private bool prepared; 80 private bool finished; 78 81 79 82 [Storable] … … 106 109 if (value == null || value == ensembles) 107 110 return; 108 111 if(!(value is IRegressionEnsembleModel)) throw new ArgumentException("Invaid ensemble model type"); 112 DeregisterEnsembleEvents(); 109 113 ensembles = value; 114 RegisterEnsembleEvents(); 115 OnEnsemblesChanged(); 116 Prepare(); 110 117 } 111 118 } … … 121 128 if (value == null || value == datastream) 122 129 return; 123 130 if(!(value is IDatastream)) throw new ArgumentException("Invalid datastream type"); 131 DeregisterDatastreamEvents(); 124 132 datastream = value; 133 RegisterDatastreamEvents(); 134 OnDatastreamChanged(); 135 Prepare(); 125 136 } 126 137 } … … 128 139 #endregion properties 129 140 130 #region ResultsProperties 131 private double ResultsBestQuality 132 { 141 #region results properties 142 private int ResultsSlidingWindowMovements { 143 get { return ((IntValue)Results["Sliding Window Movements"].Value).Value; } 144 set { ((IntValue)Results["Sliding Window Movements"].Value).Value = value; } 145 } 146 private double ResultsBestQuality { 133 147 get { return ((DoubleValue)Results["Best Quality"].Value).Value; } 134 148 set { ((DoubleValue)Results["Best Quality"].Value).Value = value; } 135 149 } 136 private DataTable ResultsQualities 137 { 150 private DataTable ResultsQualities { 138 151 get { return ((DataTable)Results["Qualities"].Value); } 139 152 } 153 154 private const string ResultsQualitiesR2 = "R²"; 155 private const string ResultsQualitiesPearson = "Pearson"; 156 157 private DataTable ResultsTargets { 158 get { return ((DataTable) Results["Targets"].Value); } 159 } 160 161 private const string ResultsTargetsReal = "Real"; 162 163 protected void SetupResults() { 164 Results.Clear(); 165 166 Results.Add(new Result("Sliding Window Movements", new IntValue(0))); 167 Results.Add(new Result("Best Quality", new DoubleValue(0))); 168 Results.Add(new Result("Qualities", new DataTable("Qualities"))); 169 Results.Add(new Result("Targets", new DataTable("Targets"))); 170 171 ResultsQualities.Rows.Add(new DataRow(ResultsQualitiesR2)); 172 ResultsQualities.Rows.Add(new DataRow(ResultsQualitiesPearson)); 173 ResultsTargets.Rows.Add(new DataRow(ResultsTargetsReal)); 174 foreach (var ensemble in Ensembles) { 175 ResultsTargets.Rows.Add(new DataRow(ensemble.Name)); 176 } 177 } 178 140 179 #endregion 141 180 142 181 #region constructors, cloner,... 143 182 144 public DatastreamAnalysisOptimizer() {183 public DatastreamAnalysisOptimizer() : base() { 145 184 name = "Datastream Analysis"; 146 185 log = new Log(); … … 159 198 [StorableHook(HookType.AfterDeserialization)] 160 199 private void AfterDeserialization() { 161 // nothing to do in here200 Initialize(); 162 201 } 163 202 … … 179 218 private void Initialize() { 180 219 if (runs != null) RegisterRunsEvents(); 220 if (datastream != null) RegisterDatastreamEvents(); 221 if (ensembles != null) RegisterEnsembleEvents(); 181 222 } 182 223 #endregion … … 185 226 186 227 public override void Prepare() { 187 if (ensembles == null || datastream == null) return; 188 Prepare(true); 228 if (ensembles == null || ensembles.Count == 0 || datastream == null || !datastream.SlidingWindowEvaluationPossible) return; 229 //if (ensembles.SelectMany(x => x.Models).Count() == 0) return; 230 base.Prepare(); 231 OnPrepared(); 189 232 } 190 233 191 234 public void Prepare(bool clearRuns) { 192 if (ensembles == null || datastream == null) return; 235 if (ensembles == null || ensembles.Count == 0 || datastream == null || !datastream.SlidingWindowEvaluationPossible) return; 236 193 237 base.Prepare(); 194 if (clearRuns) r esults.Clear();238 if (clearRuns) runs.Clear(); 195 239 OnPrepared(); 196 240 } … … 201 245 cancellationTokenSource = new CancellationTokenSource(); 202 246 stopPending = false; 247 248 if (prepared) { 249 SetupResults(); 250 //prepared = false; 251 } 203 252 204 253 Task task = Task.Factory.StartNew(Run, cancellationTokenSource.Token, cancellationTokenSource.Token); … … 219 268 220 269 // handle stop/pause 221 if(stopPending) { } 222 if(!Datastream.SlidingWindowMovementPossible) OnStopped(); 223 else OnPaused(); 270 if (stopPending || finished) { 271 OnStopped(); 272 } else { 273 OnPaused(); 274 } 275 //if(!Datastream.SlidingWindowMovementPossible) OnStopped(); 276 //else OnPaused(); 224 277 }); 225 278 … … 244 297 245 298 protected override void OnPrepared() { 299 ExecutionTime = TimeSpan.Zero; 300 foreach (IStatefulItem statefulItem in this.GetObjectGraphObjects(new HashSet<object>() {Runs}).OfType<IStatefulItem>()) { 301 statefulItem.InitializeState(); 302 } 303 results.Clear(); 304 prepared = true; 305 finished = false; 246 306 Log.LogMessage("Datastream analysis prepared"); 247 307 base.OnPrepared(); … … 259 319 260 320 protected override void OnStopped() { 261 Log.LogMessage("Datastream analysis stopped"); 262 base.OnStopped(); 321 try { 322 runsCounter++; 323 var run = new Run(); 324 run.Filename = Filename; 325 run.Name = string.Format("{0} Run {1}", Name, runsCounter); 326 CollectParameterValues(run.Parameters); 327 CollectResultValues(run.Results); 328 runs.Add(run); 329 } 330 finally { 331 Log.LogMessage("Datastream analysis stopped"); 332 base.OnStopped(); 333 } 263 334 } 264 335 265 336 #endregion 266 337 267 338 #region run 268 339 private void Run(object state) { 269 340 CancellationToken cancellationToken = (CancellationToken) state; … … 287 358 } 288 359 360 private int replayedIndex; 361 289 362 protected void Run(CancellationToken cancellationToken) { 290 291 // setup results292 var slidingWindowMovements = new IntValue(0);293 Results.Add(new Result("Sliding Window Movements", slidingWindowMovements));294 295 var qtable = new DataTable("Qualities");296 qtable.Rows.Add(new DataRow("R²"));297 qtable.Rows.Add(new DataRow("Pearson"));298 Results.Add(new Result("Qualities", qtable));299 300 var curLoss = new DoubleValue();301 Results.Add(new Result("R²", curLoss));302 Results.Add(new Result("Best Quality", curLoss));303 304 305 363 // init algorithm 306 364 var problemData = Datastream.ProblemData; 307 365 var targetVarName = problemData.TargetVariable; 308 366 var activeVariables = problemData.AllowedInputVariables; 367 368 if (prepared) { 369 // replay datastream until FitnessPartition.End 370 //for (int i = 0; i < Datastream.FitnessPartition.End; i++) { 371 // var val = problemData.Dataset.GetDoubleValue(targetVarName, i); 372 // ResultsTargets.Rows[ResultsTargetsReal].Values.Add(val); 373 //} 374 //replayedIndex = Datastream.FitnessPartition.End; 375 replayedIndex = 0; 376 prepared = false; 377 } 378 379 309 380 Random rnd = new Random(); 310 381 311 382 try { 312 while (Datastream.SlidingWindowMovementPossible) { 313 cancellationToken.ThrowIfCancellationRequested(); 314 315 Task.Delay(Datastream.SlidingWindowMovementInterval.Value); 316 317 Datastream.MoveSlidingWindow(); 318 319 // TODO do the window evaluation 320 321 // TODO: collect results and display them 322 323 curLoss.Value = rnd.Next(100); 324 qtable.Rows["R²"].Values.Add(curLoss.Value); 325 qtable.Rows["Pearson"].Values.Add(curLoss.Value % 10); 326 327 slidingWindowMovements.Value++; 328 } 329 330 // TODO: collect runs (c.f. goal seeking) 383 do { 384 do { 385 cancellationToken.ThrowIfCancellationRequested(); 386 387 Thread.Sleep(Datastream.SlidingWindowMovementInterval.Value); 388 Datastream.MoveSlidingWindow(); 389 390 if (Datastream.SlidingWindowEvaluationPossible) { 391 foreach (var ensemble in Ensembles) { 392 // TODO do the window evaluation 393 double estimatedVal = problemData.Dataset.GetDoubleValue(targetVarName, replayedIndex) 394 * (1.0 + (((double)rnd.Next(0, 30)) / 100)); 395 for (int i = replayedIndex; i < Datastream.FitnessPartition.End; i++) { 396 ResultsTargets.Rows[ensemble.Name].Values.Add(estimatedVal); 397 } 398 } 399 } 400 401 // replay datastream until FitnessPartition.End 402 for (int i = replayedIndex; i < Datastream.FitnessPartition.End; i++) { 403 var val = problemData.Dataset.GetDoubleValue(targetVarName, i); 404 ResultsTargets.Rows[ResultsTargetsReal].Values.Add(val); 405 } 406 replayedIndex = Datastream.FitnessPartition.End; 407 408 409 // TODO: collect results and display them 410 411 int exp = rnd.Next(100); 412 ResultsQualities.Rows[ResultsQualitiesR2].Values.Add(exp); 413 ResultsQualities.Rows[ResultsQualitiesPearson].Values.Add((double)exp / 10); 414 ResultsSlidingWindowMovements++; 415 ResultsBestQuality = (double)exp / 42; 416 417 } while (Datastream.SlidingWindowMovementPossible); 418 } while (Datastream.UpdateAvailable); 419 finished = true; 331 420 } 332 421 catch (Exception ex) { … … 349 438 } 350 439 440 public void CollectParameterValues(IDictionary<string, IItem> values) { 441 values.Add("Datastream Analysis Name", new StringValue(Name)); 442 if (Datastream != null) { 443 Datastream.CollectParameterValues(values); 444 values.Add("Datastream Name", new StringValue(Datastream.Name)); 445 } 446 } 447 351 448 public void CollectResultValues(IDictionary<string, IItem> values) { 352 449 values.Add("Execution Time", new TimeSpanValue(ExecutionTime)); 353 450 Results.CollectResultValues(values); 354 451 } 452 #endregion 355 453 356 454 #region events 455 456 #region events registration 357 457 358 458 public EventHandler EnsemblesChanged; … … 367 467 } 368 468 469 protected virtual void RegisterDatastreamEvents() { 470 datastream.Reset += new EventHandler(Datastream_Reset); 471 datastream.ProblemDataChanged += new EventHandler(Datastream_ProblemDataChanged); 472 } 473 474 protected virtual void DeregisterDatastreamEvents() { 475 datastream.Reset -= new EventHandler(Datastream_Reset); 476 datastream.ProblemDataChanged -= new EventHandler(Datastream_ProblemDataChanged); 477 } 478 479 protected virtual void RegisterEnsembleEvents() { 480 ensembles.ItemsAdded += new CollectionItemsChangedEventHandler<IndexedItem<RegressionEnsembleModel>>(Ensembles_ItemsChanged); 481 ensembles.ItemsMoved += new CollectionItemsChangedEventHandler<IndexedItem<RegressionEnsembleModel>>(Ensembles_ItemsChanged); 482 ensembles.ItemsRemoved += new CollectionItemsChangedEventHandler<IndexedItem<RegressionEnsembleModel>>(Ensembles_ItemsChanged); 483 ensembles.ItemsReplaced += new CollectionItemsChangedEventHandler<IndexedItem<RegressionEnsembleModel>>(Ensembles_ItemsChanged); 484 ensembles.CollectionReset += new CollectionItemsChangedEventHandler<IndexedItem<RegressionEnsembleModel>>(Ensembles_Reset); 485 } 486 487 protected virtual void DeregisterEnsembleEvents() { 488 ensembles.ItemsAdded -= new CollectionItemsChangedEventHandler<IndexedItem<RegressionEnsembleModel>>(Ensembles_ItemsChanged); 489 ensembles.ItemsMoved -= new CollectionItemsChangedEventHandler<IndexedItem<RegressionEnsembleModel>>(Ensembles_ItemsChanged); 490 ensembles.ItemsRemoved -= new CollectionItemsChangedEventHandler<IndexedItem<RegressionEnsembleModel>>(Ensembles_ItemsChanged); 491 ensembles.ItemsReplaced -= new CollectionItemsChangedEventHandler<IndexedItem<RegressionEnsembleModel>>(Ensembles_ItemsChanged); 492 ensembles.CollectionReset -= new CollectionItemsChangedEventHandler<IndexedItem<RegressionEnsembleModel>>(Ensembles_Reset); 493 } 494 #endregion 495 496 #region event handling 497 369 498 protected virtual void Runs_CollectionReset(object sender, CollectionItemsChangedEventArgs<IRun> e) { 370 499 runsCounter = runs.Count; 371 500 } 372 501 373 #region event handling 502 protected virtual void Datastream_Reset(object sender, EventArgs e) { 503 Prepare(); 504 } 505 506 protected virtual void Datastream_ProblemDataChanged(object sender, EventArgs e) { 507 Prepare(); 508 } 509 510 protected virtual void Ensembles_Reset(object sender, EventArgs e) { 511 Prepare(); 512 } 513 514 protected virtual void Ensembles_ItemsChanged(object sender, EventArgs e) { 515 Prepare(); 516 } 374 517 375 518 private void OnEnsemblesChanged() { … … 389 532 #endregion 390 533 391 #region nameditem 392 393 [Storable] protected string name; 534 #region NamedItem 535 536 [Storable] 537 protected string name; 394 538 395 539 /// <inheritdoc/> -
branches/HeuristicLab.DatastreamAnalysis/HeuristicLab.DatastreamAnalysis/3.4/IDatastream.cs
r14536 r14538 21 21 22 22 using System; 23 using System.Collections.Generic; 23 24 using HeuristicLab.Common; 24 25 using HeuristicLab.Core; 25 26 26 27 namespace HeuristicLab.DatastreamAnalysis { 27 public interface IDatastream : IParameterizedNamedItem, INamedItem, IItem, IContent, IDeepCloneable, ICloneable, IParameterizedItem { 28 /// <summary> 29 /// Interface to represent a datastream. 30 /// </summary> 31 public interface IDatastream : IParameterizedNamedItem { 32 IEnumerable<IParameterizedItem> ExecutionContextItems { get; } 33 event EventHandler Reset; 34 event EventHandler ProblemDataChanged; 28 35 } 29 36 } -
branches/HeuristicLab.DatastreamAnalysis/HeuristicLab.DatastreamAnalysis/3.4/Plugin.cs
r14536 r14538 23 23 24 24 namespace HeuristicLab.DatastreamAnalysis { 25 [Plugin("HeuristicLab.DatastreamAnalysis", "3.4.14.14 491")]25 [Plugin("HeuristicLab.DatastreamAnalysis", "3.4.14.14536")] 26 26 [PluginFile("HeuristicLab.DatastreamAnalysis-3.4.dll", PluginFileType.Assembly)] 27 27 [PluginDependency("HeuristicLab.Collections", "3.3")] -
branches/HeuristicLab.DatastreamAnalysis/HeuristicLab.DatastreamAnalysis/3.4/Properties/AssemblyInfo.cs
r14536 r14538 54 54 // [assembly: AssemblyVersion("1.0.*")] 55 55 [assembly: AssemblyVersion("3.4.0.0")] 56 [assembly: AssemblyFileVersion("3.4.14.14 491")]56 [assembly: AssemblyFileVersion("3.4.14.14536")] -
branches/HeuristicLab.DatastreamAnalysis/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/Regression/RegressionEnsembleModel.cs
r14536 r14538 82 82 [StorableHook(HookType.AfterDeserialization)] 83 83 private void AfterDeserialization() { 84 85 foreach (var model in Models) {86 this.models.Add(model);87 }88 89 84 // BackwardsCompatibility 3.3.14 90 85 #region Backwards compatible code, remove with 3.4
Note: See TracChangeset
for help on using the changeset viewer.