# Changeset 15438

Ignore:
Timestamp:
10/28/17 19:56:51 (3 years ago)
Message:

#2796 refactoring to simplify the code

Location:
branches/MCTS-SymbReg-2796
Files:
5 deleted
7 edited

Unmodified
Removed
• ## branches/MCTS-SymbReg-2796/HeuristicLab.Algorithms.DataAnalysis/3.4/HeuristicLab.Algorithms.DataAnalysis.MCTSSymbReg.csproj

 r15437
• ## branches/MCTS-SymbReg-2796/HeuristicLab.Algorithms.DataAnalysis/3.4/Heuristics.cs

 r15437 public static class Heuristics { public static double CorrelationForInteraction(double[] a, double[] b, double[] c, double[] target) { return 0.0; } public static double CorrelationForInteraction(double[] a, double[] b, double[] z) { // var am = a.Average(); var bm = b.Average(); var cm = c.Average(); var p1 = Enumerable.Range(0, a.Length).Where(i => a[i] < am); var p2 = Enumerable.Range(0, a.Length).Where(i => a[i] > am); var p3 = Enumerable.Range(0, a.Length).Where(i => b[i] < bm); var p4 = Enumerable.Range(0, a.Length).Where(i => b[i] > bm); var p5 = Enumerable.Range(0, a.Length).Where(i => c[i] < cm); var p6 = Enumerable.Range(0, a.Length).Where(i => c[i] > cm); return 1.0 / (p1.Count() + p2.Count() + p3.Count() + p4.Count() + p5.Count() + p6.Count()) * ( p1.Count() * CorrelationForInteraction(b, c, target, p1) + p2.Count() * CorrelationForInteraction(b, c, target, p2) + p3.Count() * CorrelationForInteraction(a, c, target, p3) + p4.Count() * CorrelationForInteraction(a, c, target, p3) + p5.Count() * CorrelationForInteraction(a, b, target, p5) + p6.Count() * CorrelationForInteraction(a, b, target, p6) ); } public static double CorrelationForInteraction(double[] a, double[] b, double[] z) { return CorrelationForInteraction(a, b, z, Enumerable.Range(0, a.Length)); } public static double CorrelationForInteraction(double[] a, double[] b, double[] z, IEnumerable idx) { // var am = a.Average(); var bm = b.Average(); var p1 = idx.Where(i => a[i] < am); var p2 = idx.Where(i => a[i] > am); var p3 = idx.Where(i => b[i] < bm); var p4 = idx.Where(i => b[i] > bm); return 1.0 / (p1.Count() + p2.Count() + p3.Count() + p4.Count()) *