- Timestamp:
- 07/29/09 18:28:45 (15 years ago)
- Location:
- branches/GP-Refactoring-713/sources/HeuristicLab.LinearRegression/3.2
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/GP-Refactoring-713/sources/HeuristicLab.LinearRegression/3.2/HeuristicLab.LinearRegression-3.2.csproj
r2161 r2210 113 113 <Name>HeuristicLab.Data-3.2</Name> 114 114 </ProjectReference> 115 <ProjectReference Include="..\..\HeuristicLab.GP.Interfaces\3.3\HeuristicLab.GP.Interfaces-3.3.csproj"> 116 <Project>{924B6BEA-9A99-40FE-9334-5C01E8D540EC}</Project> 117 <Name>HeuristicLab.GP.Interfaces-3.3</Name> 118 </ProjectReference> 115 119 <ProjectReference Include="..\..\HeuristicLab.GP.StructureIdentification\3.3\HeuristicLab.GP.StructureIdentification-3.3.csproj"> 116 120 <Project>{74223A32-C726-4978-BE78-37113A18373C}</Project> -
branches/GP-Refactoring-713/sources/HeuristicLab.LinearRegression/3.2/HeuristicLabLinearRegressionPlugin.cs
r2161 r2210 32 32 [Dependency(Dependency = "HeuristicLab.DataAnalysis-3.2")] 33 33 [Dependency(Dependency = "HeuristicLab.GP-3.3")] 34 [Dependency(Dependency = "HeuristicLab.GP.Interfaces-3.3")] 34 35 [Dependency(Dependency = "HeuristicLab.GP.StructureIdentification-3.3")] 35 36 [Dependency(Dependency = "HeuristicLab.Modeling-3.2")] -
branches/GP-Refactoring-713/sources/HeuristicLab.LinearRegression/3.2/LinearRegression.cs
r2164 r2210 34 34 using HeuristicLab.GP; 35 35 using HeuristicLab.Random; 36 using HeuristicLab.GP.Interfaces; 36 37 37 38 namespace HeuristicLab.LinearRegression { … … 281 282 model.TestVarianceAccountedFor = bestModelScope.GetVariableValue<DoubleData>("TestVAF", false).Data; 282 283 283 model.Data = bestModelScope.GetVariableValue<I FunctionTree>("LinearRegressionModel", false);284 model.Data = bestModelScope.GetVariableValue<IGeneticProgrammingModel>("LinearRegressionModel", false); 284 285 HeuristicLab.DataAnalysis.Dataset ds = bestModelScope.GetVariableValue<Dataset>("Dataset", true); 285 286 model.Dataset = ds; -
branches/GP-Refactoring-713/sources/HeuristicLab.LinearRegression/3.2/LinearRegressionOperator.cs
r2202 r2210 28 28 using HeuristicLab.GP; 29 29 using HeuristicLab.GP.StructureIdentification; 30 using HeuristicLab.GP.Interfaces; 30 31 31 32 namespace HeuristicLab.LinearRegression { … … 38 39 AddVariableInfo(new VariableInfo("SamplesStart", "Start index of samples in dataset to evaluate", typeof(IntData), VariableKind.In)); 39 40 AddVariableInfo(new VariableInfo("SamplesEnd", "End index of samples in dataset to evaluate", typeof(IntData), VariableKind.In)); 40 AddVariableInfo(new VariableInfo("LinearRegressionModel", "Formula that was calculated by linear regression", typeof(IFunctionTree), VariableKind.Out | VariableKind.New)); 41 AddVariableInfo(new VariableInfo("TreeSize", "The size (number of nodes) of the tree", typeof(IntData), VariableKind.New | VariableKind.Out)); 42 AddVariableInfo(new VariableInfo("TreeHeight", "The height of the tree", typeof(IntData), VariableKind.New | VariableKind.Out)); 41 AddVariableInfo(new VariableInfo("LinearRegressionModel", "Formula that was calculated by linear regression", typeof(IGeneticProgrammingModel), VariableKind.Out | VariableKind.New)); 43 42 } 44 43 … … 55 54 double[] coefficients = CalculateCoefficients(inputMatrix, targetVector); 56 55 IFunctionTree tree = CreateModel(coefficients, allowedColumns.Select(i => dataset.GetVariableName(i)).ToList()); 57 58 scope.AddVariable(new HeuristicLab.Core.Variable(scope.TranslateName("LinearRegressionModel"), tree)); 59 scope.AddVariable(new HeuristicLab.Core.Variable(scope.TranslateName("TreeSize"), new IntData(tree.Size))); 60 scope.AddVariable(new HeuristicLab.Core.Variable(scope.TranslateName("TreeHeight"), new IntData(tree.Height))); 56 57 scope.AddVariable(new HeuristicLab.Core.Variable(scope.TranslateName("LinearRegressionModel"), new GeneticProgrammingModel(tree))); 61 58 return null; 62 59 } … … 73 70 GP.StructureIdentification.Variable v; 74 71 for (int i = 0; i < coefficients.Length - 1; i++) { 75 var vNode = new GP.StructureIdentification.Variable().GetTreeNode();76 vNode. GetLocalVariable(GP.StructureIdentification.Variable.INDEX).Value = new StringData(allowedVariables[i]);77 vNode. GetLocalVariable(GP.StructureIdentification.Variable.WEIGHT).Value = new DoubleData(coefficients[i]);78 vNode. GetLocalVariable(GP.StructureIdentification.Variable.OFFSET).Value = new ConstrainedIntData(0);72 var vNode = (VariableFunctionTree)new GP.StructureIdentification.Variable().GetTreeNode(); 73 vNode.VariableName = allowedVariables[i]; 74 vNode.Weight = coefficients[i]; 75 vNode.SampleOffset = 0; 79 76 nodes.Enqueue(vNode); 80 77 } 81 var cNode = new Constant().GetTreeNode();78 var cNode = (ConstantFunctionTree)new Constant().GetTreeNode(); 82 79 83 cNode. GetLocalVariable(GP.StructureIdentification.Constant.VALUE).Value = new DoubleData(coefficients[coefficients.Length - 1]);80 cNode.Value = coefficients[coefficients.Length - 1]; 84 81 nodes.Enqueue(cNode); 85 82
Note: See TracChangeset
for help on using the changeset viewer.