Changeset 14675
- Timestamp:
- 02/16/17 12:15:11 (8 years ago)
- Location:
- branches/OptimizationNetworks
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/OptimizationNetworks/HeuristicLab.IntegratedMachineLearning.sln
r14625 r14675 42 42 HideSolutionNode = FALSE 43 43 EndGlobalSection 44 GlobalSection(Performance) = preSolution 45 HasPerformanceSessions = true 46 EndGlobalSection 44 47 EndGlobal -
branches/OptimizationNetworks/HeuristicLab.Networks.IntegratedOptimization.MachineLearning/FeatureSelectionNetwork.cs
r14635 r14675 69 69 70 70 var regressionAlgorithm = CreateRegressionAlgorithm(); 71 //TODO set empty regression problem72 73 71 RegressionAlgorithmNode = new OrchestratedAlgorithmNode("Regression"); 74 72 RegressionAlgorithmNode.Algorithm = regressionAlgorithm; … … 81 79 var problem = new OrchestratedBinaryProblem(Orchestrator, 0, false); 82 80 problem.Encoding.SolutionCreator = new RandomBinaryVectorCreator() { TrueProbability = new DoubleValue(0.2) }; 83 84 81 85 82 var osga = new OffspringSelectionGeneticAlgorithm(); … … 126 123 var msg = FeatureSelectionAlgorithmNode.OrchestrationPort.PrepareMessage(); 127 124 msg["OrchestrationMessage"] = new EnumValue<OrchestrationMessage>(OrchestrationMessage.Stop); 128 FeatureSelectionAlgorithmNode.OrchestrationPort.ReceiveMessage(msg, new CancellationToken()); ; 125 FeatureSelectionAlgorithmNode.OrchestrationPort.ReceiveMessage(msg, new CancellationToken()); 126 RegressionAlgorithmNode.Algorithm.Runs.Clear(); 129 127 } 130 128 } -
branches/OptimizationNetworks/HeuristicLab.Networks.IntegratedOptimization.MachineLearning/FeatureSelectionOrchestrator.cs
r14631 r14675 93 93 94 94 private void FeatureSelectionEvaluationPort_MessageReceived(IMessage evaluationMessage, CancellationToken token) { 95 var problemData = (IRegressionProblemData)RegressionProblemData.Clone(); 95 96 var binaryVector = (BinaryVector)evaluationMessage["BinaryVector"]; 96 var problemData = (IRegressionProblemData)RegressionProblemData.Clone();97 binaryVector.ElementNames = problemData.InputVariables.CheckedItems.Select(variable => variable.Value.Value); 97 98 98 99 var allowedVariables = problemData.InputVariables.CheckedItems.Zip(binaryVector, 99 100 (variable, allowed) => new { VariableName = variable.Value, Allowed = allowed }); 101 100 102 foreach (var allowedVariable in allowedVariables) 101 103 problemData.InputVariables.SetItemCheckedState(allowedVariable.VariableName, allowedVariable.Allowed); … … 113 115 114 116 var regressionSolution = results.Select(r => r.Value).OfType<IRegressionSolution>().First(); 117 118 UpdatedResults(binaryVector, regressionSolution); 119 120 115 121 double quality = regressionSolution.TestMeanAbsoluteError; 116 122 evaluationMessage["Quality"] = new DoubleValue(quality); 123 } 124 125 private void UpdatedResults(BinaryVector binaryVector, IRegressionSolution solution) { 126 if (!Results.ContainsKey("Best Solution Vector")) { 127 Results.Add(new Result("Best Solution Vector", typeof(BinaryVector))); 128 //Results.Add(new Result("Best Solution Variables", typeof(DoubleArray))); 129 Results.Add(new Result("Best Symbolic Solution", typeof(IRegressionSolution))); 130 } 131 132 var previousBestVector = (BinaryVector)Results["Best Solution Vector"].Value; 133 134 //check if better vector has been found 135 if (previousBestVector != null && binaryVector.SequenceEqual(previousBestVector)) 136 return; 137 138 Results["Best Solution Vector"].Value = binaryVector; 139 Results["Best Symbolic Solution"].Value = solution; 140 141 //var variableNames = solution.ProblemData.AllowedInputVariables; 142 //alglib.linearmodel lm = BuildModel(best, problemData); 143 144 //double[] coefficients = null; 145 //int nFeatures = -1; 146 //alglib.lrunpack(lm, out coefficients, out nFeatures); 147 148 //var doubleArray = new DoubleArray(coefficients.ToArray()); 149 //doubleArray.ElementNames = variableNames; 150 //Results["Best Solution Variables"].Value = doubleArray; 151 152 117 153 } 118 154 -
branches/OptimizationNetworks/HeuristicLab.Networks.IntegratedOptimization.MachineLearning/HeuristicLab.Networks.IntegratedOptimization.MachineLearning-3.3.csproj
r14628 r14675 37 37 </PropertyGroup> 38 38 <ItemGroup> 39 <Reference Include="ALGLIB-3.7.0, Version=3.7.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL"> 40 <SpecificVersion>False</SpecificVersion> 41 <HintPath>..\..\..\trunk\sources\bin\ALGLIB-3.7.0.dll</HintPath> 42 <Private>False</Private> 43 </Reference> 39 44 <Reference Include="HeuristicLab.Algorithms.DataAnalysis-3.4, Version=3.4.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL"> 40 45 <SpecificVersion>False</SpecificVersion> -
branches/OptimizationNetworks/HeuristicLab.Networks.IntegratedOptimization.MachineLearning/OrchestratedBinaryProblem.cs
r14625 r14675 30 30 namespace HeuristicLab.Networks.IntegratedOptimization.MachineLearning { 31 31 [StorableClass] 32 [Creatable("Optimization Networks")] 32 33 public sealed class OrchestratedBinaryProblem : SingleObjectiveBasicProblem<BinaryVectorEncoding> { 33 34
Note: See TracChangeset
for help on using the changeset viewer.