Changeset 7850 for branches/Sliding Window GP
- Timestamp:
- 05/21/12 10:30:41 (13 years ago)
- Location:
- branches/Sliding Window GP
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/HeuristicLab.Problems.DataAnalysis.Symbolic.Views-3.4.csproj
r7845 r7850 50 50 <DebugType>pdbonly</DebugType> 51 51 <Optimize>true</Optimize> 52 <OutputPath> $(SolutionDir)\bin\</OutputPath>52 <OutputPath>..\..\..\..\trunk\sources\bin\</OutputPath> 53 53 <DefineConstants>TRACE</DefineConstants> 54 54 <ErrorReport>prompt</ErrorReport> -
branches/Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/SlidingWindowDataView.Designer.cs
r7845 r7850 26 26 /// </summary> 27 27 private void InitializeComponent() { 28 System.Windows.Forms.DataVisualization.Charting.ChartArea chartArea1 = new System.Windows.Forms.DataVisualization.Charting.ChartArea(); 28 29 this.chart = new HeuristicLab.Visualization.ChartControlsExtensions.EnhancedChart(); 29 30 ((System.ComponentModel.ISupportInitialize)(this.chart)).BeginInit(); … … 32 33 // chart 33 34 // 35 chartArea1.Name = "ChartArea1"; 36 this.chart.ChartAreas.Add(chartArea1); 34 37 this.chart.Dock = System.Windows.Forms.DockStyle.Fill; 35 38 this.chart.Location = new System.Drawing.Point(0, 0); -
branches/Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/SlidingWindowDataView.cs
r7845 r7850 51 51 52 52 StripLine stripLine = new StripLine(); 53 stripLine.BackColor = Color. Yellow;53 stripLine.BackColor = Color.Gold; 54 54 stripLine.Font = new Font("Times New Roman", 12, FontStyle.Bold); 55 55 stripLine.Text = "Sliding Window"; … … 72 72 73 73 private void SlidingWindowPosition_ValueChanged(object sender, System.EventArgs e) { 74 UpdateStripLine(); 74 if (InvokeRequired) Invoke((Action<object, EventArgs>)SlidingWindowPosition_ValueChanged, sender, e); 75 else UpdateStripLine(); 75 76 } 76 77 … … 81 82 chart.Series.Add(TARGETVARIABLE_SERIES_NAME); 82 83 chart.Series[TARGETVARIABLE_SERIES_NAME].ChartType = SeriesChartType.FastLine; 83 chart.Series[TARGETVARIABLE_SERIES_NAME].Points. AddY(Content.TargetValues);84 chart.Series[TARGETVARIABLE_SERIES_NAME].Points.DataBindY(Content.TargetValues.ToArray()); 84 85 85 86 UpdateStripLine(); 87 UpdateCursorInterval(); 86 88 } 87 89 -
branches/Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/HeuristicLab.Problems.DataAnalysis.Symbolic-3.4.csproj
r7845 r7850 95 95 <Reference Include="ALGLIB-3.5.0"> 96 96 <HintPath>..\..\..\..\trunk\sources\bin\ALGLIB-3.5.0.dll</HintPath> 97 <Private>False</Private> 97 98 </Reference> 98 99 <Reference Include="HeuristicLab.Analysis-3.3"> … … 135 136 <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Problems.DataAnalysis-3.4.dll</HintPath> 136 137 </Reference> 138 <Reference Include="HeuristicLab.Problems.Instances-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL" /> 137 139 <Reference Include="HeuristicLab.Random-3.3"> 138 140 <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Random-3.3.dll</HintPath> … … 153 155 </ItemGroup> 154 156 <ItemGroup> 157 <Compile Include="SlidingWindow\OffspringSelectionSlidingWindowAnalyzer.cs" /> 155 158 <Compile Include="SlidingWindow\SlidingWindowData.cs" /> 156 159 <Compile Include="SlidingWindow\GenerationalSlidingWindowAnalyzer.cs" /> -
branches/Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Plugin.cs.frame
r7696 r7850 41 41 [PluginDependency("HeuristicLab.Persistence", "3.3")] 42 42 [PluginDependency("HeuristicLab.Problems.DataAnalysis", "3.4")] 43 [PluginDependency("HeuristicLab.Problems.Instances", "3.3")] 43 44 [PluginDependency("HeuristicLab.Random", "3.3")] 44 45 public class HeuristicLabProblemsDataAnalysisSymbolicPlugin : PluginBase { -
branches/Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/SlidingWindow/GenerationalSlidingWindowAnalyzer.cs
r7845 r7850 72 72 Parameters.Add(new LookupParameter<IntValue>(IterationsParameterName, "")); 73 73 Parameters.Add(new ValueLookupParameter<IntValue>(MaximumIterationsParameterName, "")); 74 Parameters.Add(new FixedValueParameter<IntValue>(GenerationsIntervalParameterName, "", new IntValue(0))); 75 Parameters.Add(new FixedValueParameter<IntValue>(GenerationsIntervalStartParameterName, "", new IntValue(10))); 74 Parameters.Add(new FixedValueParameter<IntValue>(GenerationsIntervalParameterName, "", new IntValue(5))); 75 Parameters.Add(new FixedValueParameter<IntValue>(GenerationsIntervalStartParameterName, "", new IntValue(0))); 76 77 GenerationsIntervalStartParameter.Hidden = true; 76 78 } 77 79 … … 80 82 var start = GenerationsIntervalStart.Value; 81 83 var step = GenerationsInterval.Value; 84 if (iteration == 0) return false; 82 85 if (iteration < start) return false; 83 84 86 if ((iteration - start) % step == 0) return true; 85 87 -
branches/Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/SlidingWindow/SlidingWindowAnalyzer.cs
r7845 r7850 20 20 #endregion 21 21 22 using System; 22 23 using HeuristicLab.Common; 23 24 using HeuristicLab.Core; … … 35 36 private const string ResultCollectionParameterName = "Results"; 36 37 private const string FitnessCalculationPartitionParameterName = "FitnessCalculationPartition"; 37 private const string SlidingWindowParameterName = "Sliding Window";38 38 private const string SlidingWindowSizeParameterName = "Sliding Window Size"; 39 39 private const string SlidingWindowStepWidthParameterName = "Sliding Window Step Width"; … … 52 52 } 53 53 54 public IValueLookupParameter<IntRange> SlidingWindowParameter {55 get { return (IValueLookupParameter<IntRange>)Parameters[SlidingWindowParameterName]; }56 }57 54 public IFixedValueParameter<IntValue> SlidingWindowSizeParameter { 58 55 get { return (IFixedValueParameter<IntValue>)Parameters[SlidingWindowSizeParameterName]; } … … 65 62 #region properties 66 63 public bool EnabledByDefault { get { return false; } } 67 public IntRange SlidingWindow { get { return SlidingWindowParameter.Value; } }68 64 public IntValue SlidingWindowSize { get { return SlidingWindowSizeParameter.Value; } } 69 65 public IntValue SlidingWindowStepWidth { get { return SlidingWindowStepWidthParameter.Value; } } … … 77 73 78 74 protected SlidingWindowAnalyzer() { 75 Parameters.Add(new LookupParameter<ResultCollection>(ResultCollectionParameterName, "The result collection to store the analysis results.")); 79 76 Parameters.Add(new ValueLookupParameter<T>(ProblemDataParameterName, "The problem data on which the symbolic data analysis solution should be evaluated.")); 80 77 Parameters.Add(new LookupParameter<IntRange>(FitnessCalculationPartitionParameterName, "")); 81 Parameters.Add(new ValueLookupParameter<IntRange>(SlidingWindowParameterName, ""));82 78 Parameters.Add(new FixedValueParameter<IntValue>(SlidingWindowSizeParameterName, "", new IntValue(1))); 83 79 Parameters.Add(new FixedValueParameter<IntValue>(SlidingWindowStepWidthParameterName, "", new IntValue(1))); … … 85 81 86 82 public override IOperation Apply() { 87 if (!ExecutionContext.Scope.Variables.ContainsKey(FitnessCalculationPartitionParameter.ActualName))88 ExecutionContext.Scope.Variables.Add(new Core.Variable(FitnessCalculationPartitionParameter.ActualName, (IntRange)SlidingWindow.Clone()));89 90 83 if (CheckForUpdate()) { 91 84 var fitnessPartition = FitnessCalculationPartitionParameter.ActualValue; 85 if (fitnessPartition.End - fitnessPartition.Start == SlidingWindowSize.Value) 86 fitnessPartition.Start += SlidingWindowStepWidth.Value; 92 87 93 88 fitnessPartition.End += SlidingWindowStepWidth.Value; 94 if (fitnessPartition.End - fitnessPartition.Start > SlidingWindowS tepWidth.Value)89 if (fitnessPartition.End - fitnessPartition.Start > SlidingWindowSize.Value) 95 90 fitnessPartition.End = fitnessPartition.Start + SlidingWindowSize.Value; 96 97 if (fitnessPartition.End - fitnessPartition.Start == SlidingWindowSize.Value) {98 fitnessPartition.Start += SlidingWindowStepWidth.Value;99 }100 91 } 101 92 … … 104 95 SlidingWindowData slidingWindowData; 105 96 if (!results.ContainsKey(SlidingWindowDataResultName)) { 106 slidingWindowData = new SlidingWindowData(FitnessCalculationPartitionParameter.ActualValue, new double[10]); 97 string targetVariable; 98 var classificationProblemData = ProblemDataParameter.ActualValue as IClassificationProblemData; 99 var regressionProblemData = ProblemDataParameter.ActualValue as IRegressionProblemData; 100 if (classificationProblemData != null) targetVariable = classificationProblemData.TargetVariable; 101 else if (regressionProblemData != null) targetVariable = regressionProblemData.TargetVariable; 102 else throw new NotSupportedException(); 103 104 var targetData = ProblemDataParameter.ActualValue.Dataset.GetDoubleValues(targetVariable); 105 slidingWindowData = new SlidingWindowData(FitnessCalculationPartitionParameter.ActualValue, targetData); 107 106 results.Add(new Result(SlidingWindowDataResultName, slidingWindowData)); 108 } else slidingWindowData = (SlidingWindowData)results[SlidingWindowDataResultName] ;107 } else slidingWindowData = (SlidingWindowData)results[SlidingWindowDataResultName].Value; 109 108 110 109 slidingWindowData.SlidingWindowPosition.Start = FitnessCalculationPartitionParameter.ActualValue.Start; -
branches/Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/SymbolicDataAnalysisProblem.cs
r7726 r7850 32 32 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 33 33 using HeuristicLab.PluginInfrastructure; 34 using HeuristicLab.Problems.Instances; 34 35 35 36 namespace HeuristicLab.Problems.DataAnalysis.Symbolic { 36 37 [StorableClass] 37 public abstract class SymbolicDataAnalysisProblem<T, U, V> : HeuristicOptimizationProblem<U, V>, IDataAnalysisProblem<T>, ISymbolicDataAnalysisProblem, IStorableContent 38 public abstract class SymbolicDataAnalysisProblem<T, U, V> : HeuristicOptimizationProblem<U, V>, IDataAnalysisProblem<T>, ISymbolicDataAnalysisProblem, IStorableContent, 39 IProblemInstanceConsumer<T>, IProblemInstanceExporter<T> 38 40 where T : class, IDataAnalysisProblemData 39 41 where U : class, ISymbolicDataAnalysisEvaluator<T> … … 204 206 Operators.Add(new MinAverageMaxSymbolicExpressionTreeLengthAnalyzer()); 205 207 Operators.Add(new SymbolicExpressionTreeLengthAnalyzer()); 208 Operators.Add(new GenerationalSlidingWindowAnalyzer<T>()); 206 209 ParameterizeOperators(); 207 210 } … … 318 321 op.EvaluatorParameter.ActualName = EvaluatorParameter.Name; 319 322 } 320 } 321 322 public abstract void ImportProblemDataFromFile(string fileName); 323 324 foreach (var op in operators.OfType<SlidingWindowAnalyzer<T>>()) { 325 op.FitnessCalculationPartitionParameter.ActualName = FitnessCalculationPartitionParameter.Name; 326 op.ProblemDataParameter.ActualName = ProblemDataParameter.Name; 327 328 var start = ProblemData.TrainingPartition.Start; 329 var end = ProblemData.TrainingPartition.End; 330 var size = (end - start) / 5; 331 op.SlidingWindowSize.Value = size; 332 op.SlidingWindowStepWidth.Value = size / 2; 333 } 334 } 335 336 #region Import & Export 337 public void Load(T data) { 338 Name = data.Name; 339 Description = data.Description; 340 ProblemData = data; 341 OnReset(); 342 } 343 344 public T Export() { 345 return ProblemData; 346 } 347 #endregion 323 348 } 324 349 }
Note: See TracChangeset
for help on using the changeset viewer.