- Timestamp:
- 07/11/19 16:30:22 (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2988_ModelsOfModels2/HeuristicLab.Algorithms.EMM/HelpFunctions.cs
r17002 r17134 20 20 #endregion 21 21 using HeuristicLab.Core; 22 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding; 23 using HeuristicLab.Problems.DataAnalysis.Symbolic; 24 using HeuristicLab.Random; 22 25 using System.Collections.Generic; 23 26 using System.Linq; … … 85 88 return maxElementNumber; 86 89 } 87 public static double CheckSocialKatre(double socialKarteValue, double value, double stepValue) {88 if (value > (socialKarteValue + stepValue))89 return stepValue;90 else if (value > socialKarteValue)91 return (value - socialKarteValue);92 else return 0;93 }94 public static void ProbabilitiesUpDate(List<List<double>> sucsessStatistics, List<double> probabilities) {95 90 96 var averageQuality = new List<double>(); 97 foreach (var variant in sucsessStatistics) { 98 if (variant[0] > 0.005) { 99 averageQuality.Add(variant[1] / variant[0]); 100 } else { averageQuality.Add(0); } 91 public static void SetLocalParametersForTree(IRandom random, double shakingFactor, ISymbolicExpressionTree tree) { 92 foreach (var node in tree.IterateNodesPrefix().Where(x => x.HasLocalParameters)) { 93 if (node is VariableTreeNode variableTreeNode) { 94 var symbol = variableTreeNode.Symbol; 95 variableTreeNode.Weight = NormalDistributedRandom.NextDouble(random, symbol.WeightManipulatorMu, symbol.WeightManipulatorSigma); 96 } else { 97 node.ResetLocalParameters(random); 98 } 101 99 } 102 int bestModelNumber = ChooseMaxElementIndex(averageQuality);103 double socialKarte = 1.0 / (probabilities.Count * 20.0); // parameters of method104 double stepValue = socialKarte / 5.0;105 double totalChangeValue = 0, changeValue = 0;106 for (int i = 0; i < probabilities.Count; i++) {107 changeValue = CheckSocialKatre(socialKarte, probabilities[i], stepValue);108 totalChangeValue += changeValue;109 probabilities[i] -= changeValue;110 }111 probabilities[bestModelNumber] += totalChangeValue;112 100 } 113 101 }
Note: See TracChangeset
for help on using the changeset viewer.