Changeset 14686
- Timestamp:
- 02/17/17 15:54:27 (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/OptimizationNetworks/HeuristicLab.Networks.IntegratedOptimization.MachineLearning/FeatureSelectionOrchestrator.cs
r14675 r14686 105 105 var orchestrationMessage = RegressionOrchestrationPort.PrepareMessage(); 106 106 orchestrationMessage["Problem"] = new RegressionProblem() { ProblemData = problemData }; 107 orchestrationMessage["OrchestrationMessage"] = new EnumValue<OrchestrationMessage>(OrchestrationMessage.Prepare );107 orchestrationMessage["OrchestrationMessage"] = new EnumValue<OrchestrationMessage>(OrchestrationMessage.Prepare | OrchestrationMessage.ClearRuns); 108 108 RegressionOrchestrationPort.SendMessage(orchestrationMessage, token); 109 109 … … 115 115 116 116 var regressionSolution = results.Select(r => r.Value).OfType<IRegressionSolution>().First(); 117 double quality = regressionSolution.TestMeanAbsoluteError; 117 118 118 119 UpdatedResults(binaryVector, regressionSolution); 119 120 121 double quality = regressionSolution.TestMeanAbsoluteError;122 120 evaluationMessage["Quality"] = new DoubleValue(quality); 123 121 } 124 122 125 123 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 } 124 if (!Results.ContainsKey("Best Vector")) Results.Add(new Result("Best Vector", typeof(BinaryVector))); 125 if (!Results.ContainsKey("Best Solution")) Results.Add(new Result("Best Solution", typeof(IRegressionSolution))); 131 126 132 var previousBestVector = (BinaryVector)Results["Best Solution Vector"].Value; 127 var previousBestVector = (BinaryVector)Results["Best Vector"].Value; 128 var prevoiusBestSolution = (IRegressionSolution)Results["Best Solution"].Value; 133 129 134 //check if better vector has been found135 if (prev iousBestVector != null && binaryVector.SequenceEqual(previousBestVector))130 //check if better vector & solution has been found 131 if (prevoiusBestSolution != null && prevoiusBestSolution.TestMeanAbsoluteError < solution.TestMeanAbsoluteError) 136 132 return; 137 133 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 134 Results["Best Vector"].Value = binaryVector; 135 Results["Best Solution"].Value = solution; 153 136 } 154 137 … … 156 139 //TODO Remove methods 157 140 public override void Pause() { network.Pause(); } 158 public override void Prepare(bool clearRuns = false) { network.Prepare(clearRuns); }141 public override void Prepare(bool clearRuns = false) { network.Prepare(clearRuns); Results.Clear(); } 159 142 public override void Start() { network.Start(); } 160 143 public override void Stop() { network.Stop(); }
Note: See TracChangeset
for help on using the changeset viewer.