Changeset 8419
- Timestamp:
- 08/06/12 18:52:22 (12 years ago)
- Location:
- trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/GaussianProcessHyperparameterInitializer.cs
r8401 r8419 38 38 private const string ProblemDataParameterName = "ProblemData"; 39 39 private const string HyperparameterParameterName = "Hyperparameter"; 40 private const string RandomParameterName = "Random"; 40 41 41 42 #region Parameter Properties … … 49 50 public ILookupParameter<IDataAnalysisProblemData> ProblemDataParameter { 50 51 get { return (ILookupParameter<IDataAnalysisProblemData>)Parameters[ProblemDataParameterName]; } 52 } 53 public ILookupParameter<IRandom> RandomParameter { 54 get { return (ILookupParameter<IRandom>)Parameters[RandomParameterName]; } 51 55 } 52 56 // out … … 71 75 Parameters.Add(new LookupParameter<ICovarianceFunction>(CovarianceFunctionParameterName, "The covariance function for the Gaussian process model.")); 72 76 Parameters.Add(new LookupParameter<IDataAnalysisProblemData>(ProblemDataParameterName, "The input data for the Gaussian process.")); 77 Parameters.Add(new LookupParameter<IRandom>(RandomParameterName, "The pseudo random number generator to use for initializing the hyperparameter vector.")); 73 78 // out 74 79 Parameters.Add(new LookupParameter<RealVector>(HyperparameterParameterName, "The initial hyperparameter vector for the Gaussian process model.")); … … 83 88 int l = 1 + MeanFunction.GetNumberOfParameters(inputVariablesCount) + 84 89 CovarianceFunction.GetNumberOfParameters(inputVariablesCount); 85 HyperparameterParameter.ActualValue = new RealVector(l); 90 var r = new RealVector(l); 91 var rand = RandomParameter.ActualValue; 92 for (int i = 0; i < r.Length; i++) 93 r[i] = rand.NextDouble() * 4 - 2; 94 95 HyperparameterParameter.ActualValue = r; 86 96 return base.Apply(); 87 97 } -
trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/GaussianProcessRegression.cs
r8401 r8419 55 55 private const string MinimizationIterationsParameterName = "Iterations"; 56 56 private const string ApproximateGradientsParameterName = "ApproximateGradients"; 57 private const string SeedParameterName = "Seed"; 58 private const string SetSeedRandomlyParameterName = "SetSeedRandomly"; 57 59 58 60 #region parameter properties … … 65 67 public IValueParameter<IntValue> MinimizationIterationsParameter { 66 68 get { return (IValueParameter<IntValue>)Parameters[MinimizationIterationsParameterName]; } 69 } 70 public IValueParameter<IntValue> SeedParameter { 71 get { return (IValueParameter<IntValue>)Parameters[SeedParameterName]; } 72 } 73 public IValueParameter<BoolValue> SetSeedRandomlyParameter { 74 get { return (IValueParameter<BoolValue>)Parameters[SetSeedRandomlyParameterName]; } 67 75 } 68 76 #endregion … … 80 88 get { return MinimizationIterationsParameter.Value.Value; } 81 89 } 90 public int Seed { get { return SeedParameter.Value.Value; } set { SeedParameter.Value.Value = value; } } 91 public bool SetSeedRandomly { get { return SetSeedRandomlyParameter.Value.Value; } set { SetSeedRandomlyParameter.Value.Value = value; } } 82 92 #endregion 93 83 94 [StorableConstructor] 84 95 private GaussianProcessRegression(bool deserializing) : base(deserializing) { } … … 101 112 new ItemSet<ICovarianceFunction>(covFunctions), covFunctions.First())); 102 113 Parameters.Add(new ValueParameter<IntValue>(MinimizationIterationsParameterName, "The number of iterations for likelihood optimization with LM-BFGS.", new IntValue(20))); 114 Parameters.Add(new ValueParameter<IntValue>(SeedParameterName, "The random seed used to initialize the new pseudo random number generator.", new IntValue(0))); 115 Parameters.Add(new ValueParameter<BoolValue>(SetSeedRandomlyParameterName, "True if the random seed should be set to a random value, otherwise false.", new BoolValue(true))); 116 103 117 Parameters.Add(new ValueParameter<BoolValue>(ApproximateGradientsParameterName, "Indicates that gradients should not be approximated (necessary for LM-BFGS).", new BoolValue(false))); 104 118 Parameters[ApproximateGradientsParameterName].Hidden = true; // should not be changed 105 119 120 var randomCreator = new HeuristicLab.Random.RandomCreator(); 106 121 var gpInitializer = new GaussianProcessHyperparameterInitializer(); 107 122 var bfgsInitializer = new LbfgsInitializer(); … … 115 130 var solutionCreator = new GaussianProcessRegressionSolutionCreator(); 116 131 117 OperatorGraph.InitialOperator = gpInitializer; 132 OperatorGraph.InitialOperator = randomCreator; 133 randomCreator.SeedParameter.ActualName = SeedParameterName; 134 randomCreator.SeedParameter.Value = null; 135 randomCreator.SetSeedRandomlyParameter.ActualName = SetSeedRandomlyParameterName; 136 randomCreator.SetSeedRandomlyParameter.Value = null; 137 randomCreator.Successor = gpInitializer; 118 138 119 139 gpInitializer.CovarianceFunctionParameter.ActualName = CovarianceFunctionParameterName; … … 121 141 gpInitializer.ProblemDataParameter.ActualName = Problem.ProblemDataParameter.Name; 122 142 gpInitializer.HyperparameterParameter.ActualName = modelCreator.HyperparameterParameter.Name; 143 gpInitializer.RandomParameter.ActualName = randomCreator.RandomParameter.Name; 123 144 gpInitializer.Successor = bfgsInitializer; 124 145 -
trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/HeuristicLab.Algorithms.DataAnalysis-3.4.csproj
r8417 r8419 304 304 <Private>False</Private> 305 305 </ProjectReference> 306 <ProjectReference Include="..\..\HeuristicLab.Random\3.3\HeuristicLab.Random-3.3.csproj"> 307 <Project>{F4539FB6-4708-40C9-BE64-0A1390AEA197}</Project> 308 <Name>HeuristicLab.Random-3.3</Name> 309 <Private>False</Private> 310 </ProjectReference> 306 311 </ItemGroup> 307 312 <ItemGroup> -
trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/Plugin.cs.frame
r8401 r8419 47 47 [PluginDependency("HeuristicLab.Problems.DataAnalysis.Symbolic.Regression", "3.4")] 48 48 [PluginDependency("HeuristicLab.LibSVM", "1.6.3")] 49 [PluginDependency("HeuristicLab.Random", "3.3")] 49 50 public class HeuristicLabAlgorithmsDataAnalysisPlugin : PluginBase { 50 51 }
Note: See TracChangeset
for help on using the changeset viewer.