public FeatureInteractions GetFeatureInteractions(int maxInteractionDepth = -1, int maxDeepening = -1) { FeatureInteractions xgbFeatureInteractions = new FeatureInteractions(); _maxInteractionDepth = maxInteractionDepth; _maxDeepening = maxDeepening; Console.ResetColor(); if (_maxInteractionDepth == -1) { Console.WriteLine(String.Format("Collectiong feature interactions")); } else { Console.WriteLine(String.Format("Collectiong feature interactions up to depth {0}", _maxInteractionDepth)); } for (int i = 0; i < NumTrees; i++) { Console.ForegroundColor = ConsoleColor.DarkGreen; Console.Write(String.Format("Collectiong feature interactions within tree #{0} ", i + 1)); _treeFeatureInteractions = new FeatureInteractions(); _pathMemo = new HashSet <string>(); _treeIndex = i; CollectFeatureInteractions(XgbTrees[i], new HashSet <XgbTreeNode>(), currentGain: 0, currentCover: 0, pathProbability: 1, depth: 0, deepening: 0); //double treeGain = _treeFeatureInteractions.GetFeatureInteractionsOfDepth(0).Sum(x => x.Value.Gain); //foreach (KeyValuePair<string, FeatureInteraction> fi in _treeFeatureInteractions) //{ // fi.Value.Gain /= treeGain; //} Console.WriteLine(String.Format("=> number of interactions: {0}", _treeFeatureInteractions.Count)); Console.ResetColor(); xgbFeatureInteractions.Merge(_treeFeatureInteractions); } Console.ForegroundColor = ConsoleColor.Green; Console.WriteLine(String.Format("{0} feature interactions has been collected.\n", xgbFeatureInteractions.Count)); Console.ResetColor(); return(xgbFeatureInteractions); }